First approach:

I have created database with below schema:

create table if not exists t1 ( i integer primary key autoincrement, t1info
text);
create table if not exists t2 (ii integer primary key, t2info text, foreign
key (ii) references t1 (i) );

I created two prepared statement for t1 and t2.
Updated the records (t1 and t2 table) by using bind and step apis in
trasaction.
Always binding t1info for t1 table and t2info for t2 table only. It's
working fine.
primary key is auto increment, so it's increasing and updating in t1 and t2
tables. It' working fine.

-----------------------------------------

Second approach:

Now, I need to change the schema this way:


create table if not exists t0 ( h integer primary key autoincrement, t0info
text);
create table if not exists t1 ( i integer primary key autoincrement, t1info
text, hh integer not null, unique(i, hh), foreign key (hh) references t0
(h) );
create table if not exists t2 (ii integer primary key, t2info text, foreign
key (ii) references t1 (i) );

I created three prepared statement for t0, t1 and t2.
Updated the records (t0, t1 and t2 table) by using bind and step apis in
trasaction.
Binding t0info for t0, t1info for t1 table and t2info for t2 table only.

But, sqlite3_step(stmtoft1); is failing always. What might be the wrong
with this approach.

realtions among tables are not proper with second approach? if yes, please
suggest.

Thanks in advance,
Durga.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to