Browse Source

chore: set sqlite charset/encoding to utf8

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/4284/head
Pranav C 2 years ago
parent
commit
ff89e95369
  1. 18
      packages/nocodb/src/lib/db/sql-client/lib/sqlite/SqliteClient.ts

18
packages/nocodb/src/lib/db/sql-client/lib/sqlite/SqliteClient.ts

@ -7,11 +7,13 @@ import Result from '../../../util/Result';
import queries from './sqlite.queries';
import lodash from 'lodash';
import _ from 'lodash';
const log = new Debug('SqliteClient');
class SqliteClient extends KnexClient {
private queries: any;
private _version: any;
constructor(connectionConfig) {
super(connectionConfig);
this.sqlClient = knex(connectionConfig.connection);
@ -130,10 +132,14 @@ class SqliteClient extends KnexClient {
const fd = await promisify(fs.open)(args.database, 'w');
const close = await promisify(fs.close)(fd);
log.debug('sqlite file is created', fd, close);
// create new knex client
this.sqlClient = knex(this.connectionConfig.connection);
// set encoding to utf8
await this.sqlClient.raw('PRAGMA encoding = "UTF-8"');
} else {
// create new knex client
this.sqlClient = knex(this.connectionConfig.connection);
}
// create new knex client
this.sqlClient = knex(this.connectionConfig.connection);
} catch (e) {
log.ppe(e, _func);
throw e;
@ -277,7 +283,7 @@ class SqliteClient extends KnexClient {
* @property {String} - tables[].tn
*/
async tableList(args: any = {}) {
const _func = this.createDatabaseIfNotExists.name;
const _func = this.tableList.name;
const result = new Result();
log.api(`${_func}:args:`, args);
@ -305,7 +311,7 @@ class SqliteClient extends KnexClient {
}
async schemaList(args: any = {}) {
const _func = this.createDatabaseIfNotExists.name;
const _func = this.schemaList.name;
const result = new Result();
log.api(`${_func}:args:`, args);
@ -994,7 +1000,7 @@ class SqliteClient extends KnexClient {
}
async functionDelete(args: any = {}) {
const _func = this.createDatabaseIfNotExists.name;
const _func = this.functionDelete.name;
// const result = new Result();
log.api(`${_func}:args:`, args);

Loading…
Cancel
Save