Re: Transactions with ODBC
Thank you for your response. I am using InnoDB (picked that out of the docs). Does that mean what I did should have worked? I should not have had 2 rows in that table after running the commands? Thanks again... >I would like to wrap my updates top MySQL in transactions. Use InnoDB tables. PB [EMAIL PROTECTED] wrote: > I apologize if you saw this on the MySQL Forums but I have not gotten a > response... Thanks for your help... > > I know this is probably a stupid question but I could use a nudge in the > right direction. > > I would like to wrap my updates top MySQL in transactions. I am using ODBC as > my means of communication (Visual FoxPro is the front end) and passing SQL > statements off to the server one Execute at a time. > > I understand how I could do this with a stored procedure, or possibly even > ADO, but I would prefer to send it one command at a time for various reasons. > > When I send the following series of commands through, though, it doesn't work > although each statement tells me that it executed properly: > > *-- Set the connection string > ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;" > + ; "DATABASE=test;" + ; "USER=test;"+; "PASSWORD=test;"+; "OPTION=3;" > > lnHandle = SQLSTRINGCONNECT(ConnectionString) &&Get the connection ? > lnHandle &&Check the connection to make sure it worked. > lcSQL = "START TRANSACTION" > ? SQLEXEC(lnHandle, lcSQL) > lcSQL = "BEGIN" > ? SQLEXEC(lnHandle, lcSQL) > lcSQL = "INSERT INTO n1 (n1) VALUES (1)" > ? SQLEXEC(lnHandle, lcSQL) > lcSQL = "INSERT INTO n1 (n1) VALUES (2)" > ? SQLEXEC(lnHandle, lcSQL) > lcSQL = "ROLLBACK" > ? SQLEXEC(lnHandle, lcSQL) > > Yet, when I query the table after this runs, there are still two records > despite the fact that I asked it to rollback the transaction and that all > commands reported as executing OK. > > I am sure I am missing something stupid but I cannot find a decent doc on > this (if you know of one, a reference would be appreciated). > > Thanks in advance for your help. > > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Transactions with ODBC
I apologize if you saw this on the MySQL Forums but I have not gotten a response... Thanks for your help... I know this is probably a stupid question but I could use a nudge in the right direction. I would like to wrap my updates top MySQL in transactions. I am using ODBC as my means of communication (Visual FoxPro is the front end) and passing SQL statements off to the server one Execute at a time. I understand how I could do this with a stored procedure, or possibly even ADO, but I would prefer to send it one command at a time for various reasons. When I send the following series of commands through, though, it doesn't work although each statement tells me that it executed properly: *-- Set the connection string ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;" + ; "DATABASE=test;" + ; "USER=test;"+; "PASSWORD=test;"+; "OPTION=3;" lnHandle = SQLSTRINGCONNECT(ConnectionString) &&Get the connection ? lnHandle &&Check the connection to make sure it worked. lcSQL = "START TRANSACTION" ? SQLEXEC(lnHandle, lcSQL) lcSQL = "BEGIN" ? SQLEXEC(lnHandle, lcSQL) lcSQL = "INSERT INTO n1 (n1) VALUES (1)" ? SQLEXEC(lnHandle, lcSQL) lcSQL = "INSERT INTO n1 (n1) VALUES (2)" ? SQLEXEC(lnHandle, lcSQL) lcSQL = "ROLLBACK" ? SQLEXEC(lnHandle, lcSQL) Yet, when I query the table after this runs, there are still two records despite the fact that I asked it to rollback the transaction and that all commands reported as executing OK. I am sure I am missing something stupid but I cannot find a decent doc on this (if you know of one, a reference would be appreciated). Thanks in advance for your help. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Please confirm your request to join ltsp-id
Hello [EMAIL PROTECTED], We have received your request to join the ltsp-id group hosted by Yahoo! Groups, a free, easy-to-use community service. This request will expire in 21 days. TO BECOME A MEMBER OF THE GROUP: 1) Go to the Yahoo! Groups site by clicking on this link: http://groups.yahoo.com/i?i=GFhFk5biYMiSFfoZXLaZ_0jzagQ&e=mysql%40lists%2Emysql%2Ecom (If clicking doesn't work, "Cut" and "Paste" the line above into your Web browser's address bar.) -OR- 2) REPLY to this email by clicking "Reply" and then "Send" in your email program If you did not request, or do not want, a membership in the ltsp-id group, please accept our apologies and ignore this message. Regards, Yahoo! Groups Customer Care Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php