[Gambas-devel] MySQL: case FIELD_TYPE_BLOB
ron
ronstk at ...124...
Sun Aug 19 23:44:45 CEST 2007
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
More information about the Devel
mailing list