I guess I wasn't clear (either that, or I am not understanding what
you are doing). Let's try again (and, it doesn't matter that you are
using sqlite3_bind; I am just talking workflow here).

You have the following row --

Doe                   John                     100 Nowhere Ave.          45

You modify it thusly --

UPDATE Person
SET LastName=?, FirstName=?, Address=?, Age=?
WHERE LastName='Doe' AND
 FirstName='John' AND
 Address='100 Nowhere Ave.' AND
 Age=45;

via sqlite3_bind (which, I have no idea how it works, but I am
assuming it works the same way as bind vars in Perl) to something like
sqlite3_bind('Doe','Jane','100 Nowhere Ave.',45)

The above row becomes --

Doe                   Jane                     100 Nowhere Ave.          45

Now you run

sqlite3_bind('Doe','Jack','100 Nowhere Ave.',45)

but it fails because the embedded WHERE clause is no longer catching
the row. It is still looking for

WHERE LastName='Doe' AND
 FirstName='John' AND
 Address='100 Nowhere Ave.' AND
 Age=45;

instead of

WHERE LastName='Doe' AND
 FirstName='Jane' AND
 Address='100 Nowhere Ave.' AND
 Age=45;

On 2/16/07, Jim Crafton <[EMAIL PROTECTED]> wrote:
> well, the first time you update the row (and, you haven't said what
> values you update it with), it succeeds because your WHERE clause
> successfully matches.

I'm using the sqlite3_bind functions to modify the values.


>
> Second time, the WHERE clause doesn't match because you have changed
> the values. For example, if the first time you went and changed the
> value of FirstName to 'Jane', the second time around your WHERE clause
> won't match.

I'm keeping this in mind. I'm retaining the old value prior to the
change, what SELECT returns back to me.

>
> You might find thins a lot easier if you set a primary key in the
> table, and use that to match the rows.
Agreed, but I'm trying to make this work for the general case, where I
can't assume anything about the design/layout of the tables.

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------




--
Puneet Kishor http://punkish.eidesis.org/
Nelson Inst. for Env. Studies, UW-Madison http://www.nelson.wisc.edu/
Open Source Geospatial Foundation http://www.osgeo.org/education/
---------------------------------------------------------------------
collaborate, communicate, compete
=====================================================================

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to