Mysql TdbString?

BlitzMax Forums/Brucey's Modules/Mysql TdbString?

Retimer(Posted 2008) [#1]
Hey brucey, i'm not sure if this is a problem with tdbstring, or just how sql deals with char(0)'s.

If I insert: concat(char(5),char(0),char(8),char(6),char(0))

into a text field, and try to retrieve it, the tdbstring value returns: 5 8 6 rather than: 5 0 8 6 0.

I have checked the length of the field and it does contain the 0 byte values, just isn't returning them though. I need to achieve this in order to write a range of streams into a mysql field. For now i'm just inserting each asc value, along with a splitter...but that could really slow things down in a more lively environment.

Is this a possible glitch or am I sql-retarded and missing something obvious here? I just don't understand how the field is holding the 0-characters, but not returning them.

Thanks


Brucey(Posted 2008) [#2]
Line 1288 of database.bmx (in bah.database) might be the reason :
		If c = 0 Continue

If the ascii value of the character is zero, it skips it.

I'm guessing that was done so that when the end of a string was found (usually ascii 0) before the end of the length of the data retrieved for the string, it would just skip on til it got to the end.

You might like to comment it out, and see how you get on with general usage without it - although you may find your "normal" strings have issues.

Either way, please let me know how you get on :-)


Retimer(Posted 2008) [#3]
Hah. Worked perfect, and no issues as of yet for reading my other text-based fields. Much appreciated.

Blitzmax wouldn't be nearly as useful to me without your mods. Thanks mate.