This commit is contained in:
Jan Prochazka 2020-06-11 10:23:37 +02:00
parent dc7c44b797
commit a86f7e96ca
4 changed files with 6 additions and 5 deletions

View File

@ -8,7 +8,7 @@ async function queryReader({ connection, sql }) {
const driver = engines(connection);
const pool = await driverConnect(driver, connection);
console.log(`Connected.`);
return await driver.readableStream(pool, sql);
return await driver.readQuery(pool, sql);
}
module.exports = queryReader;

View File

@ -154,7 +154,7 @@ const driver = {
return request;
},
async readableStream(pool, sql) {
async readQuery(pool, sql) {
const request = await pool.request();
const { stream } = pool._nativeModules;

View File

@ -84,7 +84,7 @@ const driver = {
return query;
},
async readableStream(connection, sql) {
async readQuery(connection, sql) {
const query = connection.query(sql);
const { stream } = connection._nativeModules;

View File

@ -1,4 +1,4 @@
import stream from 'stream'
import stream from 'stream';
import { QueryResult } from './query';
import { SqlDialect } from './dialect';
import { SqlDumper } from './dumper';
@ -17,7 +17,8 @@ export interface EngineDriver {
connect(nativeModules, { server, port, user, password, database }): any;
query(pool: any, sql: string): Promise<QueryResult>;
stream(pool: any, sql: string, options: StreamOptions);
readableStream(pool: any, sql: string): Promise<stream.Readable>;
readQuery(pool: any, sql: string): Promise<stream.Readable>;
writeTable(pool: any, { schemaName, pureName }): Promise<stream.Writeable>;
getVersion(pool: any): Promise<{ version: string }>;
listDatabases(
pool: any