System.Data.SQLite

Artifact [80ab60ffbe]
Login

Artifact 80ab60ffbe65ed021fbb5dd46d44e9000d9a4d17:

Attachment "tkt-db4515dc34.eagle" to ticket [db4515dc34] added by mistachkin 2015-03-04 19:39:06.
###############################################################################
#
# tkt-db4515dc34.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-db4515dc34-1.1 {PRIMARY KEY constraints with JOIN} -setup {
  setupDb [set fileName tkt-db4515dc34-1.1.db]
} -body {
  sql execute $db {
    CREATE TABLE t1(x INTEGER PRIMARY KEY, y INTEGER REFERENCES t1);
    INSERT INTO t1 (x, y) VALUES(1, NULL);
    INSERT INTO t1 (x, y) VALUES(2, 1);
    INSERT INTO t1 (x, y) VALUES(3, 1);
  }

  set sql {
    SELECT t1_2.x
    FROM t1 AS t1_1 LEFT JOIN t1 AS t1_2 ON t1_2.x = t1_1.y;
  }

  set dataReader [sql execute -execute reader -format datareader \
      -alias $db $sql]

  set dataTable [object create -alias System.Data.DataTable]

  $dataTable Load $dataReader
} -cleanup {
  unset -nocomplain dataTable dataReader

  cleanupDb $fileName

  unset -nocomplain dataReader sql db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue