[Gambas-user] PRB: MySQL and BLOBS

ron ronstk at ...239...
Fri Apr 9 18:02:39 CEST 2004


On Friday 09 April 2004 19:34, Fabian Schmieder wrote:
> Hi folks,
>
> I've got a problem with Blobs and MySQL on Gambas:
>
> I would like to store a HTML page of about 5kb in a MEDIUMTEXT field (a
> BLOB). When I try to insert the data using the Exec command like this
>
> db.Exec( "insert into dokument ( text ) values ('" & Parser.Body & "')")
>
> and the result of Parser.Body is bigger than 213 bytes Gambas is popping
> up an error window showing me the MySQL Error "Query failed: You have an
> error in your SQL Syntax ..."
>
> I've escaped the contents of Parser.Body as descibed in
> http://www.mysql.com/doc/en/String_syntax.html !
>
> I don't think that this is a MySQL or just a syntax error, because when
> I copy the result of PRINT "insert into dokument ( text ) values ( '" &
> Parser.Body & "' )" and paste it into my SQL gui and send the query
> manually, everything is working perfectly. Even with 5kb of text...
>
> Is anybody out there who can help?
>
> Thanks a lot,
> Fabian
>

Can you try to use the database, table and field stuff
instead of the db.Exec ?
That is an other way which can handle the insert
Take a look in the database manager code if you need 
some help how to use it.
I know it will be more than the one line you have now but
may be you get the hint where it goes wrong.

The only thing I see atm is Parser.Body, it can be that it must be a variant 
to be able to put in BLOB here.

Success
Ron.




More information about the User mailing list