1
1
mirror of https://github.com/Fabio286/antares.git synced 2025-02-03 10:47:31 +01:00
This commit is contained in:
Fabio Di Stasio 2022-05-10 13:22:26 +02:00
parent ae377a6c3c
commit d494b17df7
13 changed files with 27 additions and 16 deletions

View File

@ -1,3 +1,5 @@
import { TypesGroup } from 'common/interfaces/antares';
export default [
{
group: 'integer',
@ -306,4 +308,4 @@ export default [
}
]
}
];
] as TypesGroup[];

View File

@ -1,3 +1,5 @@
import { TypesGroup } from 'common/interfaces/antares';
export default [
{
group: 'integer',
@ -290,4 +292,4 @@ export default [
}
]
}
];
] as TypesGroup[];

View File

@ -1,3 +1,5 @@
import { TypesGroup } from 'common/interfaces/antares';
export default [
{
group: 'integer',
@ -134,4 +136,4 @@ export default [
}
]
}
];
] as TypesGroup[];

View File

@ -67,6 +67,11 @@ export interface TypeInformations {
zerofill: boolean;
}
export interface TypesGroup {
group: string;
types: TypeInformations[];
}
// Tables
export interface TableField {
name: string;

View File

@ -23,7 +23,7 @@ const lookup = {
F: '1111'
} as const;
type HexChar = keyof typeof lookup
export type HexChar = keyof typeof lookup
export default function hexToBinary (hex: HexChar[]) {
let binary = '';

View File

@ -1,5 +1,5 @@
import * as antares from 'common/interfaces/antares';
import fs from 'fs';
import * as fs from 'fs';
import { ipcMain } from 'electron';
import { ClientsFactory } from '../libs/ClientsFactory';
import { SslOptions } from 'mysql2';

View File

@ -6,7 +6,7 @@ import moment from 'moment';
import { sqlEscaper } from 'common/libs/sqlEscaper';
import { TEXT, LONG_TEXT, ARRAY, TEXT_SEARCH, NUMBER, FLOAT, BLOB, BIT, DATE, DATETIME } from 'common/fieldTypes';
import * as customizations from 'common/customizations';
import fs from 'fs';
import * as fs from 'fs';
export default (connections: {[key: string]: antares.Client}) => {
ipcMain.handle('get-table-columns', async (event, params) => {

View File

@ -1,8 +1,8 @@
import * as antares from 'common/interfaces/antares';
import * as mysql from 'mysql2/promise';
import { AntaresCore } from '../AntaresCore';
import * as dataTypes from 'common/data-types/mysql';
import SSH2Promise from 'ssh2-promise';
import dataTypes from 'common/data-types/mysql';
import SSH2Promise = require('ssh2-promise');
import SSHConfig from 'ssh2-promise/lib/sshConfig';
export class MySQLClient extends AntaresCore {

View File

@ -4,8 +4,8 @@ import { builtinsTypes } from 'pg-types';
import * as pg from 'pg';
import * as pgAst from 'pgsql-ast-parser';
import { AntaresCore } from '../AntaresCore';
import * as dataTypes from 'common/data-types/postgresql';
import SSH2Promise from 'ssh2-promise';
import dataTypes from 'common/data-types/postgresql';
import SSH2Promise = require('ssh2-promise');
import SSHConfig from 'ssh2-promise/lib/sshConfig';
// eslint-disable-next-line @typescript-eslint/no-explicit-any

View File

@ -1,7 +1,7 @@
import * as antares from 'common/interfaces/antares';
import * as sqlite from 'better-sqlite3';
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';
export class SQLiteClient extends AntaresCore {

View File

@ -2,7 +2,7 @@ import * as exporter from 'common/interfaces/exporter';
import * as mysql from 'mysql2/promise';
import { SqlExporter } from './SqlExporter';
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 * as moment from 'moment';
import { lineString, point, polygon } from '@turf/helpers';
@ -138,7 +138,7 @@ ${footer}
: this.escapeAndQuote(val);
}
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))
sqlInsertString += `X'${val.toString('hex').toUpperCase()}'`;
else if (NUMBER.includes(column.type))

View File

@ -2,7 +2,7 @@ import * as antares from 'common/interfaces/antares';
import * as exporter from 'common/interfaces/exporter';
import { SqlExporter } from './SqlExporter';
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';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
@ -249,7 +249,7 @@ SET row_security = off;\n\n\n`;
else if (TEXT_SEARCH.includes(column.type))
sqlInsertString += `'${val.replaceAll('\'', '\'\'')}'`;
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))
sqlInsertString += `decode('${val.toString('hex').toUpperCase()}', 'hex')`;
else if (NUMBER.includes(column.type))

View File

@ -1,6 +1,6 @@
import * as pg from 'pg';
import * as importer from 'common/interfaces/importer';
import fs from 'fs/promises';
import * as fs from 'fs/promises';
import PostgreSQLParser from '../../parsers/PostgreSQLParser';
import { BaseImporter } from '../BaseImporter';