@@ -34,6 +34,21 @@ jSQL.load(function () {
3434 expect ( ! ! jSQL . tables . keytest3 ) . to . be . true ;
3535 } ) ;
3636
37+ it ( 'insert into keytest3 table' , function ( ) {
38+ jSQL . query ( "insert ignore into keytest3 (name, num1, num2) values (?, ?, ?)" ) . execute ( [ 'bob' , 3 , 5 ] ) ;
39+ expect ( jSQL . tables . keytest3 . data . length === 1 ) . to . be . true ;
40+ } ) ;
41+
42+ it ( 'insert into keytest3 table' , function ( ) {
43+ jSQL . query ( "insert ignore into keytest3 (name, num1, num2) values (?, ?, ?)" ) . execute ( [ 'bill' , 3 , 5 ] ) ;
44+ expect ( jSQL . tables . keytest3 . data . length === 1 ) . to . be . true ;
45+ } ) ;
46+
47+ it ( 'insert into keytest3 table' , function ( ) {
48+ jSQL . query ( "insert ignore into keytest3 (name, num1, num2) values (?, ?, ?)" ) . execute ( [ 'bill' , 3 , 7 ] ) ;
49+ expect ( jSQL . tables . keytest3 . data . length === 2 ) . to . be . true ;
50+ } ) ;
51+
3752 it ( 'create smalltest table' , function ( ) {
3853 jSQL . query ( "create table `smalltest` (id int, str varchar)" ) . execute ( ) ;
3954 expect ( ( ! ! jSQL . tables . smalltest ) ) . to . be . true ;
@@ -150,12 +165,14 @@ jSQL.load(function () {
150165 } ) ;
151166
152167 it ( "should create a table with a bunch of numbers" , function ( ) {
153- jSQL . query ( `CREATE TABLE IF NOT EXISTS nmbrs (
168+ var sql = jSQL . minify ( `CREATE TABLE IF NOT EXISTS nmbrs (
154169 numba1 tinyint(3),
155170 numba2 smallint(3),
156171 numba3 mediumint(3),
157172 numba4 bigint(3)
158- )` ) . execute ( ) ;
173+ )` ) ;
174+
175+ jSQL . query ( sql ) . execute ( ) ;
159176 expect ( ( jSQL . tables . nmbrs !== undefined ) ) . to . be . true ;
160177 } ) ;
161178
@@ -169,5 +186,21 @@ jSQL.load(function () {
169186 expect ( ( r [ 0 ] === 3 ) ) . to . be . true ;
170187 } ) ;
171188
189+
190+ it ( "should create a table with a function" , function ( ) {
191+ jSQL . query ( `CREATE TABLE IF NOT EXISTS fff (fff)` ) . execute ( ) ;
192+ expect ( ( jSQL . tables . fff !== undefined ) ) . to . be . true ;
193+ } ) ;
194+
195+ it ( "should insert into a table with a function" , function ( ) {
196+ jSQL . query ( `insert into fff values (?)` ) . execute ( [ function ( ) { return "poop" } ] ) ;
197+ expect ( ( jSQL . tables . fff !== undefined ) ) . to . be . true ;
198+ } ) ;
199+
200+ it ( "should select from a table with a function" , function ( ) {
201+ var r = jSQL . query ( `select * from fff` ) . execute ( ) . fetch ( "ARRAY" ) ;
202+ expect ( ( r [ 0 ] ( ) === "poop" ) ) . to . be . true ;
203+ } ) ;
204+
172205 } ) ;
173206} ) ;
0 commit comments