About BLOBS (Was Re: [Gambas-user] Oh dear... Gambas Source (implement blob into gb.db))

Benoit Minisini gambas at ...1...
Mon Mar 14 12:34:04 CET 2005


On Friday 11 March 2005 15:39, Rob wrote:
> On Friday 11 March 2005 06:46, Thomas Kleindienst wrote:
> > I had the idea to implement blobs into GB.db myself, but I'm lost
> > in the code (dunno where to start)
> >
> > should be like:
> >
> > dim ba as byte[]
>
> I think I asked this before, but I don't think anyone responded.
> What's the downside to just adding a join() method to the Byte[]
> class, since inserting blobs as strings seems to work fine?
>
> Won't your modifications to gb.db just be implementing a join()-like
> functionality anyway, internally to the component?
>
> Under what circumstances would you use byte[] in Gambas rather than
> string[] or integer[]?
>
> It looks like the code that maps blobs to strings is
> driver-specific.... in src/lib/db/mysql/main.c and
> src/lib/db/sqlite/sqlitedataset.cpp.  In the case of mysql, I'd say
> you need to change it so a BLOB becomes a GB_T_OBJECT and do what you
> need to do to allocate the object and populate it.  Either that or
> you can look at DB_Format in src/lib/db/main.c and try to add code to
> accept GB_T_OBJECT arguments and then verify that they're Byte[]
> arguments, then do pretty much the same thing as the GB_T_STRING and
> GB_T_CSTRING cases do.
>
> That's where I'd start, anyway, not having looked at the db component
> and drivers until 5 minutes ago.  I'm copying gambas-devel because
> we're getting into devel territory.
>
> Rob
>

I know that when you want to insert BLOBs with Postgresql, you must use 
external files, not strings. I don't know the exact syntax in MySQL and 
SQLite.

As for the Gambas syntax in the database component, I din't think about that 
yet: a Variant could be the good type, but we need to have a way to store any 
Variant in binary form. That means serialization support! As we don't have 
it, we can start by using a Byte[] array only.

Regards,

-- 
Benoit Minisini
mailto:gambas at ...1...




More information about the User mailing list