[Gambas-user] [Gambas-devel] MySQL: case FIELD_TYPE_BLOB

Benoit Minisini gambas at ...1...
Thu Aug 23 20:54:22 CEST 2007


On jeudi 23 août 2007, ron wrote:
> On Sunday 19 August 2007 23:44, ron wrote:
> > On Sunday 19 August 2007 22:43, ron wrote:
> > > Hi Benoit,
> > > I found in '/2.0/trunk/gb.db.mysql/src/main.c'
> > >
> > > case FIELD_TYPE_BLOB: // TEXT
> > >   175           //fprintf(stderr, "FIELD_TYPE_BLOB: %d\n", len);
> > >   176           if (len == 16777215 || len <= 0) // LONG BLOB
> > >   177                   return DB_T_BLOB;
> > >   178                   else
> > >   179                           return GB_T_STRING;
> > >
> > >
> > > 16777214 return GB_T_STRING;
> > > 16777215 return DB_T_BLOB;
> > > 16777216 return GB_T_STRING;
> > >
> > > Should it no be 'if (len >= 16777215 || len <= 0)' ? :)
> > >
> > > Ron
> >
> >   405           // query_fill() only gets this constant, whatever the
> > blob is 406     case FIELD_TYPE_BLOB:
> >   407           if (len == 16777215 || len <= 0) // LONG BLOB
> >   408           {
> >   409                           val->type = GB_T_NULL;
> >   410                           break;
> >   411                   }
> >
> >
> > Investigating the magic number '16777215'
> >
> >
> > TINYBLOB	Blob up to 255 bytes	N+1
> > TINYTEXT	Text up to 255 chars	N+1
> > BLOB		Blob up to 65535	N+2
> > TEXT		Text up to 65535	N+2
> > MEDIUMBLOB	-> 16777215		N+3
> > MEDIUMTEXT	-> 16777215		N+3
> > LONGBLOB	-> 4GB			N+4
> > LONGTEXT	-> 4GB			N+4
> >
> > Must be 'if (len > 16777215 || len <= 0)' ??? :)
> >
> >
> > Ron
>
> Futher investigating shows me that I must be correct
> and there is something wrong now.
>
> The value 16777215 equals to 0x00FFFFFF
> The if condition must be 'if (len > 16777215 || len <= 0)'
>
>
>
> Kicked by me.
>

Don't worry, I will look at the database component as soon as I have finished 
what I'm currently doing on gb.gtk.

Regards,


-- 
Benoit Minisini




More information about the User mailing list