mirror of
https://github.com/Fabio286/antares.git
synced 2025-06-05 21:59:22 +02:00
fix:
This commit is contained in:
@ -1,3 +1,5 @@
|
|||||||
|
import { TypesGroup } from 'common/interfaces/antares';
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
group: 'integer',
|
group: 'integer',
|
||||||
@ -306,4 +308,4 @@ export default [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
];
|
] as TypesGroup[];
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import { TypesGroup } from 'common/interfaces/antares';
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
group: 'integer',
|
group: 'integer',
|
||||||
@ -290,4 +292,4 @@ export default [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
];
|
] as TypesGroup[];
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import { TypesGroup } from 'common/interfaces/antares';
|
||||||
|
|
||||||
export default [
|
export default [
|
||||||
{
|
{
|
||||||
group: 'integer',
|
group: 'integer',
|
||||||
@ -134,4 +136,4 @@ export default [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
];
|
] as TypesGroup[];
|
||||||
|
@ -67,6 +67,11 @@ export interface TypeInformations {
|
|||||||
zerofill: boolean;
|
zerofill: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface TypesGroup {
|
||||||
|
group: string;
|
||||||
|
types: TypeInformations[];
|
||||||
|
}
|
||||||
|
|
||||||
// Tables
|
// Tables
|
||||||
export interface TableField {
|
export interface TableField {
|
||||||
name: string;
|
name: string;
|
||||||
|
@ -23,7 +23,7 @@ const lookup = {
|
|||||||
F: '1111'
|
F: '1111'
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
type HexChar = keyof typeof lookup
|
export type HexChar = keyof typeof lookup
|
||||||
|
|
||||||
export default function hexToBinary (hex: HexChar[]) {
|
export default function hexToBinary (hex: HexChar[]) {
|
||||||
let binary = '';
|
let binary = '';
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import * as antares from 'common/interfaces/antares';
|
import * as antares from 'common/interfaces/antares';
|
||||||
import fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import { ipcMain } from 'electron';
|
import { ipcMain } from 'electron';
|
||||||
import { ClientsFactory } from '../libs/ClientsFactory';
|
import { ClientsFactory } from '../libs/ClientsFactory';
|
||||||
import { SslOptions } from 'mysql2';
|
import { SslOptions } from 'mysql2';
|
||||||
|
@ -6,7 +6,7 @@ import moment from 'moment';
|
|||||||
import { sqlEscaper } from 'common/libs/sqlEscaper';
|
import { sqlEscaper } from 'common/libs/sqlEscaper';
|
||||||
import { TEXT, LONG_TEXT, ARRAY, TEXT_SEARCH, NUMBER, FLOAT, BLOB, BIT, DATE, DATETIME } from 'common/fieldTypes';
|
import { TEXT, LONG_TEXT, ARRAY, TEXT_SEARCH, NUMBER, FLOAT, BLOB, BIT, DATE, DATETIME } from 'common/fieldTypes';
|
||||||
import * as customizations from 'common/customizations';
|
import * as customizations from 'common/customizations';
|
||||||
import fs from 'fs';
|
import * as fs from 'fs';
|
||||||
|
|
||||||
export default (connections: {[key: string]: antares.Client}) => {
|
export default (connections: {[key: string]: antares.Client}) => {
|
||||||
ipcMain.handle('get-table-columns', async (event, params) => {
|
ipcMain.handle('get-table-columns', async (event, params) => {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import * as antares from 'common/interfaces/antares';
|
import * as antares from 'common/interfaces/antares';
|
||||||
import * as mysql from 'mysql2/promise';
|
import * as mysql from 'mysql2/promise';
|
||||||
import { AntaresCore } from '../AntaresCore';
|
import { AntaresCore } from '../AntaresCore';
|
||||||
import * as dataTypes from 'common/data-types/mysql';
|
import dataTypes from 'common/data-types/mysql';
|
||||||
import SSH2Promise from 'ssh2-promise';
|
import SSH2Promise = require('ssh2-promise');
|
||||||
import SSHConfig from 'ssh2-promise/lib/sshConfig';
|
import SSHConfig from 'ssh2-promise/lib/sshConfig';
|
||||||
|
|
||||||
export class MySQLClient extends AntaresCore {
|
export class MySQLClient extends AntaresCore {
|
||||||
|
@ -4,8 +4,8 @@ import { builtinsTypes } from 'pg-types';
|
|||||||
import * as pg from 'pg';
|
import * as pg from 'pg';
|
||||||
import * as pgAst from 'pgsql-ast-parser';
|
import * as pgAst from 'pgsql-ast-parser';
|
||||||
import { AntaresCore } from '../AntaresCore';
|
import { AntaresCore } from '../AntaresCore';
|
||||||
import * as dataTypes from 'common/data-types/postgresql';
|
import dataTypes from 'common/data-types/postgresql';
|
||||||
import SSH2Promise from 'ssh2-promise';
|
import SSH2Promise = require('ssh2-promise');
|
||||||
import SSHConfig from 'ssh2-promise/lib/sshConfig';
|
import SSHConfig from 'ssh2-promise/lib/sshConfig';
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import * as antares from 'common/interfaces/antares';
|
import * as antares from 'common/interfaces/antares';
|
||||||
import * as sqlite from 'better-sqlite3';
|
import * as sqlite from 'better-sqlite3';
|
||||||
import { AntaresCore } from '../AntaresCore';
|
import { AntaresCore } from '../AntaresCore';
|
||||||
import * as dataTypes from 'common/data-types/sqlite';
|
import dataTypes from 'common/data-types/sqlite';
|
||||||
import { NUMBER, FLOAT, TIME, DATETIME } from 'common/fieldTypes';
|
import { NUMBER, FLOAT, TIME, DATETIME } from 'common/fieldTypes';
|
||||||
|
|
||||||
export class SQLiteClient extends AntaresCore {
|
export class SQLiteClient extends AntaresCore {
|
||||||
|
@ -2,7 +2,7 @@ import * as exporter from 'common/interfaces/exporter';
|
|||||||
import * as mysql from 'mysql2/promise';
|
import * as mysql from 'mysql2/promise';
|
||||||
import { SqlExporter } from './SqlExporter';
|
import { SqlExporter } from './SqlExporter';
|
||||||
import { BLOB, BIT, DATE, DATETIME, FLOAT, SPATIAL, IS_MULTI_SPATIAL, NUMBER } from 'common/fieldTypes';
|
import { BLOB, BIT, DATE, DATETIME, FLOAT, SPATIAL, IS_MULTI_SPATIAL, NUMBER } from 'common/fieldTypes';
|
||||||
import hexToBinary from 'common/libs/hexToBinary';
|
import hexToBinary, { HexChar } from 'common/libs/hexToBinary';
|
||||||
import { getArrayDepth } from 'common/libs/getArrayDepth';
|
import { getArrayDepth } from 'common/libs/getArrayDepth';
|
||||||
import * as moment from 'moment';
|
import * as moment from 'moment';
|
||||||
import { lineString, point, polygon } from '@turf/helpers';
|
import { lineString, point, polygon } from '@turf/helpers';
|
||||||
@ -138,7 +138,7 @@ ${footer}
|
|||||||
: this.escapeAndQuote(val);
|
: this.escapeAndQuote(val);
|
||||||
}
|
}
|
||||||
else if (BIT.includes(column.type))
|
else if (BIT.includes(column.type))
|
||||||
sqlInsertString += `b'${hexToBinary(Buffer.from(val).toString('hex'))}'`;
|
sqlInsertString += `b'${hexToBinary(Buffer.from(val).toString('hex') as undefined as HexChar[])}'`;
|
||||||
else if (BLOB.includes(column.type))
|
else if (BLOB.includes(column.type))
|
||||||
sqlInsertString += `X'${val.toString('hex').toUpperCase()}'`;
|
sqlInsertString += `X'${val.toString('hex').toUpperCase()}'`;
|
||||||
else if (NUMBER.includes(column.type))
|
else if (NUMBER.includes(column.type))
|
||||||
|
@ -2,7 +2,7 @@ import * as antares from 'common/interfaces/antares';
|
|||||||
import * as exporter from 'common/interfaces/exporter';
|
import * as exporter from 'common/interfaces/exporter';
|
||||||
import { SqlExporter } from './SqlExporter';
|
import { SqlExporter } from './SqlExporter';
|
||||||
import { BLOB, BIT, DATE, DATETIME, FLOAT, NUMBER, TEXT_SEARCH } from 'common/fieldTypes';
|
import { BLOB, BIT, DATE, DATETIME, FLOAT, NUMBER, TEXT_SEARCH } from 'common/fieldTypes';
|
||||||
import hexToBinary from 'common/libs/hexToBinary';
|
import hexToBinary, { HexChar } from 'common/libs/hexToBinary';
|
||||||
import * as moment from 'moment';
|
import * as moment from 'moment';
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
@ -249,7 +249,7 @@ SET row_security = off;\n\n\n`;
|
|||||||
else if (TEXT_SEARCH.includes(column.type))
|
else if (TEXT_SEARCH.includes(column.type))
|
||||||
sqlInsertString += `'${val.replaceAll('\'', '\'\'')}'`;
|
sqlInsertString += `'${val.replaceAll('\'', '\'\'')}'`;
|
||||||
else if (BIT.includes(column.type))
|
else if (BIT.includes(column.type))
|
||||||
sqlInsertString += `b'${hexToBinary(Buffer.from(val).toString('hex'))}'`;
|
sqlInsertString += `b'${hexToBinary(Buffer.from(val).toString('hex') as undefined as HexChar[])}'`;
|
||||||
else if (BLOB.includes(column.type))
|
else if (BLOB.includes(column.type))
|
||||||
sqlInsertString += `decode('${val.toString('hex').toUpperCase()}', 'hex')`;
|
sqlInsertString += `decode('${val.toString('hex').toUpperCase()}', 'hex')`;
|
||||||
else if (NUMBER.includes(column.type))
|
else if (NUMBER.includes(column.type))
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import * as pg from 'pg';
|
import * as pg from 'pg';
|
||||||
import * as importer from 'common/interfaces/importer';
|
import * as importer from 'common/interfaces/importer';
|
||||||
import fs from 'fs/promises';
|
import * as fs from 'fs/promises';
|
||||||
import PostgreSQLParser from '../../parsers/PostgreSQLParser';
|
import PostgreSQLParser from '../../parsers/PostgreSQLParser';
|
||||||
import { BaseImporter } from '../BaseImporter';
|
import { BaseImporter } from '../BaseImporter';
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user