MySQL Driver
Daniel Salama
dsalama at user.net
Tue Apr 12 11:23:45 UTC 2005
Alan,
I find it very strange as well. The update statement executes just fine
in the mysql client. Also, I was able to execute it just fine using
Ruby and the Ruby mySQL driver. As I said before, I can insert, delete,
and delete from Squeak with no problems, whatsoever, but the update
always returns this error.
The table definition is:
DROP TABLE IF EXISTS `tests`;
CREATE TABLE `tests` (
`id` int(11) NOT NULL auto_increment,
`sequence` varchar(50) default NULL,
`next` int(11) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
I'm running this on Squeak 3.7-5989-full, using Mysql Driver v1.12 on
Mac OSX and MySQL v4.1.5-gamma-standard.
I sincerely apologize for my previous post, but apparently the code I
posted before (which was a snippet of the actual code) does work. The
exact code that I was trying to execute (which does generate the
exception mentioned) is:
time:= Time millisecondsToRun:
[Transcript cr..
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.
resultSet := connection createStatement executeQuery: 'insert into
tests values (null, ''CustomerNo'', 0)'.
0 to: 999 do:
[:i|
(i \\ 100) = 0 ifTrue: [Transcript show: '.'].
resultSet := connection createStatement executeQuery: 'select next
from tests where sequence = ''CustomerNo'''.
resultSet next.
nextCustomerNo := (resultSet valueNamed: 'next') + 1.
updateSQL := 'update tests set next = ', (nextCustomerNo asString), '
where id = 1'.
connection createStatement executeQuery: updateSQL].
connection close].
Transcript cr; show: (time/1000) asFloat; show: ' seconds'.
Maybe it's just the way I'm using the driver or my programming "logic".
Thanks,
Daniel Salama
On Apr 12, 2005, at 1:34 AM, 4d8nfbcdu5 at reider.net wrote:
> Daniel,
>
> I maintain the driver. I don't know of any problems with updates. I
> have seen
> "subscript is out of bounds:1" when the server gets really overloaded,
> but
> not subscript 2.
>
> Here are some questions that come to mind.
>
> -did it ever work?
> -do updates to other tables work?
> -do updates to this table work if you exclude the field named 'next'?
> - what version of mysql server, what platform?
> - what happens if you try the same update from the mysql client
> instead of
> squeak?
>
> If you'd care to send me the table definition (eg mysqldump would be
> one way),
> I can take a look.
>
> -Alan
>
> On Sunday 10 April 2005 19:13, Daniel Salama wrote:
>> In addition, I am able to insert, delete, and select using the exact
>> same code with no problems. I just can't update. Any clues?
>>
>> Thanks,
>> Daniel
>>
>> On Apr 10, 2005, at 12:52 PM, Daniel Salama 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.
>>>
>>> Any ideas anyone?
>>>
>>> Thanks,
>>> Daniel
More information about the Squeak-dev
mailing list
|