MySQL Driver
Boris Gaertner
Boris.Gaertner at gmx.net
Tue Apr 12 06:33:37 UTC 2005
"Daniel Salama" <dsalama at user.net> wrote:
> I'm trying to execute an UPDATE SQL statement and every time I run it,
> I get an exception. Is there a specific way of doing this?
>
> Socket initializeNetwork.
> spec := (JdmConnectionSpec new initialize
> user: 'master'; password: 'secret';
> host: (NetNameResolver addressForName: 'localhost');
> database: 'dcm'; port: 3306).
> connection := JdmConnection on: spec.
> statement := connection createStatement.
> nextCustomerNo := 1.
> updateSQL := 'update tests set next = ', (nextCustomerNo asString), '
> where sequence = ''CustomerNo'''.
> statement executeQuery: updateSQL.
>
> This generates: "Error: subscript is out of bounds: 2" exception.
Strange, really,
> Any ideas anyone?
There is an example database for mySQL, the world database, that
you find on the mySQL page.
With this database, I was able to successfully evaluate this
update statement:
Socket initializeNetwork.
spec := (JdmConnectionSpec new initialize
user: 'root'; password: '';
host: (NetNameResolver addressForName: 'localhost');
database: 'world';
port: 3306).
connection := JdmConnection on: spec.
statement := connection createStatement.
nextCustomerNo := 1.
updateSQL := 'update city
set Name = ''Shumen''
where id = 548 '.
(statement executeQuery: updateSQL)
I think that your problem has more to do with SQL than
with the driver. The DECLARE TABLE statement would
help.
> Thanks,
> Daniel
>
Greetings, Boris
More information about the Squeak-dev
mailing list
|