Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

MySQL... Rows affected after an update

 [1/5] from: ric:getorbital at: 28-Aug-2001 23:15


Is there a way to determine the number of rows affected after updating a table in MySQL? e.g... db: open mysql://localhost/database conn: first db insert db {update table set column = 'new value' where column = 'old value'} I thought maybe the rows affected might be available from the port ('db) after inserting the update statement, but nothing (none) is there. Thanks for your help, -- Ric

 [2/5] from: g:santilli:tiscalinet:it at: 29-Aug-2001 19:14


Hello Ric! On 29-Ago-01, you wrote: RG> Is there a way to determine the number of rows affected after RG> updating a table in MySQL? RG> e.g... RG> db: open mysql://localhost/database conn: first db RG> insert db {update table set column = 'new value' where column RG> = 'old value'} Should be in db/locals IIRC. (Try PROBE DB/LOCALS.) Anyway, mysql-monitor.r uses it, so you can find it there. Regards, Gabriele. -- Gabriele Santilli <[giesse--writeme--com]> - Amigan - REBOL programmer Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/

 [3/5] from: ric:getorbital at: 29-Aug-2001 12:07


Thanks for the response, Gabriele! First, let me correct my example (it was way past my bed-time when I wrote it <g>)... db: open mysql://localhost/database comm: first db insert comm {update table set column = 'new value' where column = 'old value'} I am trying to find the number of rows affected (for concurrency purposes). I tried your suggestion, Gabriele, on both 'db/locals and 'comm/locals. I couldn't find anything that looked right in either place. Where can I find mysql-monitor.r? I looked for it in the script library and other places, but no luck. BTW, I looked at Maarten's solution, but I need something cross-platform. Thanks again, -- Ric

 [4/5] from: g:santilli:tiscalinet:it at: 30-Aug-2001 10:46


Hello Ric! On 29-Ago-01, you wrote: RG> db: open mysql://localhost/database RG> comm: first db RG> insert comm {update table set column = 'new value' where RG> column = 'old value'} Ah! So you're using /Command, it seems... RG> I tried your suggestion, Gabriele, on both 'db/locals and RG> 'comm/locals. I couldn't find anything that looked right in RG> either place. I'm sorry, I thought you were using Nenad's mysql-protocol.r... RG> Where can I find mysql-monitor.r? I looked for it in the RG> script library and other places, but no luck. RG> BTW, I looked at Maarten's solution, but I need something RG> cross-platform. Try to go to DocKimbel's reb site. You'll find a mysql:// protocol written entirely in REBOL. That is the one I'm using; but if you're using /Command, you probably don't need it... I think /Command should be able to give you the number of affected rows, too. (Dunno how, sorry. :( ) Regards, Gabriele. -- Gabriele Santilli <[giesse--writeme--com]> - Amigan - REBOL programmer Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/

 [5/5] from: ric::getorbital::com at: 30-Aug-2001 9:35


WOW! I had no idea there was a MySQL protocol available for /Core! I just downloaded it from DocKimbel's Rebsite and gave it a try. Although my test case is rather trivial, this version works at least as well as the /Command version, and it has better features and better documentation! It's just amazing what you can do with this language. Thanks for the lead, Gabrielle; and thanks to Nenad (DocKimbel) for the quality product! I'll take any further questions I have on it over to DocKimbel's mysql forum. -- Ric