@@ -46,6 +46,10 @@ suite('data binding and mapping', () => {
4646 stmt . run ( 4 , 99n , 0xf , '' , new Uint8Array ( ) ) ,
4747 { changes : 1 , lastInsertRowid : 4 } ,
4848 ) ;
49+ t . assert . deepStrictEqual (
50+ stmt . run ( 5 , undefined , undefined , undefined , undefined ) ,
51+ { changes : 1 , lastInsertRowid : 5 } ,
52+ ) ;
4953
5054 const query = db . prepare ( 'SELECT * FROM types WHERE key = ?' ) ;
5155 t . assert . deepStrictEqual ( query . get ( 1 ) , {
@@ -80,6 +84,21 @@ suite('data binding and mapping', () => {
8084 text : '' ,
8185 buf : new Uint8Array ( ) ,
8286 } ) ;
87+ t . assert . deepStrictEqual ( query . get ( 5 ) , {
88+ __proto__ : null ,
89+ key : 5 ,
90+ int : null ,
91+ double : null ,
92+ text : null ,
93+ buf : null ,
94+ } ) ;
95+
96+ const insertNamedParams = db . prepare ( 'INSERT INTO types (key, int, double, text, buf) VALUES ($key, $int, $double, $text, $buf)' ) ;
97+ const params = { key : 6 , int : undefined , double : undefined , text : undefined , buf : undefined } ;
98+ t . assert . deepStrictEqual ( insertNamedParams . run ( params ) , { changes : 1 , lastInsertRowid : 6 } ) ;
99+ t . assert . deepStrictEqual ( insertNamedParams . run ( { key : 7 } ) , { changes : 1 , lastInsertRowid : 7 } ) ;
100+ t . assert . deepStrictEqual ( query . get ( 6 ) , { __proto__ : null , key : 6 , int : null , double : null , text : null , buf : null } ) ;
101+ t . assert . deepStrictEqual ( query . get ( 7 ) , { __proto__ : null , key : 7 , int : null , double : null , text : null , buf : null } ) ;
83102 } ) ;
84103
85104 test ( 'large strings are bound correctly' , ( t ) => {
@@ -126,7 +145,6 @@ suite('data binding and mapping', () => {
126145 t . assert . strictEqual ( setup , undefined ) ;
127146
128147 [
129- undefined ,
130148 ( ) => { } ,
131149 Symbol ( ) ,
132150 / f o o / ,
0 commit comments