File tree Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -253,6 +253,22 @@ export default class ClickHouseDriver
253253 return [ ] ;
254254 }
255255
256+ public async getInsertQuery ( params : {
257+ item : NSDatabase . ITable ;
258+ columns : Array < NSDatabase . IColumn > ;
259+ } ) {
260+ const { item, columns } = params ;
261+ let insertQuery = `INSERT INTO ${ item . database } .\`${ item . label } \` (${ columns
262+ . map ( ( col ) => col . label )
263+ . join ( ", " ) } ) VALUES (`;
264+ columns . forEach ( ( col , index ) => {
265+ insertQuery = insertQuery . concat (
266+ `'\${${ index + 1 } :${ col . label } :${ col . dataType } }', `
267+ ) ;
268+ } ) ;
269+ return insertQuery ;
270+ }
271+
256272 /**
257273 * This method is a helper for intellisense and quick picks.
258274 */
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { IBaseQueries, ContextValue } from "@sqltools/types";
22import queryFactory from "@sqltools/base-driver/dist/lib/factory" ;
33
44const describeTable : IBaseQueries [ "describeTable" ] = queryFactory `
5- DESCRIBE TABLE ${ ( p ) => p . database } .${ ( p ) => p . label }
5+ DESCRIBE TABLE ${ ( p ) => p . database } .\` ${ ( p ) => p . label } \`
66` ;
77
88const fetchColumns : IBaseQueries [ "fetchColumns" ] = queryFactory `
@@ -18,14 +18,14 @@ ORDER BY c.position ASC
1818
1919const fetchRecords : IBaseQueries [ "fetchRecords" ] = queryFactory `
2020SELECT *
21- FROM ${ ( p ) => p . table . database } .${ ( p ) => p . table . label || p . table }
21+ FROM ${ ( p ) => p . table . database } .\` ${ ( p ) => p . table . label || p . table } \`
2222LIMIT ${ ( p ) => p . limit || 50 }
2323OFFSET ${ ( p ) => p . offset || 0 }
2424` ;
2525
2626const countRecords : IBaseQueries [ "countRecords" ] = queryFactory `
2727SELECT count(1) AS total
28- FROM ${ ( p ) => p . table . database } .${ ( p ) => p . table . label || p . table }
28+ FROM ${ ( p ) => p . table . database } .\` ${ ( p ) => p . table . label || p . table } \`
2929` ;
3030
3131const fetchDatabases : IBaseQueries [ "fetchDatabases" ] = queryFactory `
You can’t perform that action at this time.
0 commit comments