MySQL Driver -- perform random queries?

Anthony K. squeak-dev at squeak.spes.ca
Thu May 5 01:10:00 UTC 2005


Hi all.

I'm trying to do queries from a Squeak application (Image 3.7 #5989)
against a MySQL database (v4.0.24; InnoDB tables), using the MySQL
driver (v1.12 from SqueakMap).

Normal queries work fine, for a couple of examples:
statement executeQuery: 
	'INSERT INTO person (fName, lName)
   	VALUES (''Bob'', 'Marley''), (''Bruce'', ''Springsteen''), (''Jennifer'', ''Lopez'')'.
resultSet := statement executeQuery: 
	'SELECT * FROM website'.

However, I would also like to to transactions. I thought it would work
to do something like bracketing a series of queries with:
statement executeQuery: 'BEGIN'.
<--various other queries-->
statement executeQuery: 'COMMIT'.

Unfortunately, this does not work. I get the message:
Error: Invalid Query: BEGIN

AFAICSee, my query is parsed, and when the word 'COMMIT' does not appear
in the Dictionary initialized from JdmStatement:mysqlQueries, then an
error is thrown. So I just added lines for "BEGIN", "COMMIT" and
"ROLLBACK" to that array. 

No-go. There is a further problem that  aQuery, when validated by
queryInfoFor:, returns [nil], which causes another error.

Any ideas on how to simply allow an arbitrary query to be sent to the
MySQL database, and the results returned to the Squeak application??

Thanks for any ideas,

Anthony





More information about the Squeak-dev mailing list