1. EUSQL UPDATE Query (I can't figure out why this isn't working)
- Posted by robby1066 <robby1066 at hotmail.com> Aug 02, 2004
- 576 views
Hi there, I'm working on a win32lib application that uses an EUSQL database. It seems like everything is working correcly until I run an update query to change an already existing record. After trying to narrow down the problem (I'm not getting an error message, just a silent failure), I determined that I can use and update query on a single field, but not on multiple fields for the row selected in the where clause. Basically for a table called DOCBANK that has the following structure: KEY as Autonumber TITLE as Text DESC as Text I can get these statements to work: run_sql("UPDATE DOCBANK SET DOCBANK.TITLE = 'NEW TITLE' WHERE (KEY = 16)") and run_sql("UPDATE DOCBANK SET DOCBANK.DESC = 'UPDATED DESCRIPTION' WHERE (KEY = 16)") But this won't work: run_sql("UPDATE DOCBANK SET DOCBANK.TITLE = 'NEW TITLE', DOCBANK.DESC = 'UPDATED DESCRIPTION' WHERE (KEY = 16)") Again, no error message, just the first field updates, and not the second. I've used SQL before in some php apps, and I'm PRETTY sure that my sql is correct, but I could be wrong. I just wanted to make sure there wasn't something I had missed in the documentation about EUSQL.
2. Re: EUSQL UPDATE Query (I can't figure out why this isn't working)
- Posted by Matt Lewis <matthewwalkerlewis at yahoo.com> Aug 03, 2004
- 538 views
robby1066 wrote: > > > Hi there, I'm working on a win32lib application that uses an EUSQL database. > It seems > like everything is working correcly until I run an update query to change an > already > existing record. > > After trying to narrow down the problem (I'm not getting an error message, > just a silent > failure), I determined that I can use and update query on a single field, but > not on > multiple fields for the row selected in the where clause. > > Basically for a table called DOCBANK that has the following structure: > > KEY as Autonumber > TITLE as Text > DESC as Text > > I can get these statements to work: > run_sql("UPDATE DOCBANK SET DOCBANK.TITLE = 'NEW TITLE' WHERE (KEY = 16)") > and > run_sql("UPDATE DOCBANK SET DOCBANK.DESC = 'UPDATED DESCRIPTION' WHERE (KEY = > 16)") > > But this won't work: > run_sql("UPDATE DOCBANK SET DOCBANK.TITLE = 'NEW TITLE', DOCBANK.DESC = > 'UPDATED DESCRIPTION' > WHERE (KEY = 16)") > > Again, no error message, just the first field updates, and not the second. > I've used SQL before in some php apps, and I'm PRETTY sure that my sql is > correct, > but I could be wrong. I just wanted to make sure there wasn't something I had > missed > in the documentation about EUSQL. Yes, this is a bug. Thanks for finding it. I've just posted an update to the Recent User Contributions page, so it should be up there soon. Alternatively, I also updated my page: http://www14.brinkster.com/matthewlewis/projects.html Matt Lewis
3. Re: EUSQL UPDATE Query (I can't figure out why this isn't working)
- Posted by robby1066 <robby1066 at hotmail.com> Aug 03, 2004
- 546 views
Wow, thank you SO MUCH for fixing this so quickly... thats really awesome, I just did a couple of quick tests with the update and it seems to be working great. If I could trouble you for one more piece of info... while I was trying to find a workaround for this, I started playing with the update_record and update_record2 functions, but couldn't make them work. I'm pretty sure I was doing something wrong, I kept getting an error that the Key value I was passing was trying to be subscripted (I was passing an integer, as my key column is set to AUTONUMBER). I realize in the documentation it says that key is an object, but I couldn't find any reference to what that object was supposed to contain. Is there an example program somewhere that uses those functions that i could take a look at? I checked the forums and user contrib lists, but didn't see anything. It's not crucial, now that I can use the SQL update query, that's going to solve my immediate problem. Again, many thanks >>Yes, this is a bug. Thanks for finding it. I've just posted an update >to the Recent User Contributions page, so it should be up there soon. >>Alternatively, I also updated my page: >>http://www14.brinkster.com/matthewlewis/projects.html >>Matt Lewis
4. Re: EUSQL UPDATE Query (I can't figure out why this isn't working)
- Posted by Matt Lewis <matthewwalkerlewis at yahoo.com> Aug 03, 2004
- 551 views
robby1066 wrote: > > > Wow, thank you SO MUCH for fixing this so quickly... thats really awesome, I > just did > a couple of quick tests with the update and it seems to be working great. > > If I could trouble you for one more piece of info... while I was trying to > find a workaround > for this, I started playing with the update_record and update_record2 > functions, but > couldn't make them work. I'm pretty sure I was doing something wrong, I kept > getting > an error that the Key value I was passing was trying to be subscripted (I was > passing > an integer, as my key column is set to AUTONUMBER). > > I realize in the documentation it says that key is an object, but I couldn't > find any > reference to what that object was supposed to contain. Is there an example > program > somewhere that uses those functions that i could take a look at? I checked the > forums > and user contrib lists, but didn't see anything. > > It's not crucial, now that I can use the SQL update query, that's going to > solve my > immediate problem. Could you post the code that's causing the problem? The key could be either an atom or a sequence, which means a euphoria object, so passing an integer for the key should work. Matt Lewis