@@ -29,6 +29,11 @@ jSQL.load(function () {
2929 expect ( ( jSQL . tables . keytest2 . keys . primary . column [ 0 ] === 'id' && jSQL . tables . keytest2 . keys . primary . column [ 1 ] === 'name' && jSQL . tables . keytest2 . auto_inc_col === 'id' ) ) . to . be . true ;
3030 } ) ;
3131
32+ it ( 'create keytest3 table' , function ( ) {
33+ jSQL . query ( "create table keytest3 (id int auto_increment, name, num1 int, num2 int, primary key(`id`, name), unique key(num1, num2) )" ) . execute ( ) ;
34+ expect ( ! ! jSQL . tables . keytest3 ) . to . be . true ;
35+ } ) ;
36+
3237 it ( 'create smalltest table' , function ( ) {
3338 jSQL . query ( "create table `smalltest` (id int, str varchar)" ) . execute ( ) ;
3439 expect ( ( ! ! jSQL . tables . smalltest ) ) . to . be . true ;
@@ -60,7 +65,7 @@ jSQL.load(function () {
6065 } ) ;
6166
6267 it ( 'select from typetest table' , function ( ) {
63- var res = jSQL . query ( "select * from `typetest`" ) . execute ( ) . fetchAll ( "ARRAY" ) ;
68+ var res = jSQL . query ( "select * from `typetest` limit 1 offset 0 " ) . execute ( ) . fetchAll ( "ARRAY" ) ;
6469 expect ( ( res [ 0 ] [ 7 ] instanceof Date && "function" === typeof res [ 0 ] [ 2 ] ) ) . to . be . true ;
6570 } ) ;
6671
@@ -94,6 +99,16 @@ jSQL.load(function () {
9499 expect ( ( q . fetch ( "ASSOC" ) . greet === "holla" ) ) . to . be . true ;
95100 } ) ;
96101
102+ it ( 'select from keytest2 table again once again' , function ( ) {
103+ var q = jSQL . query ( "SELECT * FROM `keytest2` order by id asc" ) . execute ( ) ;
104+ expect ( ( q . fetchAll ( "ASSOC" ) . length === 2 ) ) . to . be . true ;
105+ } ) ;
106+
107+ it ( 'select from keytest2 table again once again' , function ( ) {
108+ var q = jSQL . query ( "SELECT * FROM `keytest2` order by id, greet desc" ) . execute ( ) ;
109+ expect ( ( q . fetchAll ( "ASSOC" ) . length === 2 ) ) . to . be . true ;
110+ } ) ;
111+
97112 it ( 'select from keytest2 table again once again once' , function ( ) {
98113 var q = jSQL . query ( "SELECT * FROM `keytest2` WHERE `greet` LIKE '%o%'" ) . execute ( ) ;
99114 expect ( ( q . fetchAll ( "ASSOC" ) . length === 2 ) ) . to . be . true ;
@@ -134,5 +149,25 @@ jSQL.load(function () {
134149 expect ( ( jSQL . tables . keytest2 === undefined ) ) . to . be . true ;
135150 } ) ;
136151
152+ it ( "should create a table with a bunch of numbers" , function ( ) {
153+ jSQL . query ( `CREATE TABLE IF NOT EXISTS nmbrs (
154+ numba1 tinyint(3),
155+ numba2 smallint(3),
156+ numba3 mediumint(3),
157+ numba4 bigint(3)
158+ )` ) . execute ( ) ;
159+ expect ( ( jSQL . tables . nmbrs !== undefined ) ) . to . be . true ;
160+ } ) ;
161+
162+ it ( "should insert into a table with a bunch of numbers" , function ( ) {
163+ jSQL . query ( `insert into nmbrs values (?, ?, ?, ?)` ) . execute ( [ 3 , 3 , 3 , 3 ] ) ;
164+ expect ( ( jSQL . tables . nmbrs !== undefined ) ) . to . be . true ;
165+ } ) ;
166+
167+ it ( "should select from a table with a bunch of numbers" , function ( ) {
168+ var r = jSQL . query ( `select * from nmbrs` ) . execute ( ) . fetch ( "ARRAY" ) ;
169+ expect ( ( r [ 0 ] === 3 ) ) . to . be . true ;
170+ } ) ;
171+
137172 } ) ;
138173} ) ;
0 commit comments