[sqlite] why one row's results isn't the same between program and command shell

3 views
Skip to first unread message

Adam DeVita

unread,
Mar 21, 2012, 3:25:49 PM3/21/12
to General Discussion of SQLite Database
Good day,

I'm just exporting data to another db of known same structure, and setting
a flag. It seems that one row shows an incorrect result, but only so in my
c++ code.

I extracted the queries being run using my debugger, and tried them in the
command prompt.

When I run the following batch of queries.


Table is
CREATE TABLE WorkStations (WSIDtxt text primary key, LocationID integer,
record_updatetime text, write_out_ok int default 0);

Command Prompt results:
Tests prepared with:
update workstations set write_out_ok=0;

sqlite> select * from workstations;
WSIDtxt|LocationID|record_updatetime|write_out_ok
DT00-13-D3-50-AF-F9|2|2009.02.03.13.41|0
PROGRAMMER-LAB00-1E-90-31-8D-19|3||0
PROGRAMMER-LAB00-03-0D-00-00-01|3||0
ADAM-PC00-25-64-8C-5A-3B|3|2012.03.21.18.57.19|0


attach
'Z:\PINTS\modules\deltafiles\deltas\2012.03.21_ADAM-PC00-25-64-8C-5A-3B_r006.db'
as 'foo' ;

insert into foo.WorkStations select distinct * from main.WorkStations M
where M.write_out_ok =0 and M.wsidtxt is not null;

update WorkStations set write_out_ok =1 where wsidtxt in (select wsidtxt
from foo.WorkStations ) ;


sqlite> select * from foo.workstations;
ADAM-PC00-25-64-8C-5A-3B|3|2012.03.21.18.57.19|0
DT00-13-D3-50-AF-F9|2|2009.02.03.13.41|0
PROGRAMMER-LAB00-03-0D-00-00-01|3||0
PROGRAMMER-LAB00-1E-90-31-8D-19|3||0
sqlite> select * from workstations;
DT00-13-D3-50-AF-F9|2|2009.02.03.13.41|1
PROGRAMMER-LAB00-1E-90-31-8D-19|3||1
PROGRAMMER-LAB00-03-0D-00-00-01|3||1
ADAM-PC00-25-64-8C-5A-3B|3|2012.03.21.18.57.19|1


After executing a program that should have identical results, as identical
queries are run:
foo.workstations is identical.

sqlite> select * from workstations;
WSIDtxt|LocationID|record_updatetime|write_out_ok
DT00-13-D3-50-AF-F9|2|2009.02.03.13.41|1
PROGRAMMER-LAB00-1E-90-31-8D-19|3||1
PROGRAMMER-LAB00-03-0D-00-00-01|3||1
ADAM-PC00-25-64-8C-5A-3B|3|2012.03.21.18.57.19|0

(Windows 7 32 bit edition PC. Tried with new copy of amalgamation 3.7.11 as
well as 3.7.4)

Why is the last entry wrong? Any suggestions as to how to review?


regards,
Adam DeVita
VerifEye Technologies Inc.
_______________________________________________
sqlite-users mailing list
sqlite...@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Adam DeVita

unread,
Mar 21, 2012, 3:35:07 PM3/21/12
to General Discussion of SQLite Database
Sorry for false alarm. Please disregard this thread:

Solution: make sure you quit everything and isolate the code. There is a
subsequent write to the new record that made it appear as a problem, when
it wasn't.

Adam

--
VerifEye Technologies Inc.
905-948-0015x245
151 Whitehall Dr, Unit 2
Markham ON, L3R 9T1
Canada

Simon Slavin

unread,
Mar 21, 2012, 3:38:23 PM3/21/12
to General Discussion of SQLite Database

On 21 Mar 2012, at 7:35pm, Adam DeVita <ade...@verifeye.com> wrote:

> Sorry for false alarm. Please disregard this thread:
>
> Solution: make sure you quit everything and isolate the code. There is a
> subsequent write to the new record that made it appear as a problem, when
> it wasn't.

We've all done it. Glad you sorted it out.

Simon.

Don V Nielsen

unread,
Mar 21, 2012, 5:33:58 PM3/21/12
to General Discussion of SQLite Database
Doh!

Know the feeling. Well!

Reply all
Reply to author
Forward
0 new messages