File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed
packages/cubejs-mysql-driver Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -143,9 +143,9 @@ class MySqlDriver extends BaseDriver {
143143 const tableName = crypto . randomBytes ( 10 ) . toString ( 'hex' ) ;
144144 const columns = await this . withConnection ( async db => {
145145 await this . setTimeZone ( db ) ;
146- await db . execute ( `CREATE TEMPORARY TABLE ${ this . config . database } .t_${ tableName } AS ${ query } LIMIT 0` , values ) ;
147- const result = await db . execute ( `DESCRIBE ${ this . config . database } .t_${ tableName } ` ) ;
148- await db . execute ( `DROP TEMPORARY TABLE ${ this . config . database } .t_${ tableName } ` ) ;
146+ await db . execute ( `CREATE TEMPORARY TABLE \` ${ this . config . database } \` .t_${ tableName } AS ${ query } LIMIT 0` , values ) ;
147+ const result = await db . execute ( `DESCRIBE \` ${ this . config . database } \` .t_${ tableName } ` ) ;
148+ await db . execute ( `DROP TEMPORARY TABLE \` ${ this . config . database } \` .t_${ tableName } ` ) ;
149149 return result ;
150150 } ) ;
151151
Original file line number Diff line number Diff line change @@ -20,7 +20,8 @@ describe('MySqlDriver', () => {
2020 host : 'localhost' ,
2121 user : 'root' ,
2222 password : process . env . TEST_DB_PASSWORD || "Test1test" ,
23- port : container && container . getMappedPort ( 3306 ) || 3306
23+ port : container && container . getMappedPort ( 3306 ) || 3306 ,
24+ database : 'mysql'
2425 } ) ;
2526 await mySqlDriver . createSchemaIfNotExists ( 'test' ) ;
2627 await mySqlDriver . query ( 'DROP SCHEMA test' ) ;
@@ -40,6 +41,8 @@ describe('MySqlDriver', () => {
4041 } ) ;
4142 expect ( JSON . parse ( JSON . stringify ( await mySqlDriver . query ( 'select * from test.wrong_value' ) ) ) )
4243 . toStrictEqual ( [ { value : "Tekirdağ" } ] ) ;
44+ expect ( JSON . parse ( JSON . stringify ( ( await mySqlDriver . downloadQueryResults ( 'select * from test.wrong_value' ) ) . rows ) ) )
45+ . toStrictEqual ( [ { value : "Tekirdağ" } ] ) ;
4346 } ) ;
4447
4548 test ( 'boolean field' , async ( ) => {
You can’t perform that action at this time.
0 commit comments