hi,
when i do an update statement and there is an error like "Update would generate non-unique row" even though the insert failed $loop still gets set to 1. i would expect $loop == affected rows. inserts seem to work fine ($loop=0)
here is a simple example which creates the table,index and sample data.
<A NAME=updateloop PUBLIC>
<sql "create table danstest(id counter,val varchar(5));"></sql>
<sql "create unique index idx_dantest on danstest(id,val)"></sql>
<$id=(counter)>
<sql "insert into danstest values($id,'dan');"></sql>
$loop<br>
<$id2=(counter)>
<sql "insert into danstest values($id2,'don');"></sql>
$loop<br>
<sql "insert into danstest values($id2,'mike');"></sql>
$loop<br>
<$loop=0> <!--clear loop here and insert duplicate on purpose-->
<sql "update danstest set val='don' where val='mike';"></sql>
$loop<br> <!-- this $loop is 1 -->
</A>
this is the output:
<!-- Texis RDBMS Copyright (c) 1992 - 2000 Thunderstone - EPI, Inc. -->
<!-- Texis Web Script Copyright (c) 1996 - 2000 Thunderstone - EPI, Inc. -->
1<br>
1<br>
1<br>
<!-- 178 /vtx/test:16: Update would generate non-unique row -->
1<br>
when i do an update statement and there is an error like "Update would generate non-unique row" even though the insert failed $loop still gets set to 1. i would expect $loop == affected rows. inserts seem to work fine ($loop=0)
here is a simple example which creates the table,index and sample data.
<A NAME=updateloop PUBLIC>
<sql "create table danstest(id counter,val varchar(5));"></sql>
<sql "create unique index idx_dantest on danstest(id,val)"></sql>
<$id=(counter)>
<sql "insert into danstest values($id,'dan');"></sql>
$loop<br>
<$id2=(counter)>
<sql "insert into danstest values($id2,'don');"></sql>
$loop<br>
<sql "insert into danstest values($id2,'mike');"></sql>
$loop<br>
<$loop=0> <!--clear loop here and insert duplicate on purpose-->
<sql "update danstest set val='don' where val='mike';"></sql>
$loop<br> <!-- this $loop is 1 -->
</A>
this is the output:
<!-- Texis RDBMS Copyright (c) 1992 - 2000 Thunderstone - EPI, Inc. -->
<!-- Texis Web Script Copyright (c) 1996 - 2000 Thunderstone - EPI, Inc. -->
1<br>
1<br>
1<br>
<!-- 178 /vtx/test:16: Update would generate non-unique row -->
1<br>