File tree Expand file tree Collapse file tree 2 files changed +9
-11
lines changed
Expand file tree Collapse file tree 2 files changed +9
-11
lines changed Original file line number Diff line number Diff line change @@ -103,15 +103,13 @@ class MysqlData {
103103 }
104104
105105 put ( data ) {
106- var keys = [ ]
107- var values = [ ]
108- Object . keys ( data ) . forEach ( key => {
109- keys . push ( key )
110- values . push ( data [ key ] )
111- } )
112-
113106 return this . _connection ( ) . then ( conn => {
114- return conn . queryAsync ( this . INSERT_RECORD_SQL , values ) . then ( ( ) => {
107+ return conn . queryAsync ( this . INSERT_RECORD_SQL , [
108+ data . id || null ,
109+ data . name || null ,
110+ data . size || null ,
111+ data . mimeType || null
112+ ] ) . then ( ( ) => {
115113 conn . end ( )
116114 } )
117115 } )
Original file line number Diff line number Diff line change @@ -9,8 +9,8 @@ describe('MysqlData', function(){
99 var record = {
1010 id : TEST_KEY ,
1111 name : 'cats.png' ,
12- size : 4444 ,
13- mimeType : 'image/png'
12+ mimeType : 'image/png' ,
13+ size : 4444
1414 }
1515
1616 var db = makeDb ( )
@@ -44,7 +44,7 @@ describe('MysqlData', function(){
4444 it ( 'should getAll() successfully' , ( ) => {
4545 return plugin . getAll ( ) . then ( fetched => {
4646 assert ( Array . isArray ( fetched ) , 'Returned data is not in array form' )
47- assert ( typeof fetched [ 0 ] !== 'object' , 'Returned records are objects ' )
47+ assert . equal ( typeof fetched [ 0 ] , 'object ' )
4848 } )
4949 } )
5050
You can’t perform that action at this time.
0 commit comments