ruby.mysql library commit and rollback
Posted by:
Oswaldo Zavala ()
Date: April 11, 2009 07:51PM
I'm tryng to find out how to use commit and rollback. Looking at the API it seems that autocommit(mode), commit() and rollback() are methods for the Mysql object.
Using these methods, like in the folowing example:
.........
begin
@conx = Mysql.real_connect(@host,@user,@pwd,@db)
result = @conx.autocommit(0)
or just
@conx.autocommit(1)
rescue ....
I obtained an error message: "undefined method for Mysql:Class (NoMethodError)" the same with these other example
.........
begin
res = @conx.query("INSERT INTO participants (cod_tipe_party,RUC,coments)
VALUES(\'#{@tipe}\',\'#{@ruc}\', \'#{@coment}\')")
result = @conx.commit
or
@conx.commit
or
@conx.commit(rs)
rescue Mysql::Error => e
.......
There is always the same error message
I have tryed many sintaxis forms, like using them, with and without parentheses, using the methods over the resulset, and either using the resultset as a parameter, without results.
The database engine that I'm using is InnoDB over Mysql version 5.0.67-community-nt
Please give me a clue where the problem is. Thanks
Edited 4 time(s). Last edit at 04/13/2009 08:21AM by Oswaldo Zavala.
|
ruby.mysql library commit and rollback |
Oswaldo Zavala |
04/11/2009 07:51PM |
Sorry, you can't reply to this topic. It has been closed.
© 1995-2008 MySQL AB, 2008- Sun Microsystems, Inc.