mirror of
https://github.com/Fabio286/antares.git
synced 2025-06-05 21:59:22 +02:00
Compare commits
9 Commits
dependabot
...
v0.7.35-be
Author | SHA1 | Date | |
---|---|---|---|
a95a76480c | |||
1d1be55d3d | |||
d912faa850 | |||
ba63b049a3 | |||
fcd7e404ba | |||
8eb4d2e114 | |||
acea18e6f0 | |||
973b0fc4be | |||
4adbc575c2 |
2
.github/workflows/create-artifact-linux.yml
vendored
2
.github/workflows/create-artifact-linux.yml
vendored
@@ -5,7 +5,7 @@ on:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Check out Git repository
|
||||
uses: actions/checkout@v4
|
||||
|
22
CHANGELOG.md
22
CHANGELOG.md
@@ -2,6 +2,28 @@
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
### [0.7.35-beta.0](https://github.com/antares-sql/antares/compare/v0.7.34...v0.7.35-beta.0) (2025-04-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* custom connection icon disappears during connection, fixes [#939](https://github.com/antares-sql/antares/issues/939) ([1d1be55](https://github.com/antares-sql/antares/commit/1d1be55d3d4ea621364c37e75de616046371feeb))
|
||||
* escape SQL parameters in update and delete for where clauses, fixes [#964](https://github.com/antares-sql/antares/issues/964) ([ba63b04](https://github.com/antares-sql/antares/commit/ba63b049a3a059e77256141dc7b761efbbbf8c1e))
|
||||
* improved handling of query comments, fixes [#963](https://github.com/antares-sql/antares/issues/963) and [#580](https://github.com/antares-sql/antares/issues/580) ([d912faa](https://github.com/antares-sql/antares/commit/d912faa85042219315c9c5658d7f20fda560af44))
|
||||
* use custom elements wrapper for foreign column and description in query ([973b0fc](https://github.com/antares-sql/antares/commit/973b0fc4be1dac25757e430e4520d6fc2212f93b))
|
||||
|
||||
|
||||
### Improvements
|
||||
|
||||
* **translation:** update Spanish translations, closes [#962](https://github.com/antares-sql/antares/issues/962) ([acea18e](https://github.com/antares-sql/antares/commit/acea18e6f061adab7e79d1249e0e68555a620db5))
|
||||
|
||||
### [0.7.34](https://github.com/antares-sql/antares/compare/v0.7.33...v0.7.34) (2025-02-14)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* issue with some SSH connections, definitely ([eb706c3](https://github.com/antares-sql/antares/commit/eb706c3e51e9cb7577febd291a33594c0650a34a))
|
||||
|
||||
### [0.7.33](https://github.com/antares-sql/antares/compare/v0.7.32...v0.7.33) (2025-02-14)
|
||||
|
||||
|
||||
|
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "antares",
|
||||
"version": "0.7.33",
|
||||
"version": "0.7.35-beta.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "antares",
|
||||
"version": "0.7.33",
|
||||
"version": "0.7.35-beta.0",
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
|
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "antares",
|
||||
"productName": "Antares",
|
||||
"version": "0.7.33",
|
||||
"version": "0.7.35-beta.0",
|
||||
"description": "A modern, fast and productivity driven SQL client with a focus in UX.",
|
||||
"license": "MIT",
|
||||
"repository": "https://github.com/antares-sql/antares.git",
|
||||
|
@@ -1,86 +0,0 @@
|
||||
import { ClientCode } from 'common/interfaces/antares';
|
||||
|
||||
export const querySplitter =(sql: string, dbType: ClientCode): string[] => {
|
||||
const queries: string[] = [];
|
||||
let currentQuery = '';
|
||||
let insideBlock = false;
|
||||
let insideString = false;
|
||||
let stringDelimiter: string | null = null;
|
||||
let insideDollarTag = false;
|
||||
let dollarTagDelimiter: string | null = null;
|
||||
|
||||
// Regex patterns for BEGIN-END blocks, dollar tags in PostgreSQL, and semicolons
|
||||
const beginRegex = /\bBEGIN\b/i;
|
||||
const endRegex = /\bEND\b;/i;
|
||||
const dollarTagRegex = /\$(\w+)?\$/; // Matches $tag$ or $$
|
||||
|
||||
// Split on semicolons, keeping semicolons attached to the lines
|
||||
const lines = sql.split(/(?<=;)/);
|
||||
|
||||
for (let line of lines) {
|
||||
line = line.trim();
|
||||
|
||||
if (!line) continue;
|
||||
|
||||
for (let i = 0; i < line.length; i++) {
|
||||
const char = line[i];
|
||||
|
||||
// Handle string boundaries
|
||||
if ((char === '\'' || char === '"') && (!insideString || char === stringDelimiter)) {
|
||||
if (!insideString) {
|
||||
insideString = true;
|
||||
stringDelimiter = char;
|
||||
}
|
||||
else {
|
||||
insideString = false;
|
||||
stringDelimiter = null;
|
||||
}
|
||||
}
|
||||
|
||||
currentQuery += char;
|
||||
|
||||
if (dbType === 'pg') {
|
||||
// Handle dollar-quoted blocks in PostgreSQL
|
||||
if (!insideString && line.slice(i).match(dollarTagRegex)) {
|
||||
const match = line.slice(i).match(dollarTagRegex);
|
||||
if (match) {
|
||||
const tag = match[0];
|
||||
if (!insideDollarTag) {
|
||||
insideDollarTag = true;
|
||||
dollarTagDelimiter = tag;
|
||||
currentQuery += tag;
|
||||
i += tag.length - 1;
|
||||
}
|
||||
else if (dollarTagDelimiter === tag) {
|
||||
insideDollarTag = false;
|
||||
dollarTagDelimiter = null;
|
||||
currentQuery += tag;
|
||||
i += tag.length - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check BEGIN-END blocks
|
||||
if (!insideString && !insideDollarTag) {
|
||||
if (beginRegex.test(line))
|
||||
insideBlock = true;
|
||||
|
||||
if (insideBlock && endRegex.test(line))
|
||||
insideBlock = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Append the query if we encounter a semicolon outside a BEGIN-END block, outside a string, and outside dollar tags
|
||||
if (!insideBlock && !insideString && !insideDollarTag && /;\s*$/.test(line)) {
|
||||
queries.push(currentQuery.trim());
|
||||
currentQuery = '';
|
||||
}
|
||||
}
|
||||
|
||||
// Add any remaining query
|
||||
if (currentQuery.trim())
|
||||
queries.push(currentQuery.trim());
|
||||
|
||||
return queries;
|
||||
};
|
@@ -3,18 +3,161 @@
|
||||
import { lineString, point, polygon } from '@turf/helpers';
|
||||
import { BIT, BLOB, DATE, DATETIME, FLOAT, IS_MULTI_SPATIAL, NUMBER, SPATIAL, TEXT_SEARCH } from 'common/fieldTypes';
|
||||
import * as antares from 'common/interfaces/antares';
|
||||
import { ClientCode } from 'common/interfaces/antares';
|
||||
import * as moment from 'moment';
|
||||
|
||||
import customizations from '../customizations';
|
||||
import { ClientCode } from '../interfaces/antares';
|
||||
import { getArrayDepth } from './getArrayDepth';
|
||||
import hexToBinary, { HexChar } from './hexToBinary';
|
||||
|
||||
/**
|
||||
* Escapes a string fo SQL use
|
||||
* Splits a SQL string into multiple queries based on semicolons (;).
|
||||
* Handles BEGIN-END blocks, strings, comments, and PostgreSQL dollar-quoted tags.
|
||||
*
|
||||
* @param { String } string
|
||||
* @returns { String } Escaped string
|
||||
* @param {string} sql - The SQL string to split.
|
||||
* @param {ClientCode} dbType - The database type (e.g., 'pg', 'mysql').
|
||||
* @returns {string[]} - An array of separated SQL queries.
|
||||
*/
|
||||
export const querySplitter =(sql: string, dbType: ClientCode): string[] => {
|
||||
const queries: string[] = [];
|
||||
let currentQuery = '';
|
||||
let insideBlock = false;
|
||||
let insideString = false;
|
||||
let stringDelimiter: string | null = null;
|
||||
let insideDollarTag = false;
|
||||
let dollarTagDelimiter: string | null = null;
|
||||
|
||||
// Regex patterns for BEGIN-END blocks, dollar tags in PostgreSQL, and semicolons
|
||||
const beginRegex = /\bBEGIN\b/i;
|
||||
const endRegex = /\bEND\b;/i;
|
||||
const dollarTagRegex = /\$(\w+)?\$/; // Matches $tag$ or $$
|
||||
|
||||
// Split on semicolons, keeping semicolons attached to the lines
|
||||
const lines = sql.split(/(?<=;)/);
|
||||
|
||||
for (let line of lines) {
|
||||
line = line.trim();
|
||||
|
||||
if (!line) continue;
|
||||
|
||||
for (let i = 0; i < line.length; i++) {
|
||||
const char = line[i];
|
||||
|
||||
// Handle string boundaries
|
||||
if ((char === '\'' || char === '"') && (!insideString || char === stringDelimiter)) {
|
||||
if (!insideString) {
|
||||
insideString = true;
|
||||
stringDelimiter = char;
|
||||
}
|
||||
else {
|
||||
insideString = false;
|
||||
stringDelimiter = null;
|
||||
}
|
||||
}
|
||||
|
||||
currentQuery += char;
|
||||
|
||||
if (dbType === 'pg') {
|
||||
// Handle dollar-quoted blocks in PostgreSQL
|
||||
if (!insideString && line.slice(i).match(dollarTagRegex)) {
|
||||
const match = line.slice(i).match(dollarTagRegex);
|
||||
if (match) {
|
||||
const tag = match[0];
|
||||
if (!insideDollarTag) {
|
||||
insideDollarTag = true;
|
||||
dollarTagDelimiter = tag;
|
||||
currentQuery += tag;
|
||||
i += tag.length - 1;
|
||||
}
|
||||
else if (dollarTagDelimiter === tag) {
|
||||
insideDollarTag = false;
|
||||
dollarTagDelimiter = null;
|
||||
currentQuery += tag;
|
||||
i += tag.length - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check BEGIN-END blocks
|
||||
if (!insideString && !insideDollarTag) {
|
||||
if (beginRegex.test(line))
|
||||
insideBlock = true;
|
||||
|
||||
if (insideBlock && endRegex.test(line))
|
||||
insideBlock = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Append the query if we encounter a semicolon outside a BEGIN-END block, outside a string, and outside dollar tags
|
||||
if (!insideBlock && !insideString && !insideDollarTag && /;\s*$/.test(line)) {
|
||||
queries.push(currentQuery.trim());
|
||||
currentQuery = '';
|
||||
}
|
||||
}
|
||||
|
||||
// Add any remaining query
|
||||
if (currentQuery.trim())
|
||||
queries.push(currentQuery.trim());
|
||||
|
||||
return queries;
|
||||
};
|
||||
|
||||
/**
|
||||
* Removes all comments (both single-line and multi-line) from a SQL string.
|
||||
*
|
||||
* @param {string} sql - The SQL string to process.
|
||||
* @returns {string} - The SQL string without comments.
|
||||
*/
|
||||
export const removeComments = (sql: string): string => {
|
||||
let result = '';
|
||||
let insideSingleLineComment = false;
|
||||
let insideMultiLineComment = false;
|
||||
|
||||
for (let i = 0; i < sql.length; i++) {
|
||||
const char = sql[i];
|
||||
const nextChar = sql[i + 1] || '';
|
||||
|
||||
// Handle single-line comments (--)
|
||||
if (!insideMultiLineComment && char === '-' && nextChar === '-')
|
||||
insideSingleLineComment = true;
|
||||
|
||||
// Handle multi-line comments (/* */)
|
||||
if (!insideSingleLineComment && char === '/' && nextChar === '*') {
|
||||
insideMultiLineComment = true;
|
||||
i++; // Skip the '*' character
|
||||
continue;
|
||||
}
|
||||
|
||||
if (insideMultiLineComment && char === '*' && nextChar === '/') {
|
||||
insideMultiLineComment = false;
|
||||
i++; // Skip the '/' character
|
||||
continue;
|
||||
}
|
||||
|
||||
// Skip characters inside comments
|
||||
if (insideSingleLineComment) {
|
||||
if (char === '\n')
|
||||
insideSingleLineComment = false;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (insideMultiLineComment)
|
||||
continue;
|
||||
|
||||
// Append non-comment characters to the result
|
||||
result += char;
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* Escapes a string for safe use in SQL queries.
|
||||
*
|
||||
* @param {string} string - The string to escape.
|
||||
* @returns {string} - The escaped string.
|
||||
*/
|
||||
export const sqlEscaper = (string: string): string => {
|
||||
// eslint-disable-next-line no-control-regex
|
||||
@@ -27,6 +170,12 @@ export const sqlEscaper = (string: string): string => {
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a value into a GeoJSON object based on its type.
|
||||
*
|
||||
* @param {any} val - The value to convert.
|
||||
* @returns {object} - The generated GeoJSON object.
|
||||
*/
|
||||
export const objectToGeoJSON = (val: any) => {
|
||||
if (Array.isArray(val)) {
|
||||
if (getArrayDepth(val) === 1)
|
||||
@@ -38,6 +187,13 @@ export const objectToGeoJSON = (val: any) => {
|
||||
return point([val.x, val.y]);
|
||||
};
|
||||
|
||||
/**
|
||||
* Escapes and wraps a string in quotes for safe use in SQL queries.
|
||||
*
|
||||
* @param {string} val - The string to process.
|
||||
* @param {ClientCode} client - The database type (e.g., 'pg', 'mysql').
|
||||
* @returns {string} - The escaped and quoted string.
|
||||
*/
|
||||
export const escapeAndQuote = (val: string, client: ClientCode) => {
|
||||
const { stringsWrapper: sw } = customizations[client];
|
||||
// eslint-disable-next-line no-control-regex
|
||||
@@ -74,11 +230,17 @@ export const escapeAndQuote = (val: string, client: ClientCode) => {
|
||||
return `${sw}${escapedVal}${sw}`;
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a value into a SQL string based on the field type and database type.
|
||||
*
|
||||
* @param {object} args - Arguments containing the value, database type, and field type.
|
||||
* @returns {string} - The generated SQL string.
|
||||
*/
|
||||
export const valueToSqlString = (args: {
|
||||
val: any;
|
||||
client: ClientCode;
|
||||
field: {type: string; datePrecision?: number; precision?: number | false; isArray?: boolean};
|
||||
}): string => {
|
||||
val: any;
|
||||
client: ClientCode;
|
||||
field: { type: string; datePrecision?: number; precision?: number | false; isArray?: boolean };
|
||||
}): string => {
|
||||
let parsedValue;
|
||||
const { val, client, field } = args;
|
||||
const { stringsWrapper: sw } = customizations[client];
|
||||
@@ -165,13 +327,19 @@ export const valueToSqlString = (args: {
|
||||
return parsedValue;
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a JSON array into an SQL INSERT query.
|
||||
*
|
||||
* @param {object} args - Arguments containing the JSON data, database type, fields, and options.
|
||||
* @returns {string} - The generated SQL INSERT query.
|
||||
*/
|
||||
export const jsonToSqlInsert = (args: {
|
||||
json: Record<string, any>[];
|
||||
client: ClientCode;
|
||||
fields: Record<string, {type: string; datePrecision: number}>;
|
||||
table: string;
|
||||
options?: {sqlInsertAfter: number; sqlInsertDivider: 'bytes' | 'rows'};
|
||||
}) => {
|
||||
json: Record<string, any>[];
|
||||
client: ClientCode;
|
||||
fields: Record<string, { type: string; datePrecision: number }>;
|
||||
table: string;
|
||||
options?: { sqlInsertAfter: number; sqlInsertDivider: 'bytes' | 'rows' };
|
||||
}) => {
|
||||
const { client, json, fields, table, options } = args;
|
||||
const sqlInsertAfter = options && options.sqlInsertAfter ? options.sqlInsertAfter : 1;
|
||||
const sqlInsertDivider = options && options.sqlInsertDivider ? options.sqlInsertDivider : 'rows';
|
||||
@@ -193,7 +361,7 @@ export const jsonToSqlInsert = (args: {
|
||||
(sqlInsertDivider === 'bytes' && queryLength >= sqlInsertAfter * 1024) ||
|
||||
(sqlInsertDivider === 'rows' && rowsWritten === sqlInsertAfter)
|
||||
) {
|
||||
insertsString += insertStmt+';';
|
||||
insertsString += insertStmt + ';';
|
||||
insertStmt = `\nINSERT INTO ${ew}${table}${ew} (${fieldNames.join(', ')}) VALUES `;
|
||||
rowsWritten = 0;
|
||||
}
|
||||
@@ -206,11 +374,18 @@ export const jsonToSqlInsert = (args: {
|
||||
}
|
||||
|
||||
if (rowsWritten > 0)
|
||||
insertsString += insertStmt+';';
|
||||
insertsString += insertStmt + ';';
|
||||
|
||||
return insertsString;
|
||||
};
|
||||
|
||||
/**
|
||||
* Formats a JSON value for use in an SQL WHERE clause.
|
||||
*
|
||||
* @param {object} jsonValue - The JSON value to format.
|
||||
* @param {ClientCode} clientType - The database type (e.g., 'pg', 'mysql').
|
||||
* @returns {string} - The formatted SQL WHERE clause.
|
||||
*/
|
||||
export const formatJsonForSqlWhere = (jsonValue: object, clientType: antares.ClientCode) => {
|
||||
const formattedValue = JSON.stringify(jsonValue);
|
||||
|
||||
|
@@ -183,6 +183,7 @@ export default (connections: Record<string, antares.Client>) => {
|
||||
const result = await connections[uid].raw(query, {
|
||||
nest: true,
|
||||
details: true,
|
||||
comments: false,
|
||||
schema,
|
||||
tabUid,
|
||||
autocommit
|
||||
|
@@ -221,7 +221,7 @@ export default (connections: Record<string, antares.Client>) => {
|
||||
.update({ [params.field]: `= ${escapedParam}` })
|
||||
.schema(params.schema)
|
||||
.from(params.table)
|
||||
.where({ [params.primary]: `= ${id}` })
|
||||
.where({ [params.primary]: `= ${sqlEscaper(id)}` })
|
||||
.limit(1)
|
||||
.run();
|
||||
}
|
||||
@@ -233,7 +233,7 @@ export default (connections: Record<string, antares.Client>) => {
|
||||
|
||||
for (const key in orgRow) {
|
||||
if (typeof orgRow[key] === 'string')
|
||||
orgRow[key] = ` = '${orgRow[key]}'`;
|
||||
orgRow[key] = ` = '${sqlEscaper(orgRow[key])}'`;
|
||||
else if (typeof orgRow[key] === 'object' && orgRow[key] !== null)
|
||||
orgRow[key] = formatJsonForSqlWhere(orgRow[key], connections[params.uid]._client);
|
||||
else if (orgRow[key] === null)
|
||||
@@ -290,7 +290,7 @@ export default (connections: Record<string, antares.Client>) => {
|
||||
for (const row of params.rows) {
|
||||
for (const key in row) {
|
||||
if (typeof row[key] === 'string')
|
||||
row[key] = `'${row[key]}'`;
|
||||
row[key] = `'${sqlEscaper(row[key])}'`;
|
||||
|
||||
if (row[key] === null)
|
||||
row[key] = 'IS NULL';
|
||||
@@ -440,16 +440,17 @@ export default (connections: Record<string, antares.Client>) => {
|
||||
|
||||
ipcMain.handle('get-foreign-list', async (event, { uid, schema, table, column, description }) => {
|
||||
if (!validateSender(event.senderFrame)) return { status: 'error', response: 'Unauthorized process' };
|
||||
const { elementsWrapper: ew } = customizations[connections[uid]._client];
|
||||
|
||||
try {
|
||||
const query = connections[uid]
|
||||
.select(`${column} AS foreign_column`)
|
||||
.select(`${ew}${column}${ew} AS foreign_column`)
|
||||
.schema(schema)
|
||||
.from(table)
|
||||
.orderBy('foreign_column ASC');
|
||||
|
||||
if (description)
|
||||
query.select(`LEFT(${description}, 20) AS foreign_description`);
|
||||
query.select(`LEFT(${ew}${description}${ew}, 20) AS foreign_description`);
|
||||
|
||||
const results = await query.run<Record<string, string>>();
|
||||
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import * as antares from 'common/interfaces/antares';
|
||||
import { querySplitter } from 'common/libs/sqlUtils';
|
||||
import mysql from 'mysql2/promise';
|
||||
import * as pg from 'pg';
|
||||
import SSH2Promise = require('@fabio286/ssh2-promise');
|
||||
import { querySplitter } from 'common/libs/querySplitter';
|
||||
|
||||
import { ipcLogger, LoggerLevel } from '../misc/ipcLogger';
|
||||
|
||||
|
@@ -1,6 +1,7 @@
|
||||
import dataTypes from 'common/data-types/firebird';
|
||||
import { FLOAT, NUMBER } from 'common/fieldTypes';
|
||||
import * as antares from 'common/interfaces/antares';
|
||||
import { removeComments } from 'common/libs/sqlUtils';
|
||||
import * as firebird from 'node-firebird';
|
||||
import * as path from 'path';
|
||||
|
||||
@@ -1036,7 +1037,7 @@ export class FirebirdSQLClient extends BaseClient {
|
||||
};
|
||||
|
||||
if (!args.comments)
|
||||
sql = sql.replace(/(\/\*(.|[\r\n])*?\*\/)|(--(.*|[\r\n]))/gm, '');// Remove comments
|
||||
sql = removeComments(sql);
|
||||
|
||||
const resultsArr = [];
|
||||
let paramsArr = [];
|
||||
|
@@ -2,6 +2,7 @@ import SSH2Promise = require('@fabio286/ssh2-promise');
|
||||
import SSHConfig from '@fabio286/ssh2-promise/lib/sshConfig';
|
||||
import dataTypes from 'common/data-types/mysql';
|
||||
import * as antares from 'common/interfaces/antares';
|
||||
import { removeComments } from 'common/libs/sqlUtils';
|
||||
import * as mysql from 'mysql2/promise';
|
||||
|
||||
import * as EncodingToCharset from '../../../../node_modules/mysql2/lib/constants/encoding_charset.js';
|
||||
@@ -1751,7 +1752,7 @@ export class MySQLClient extends BaseClient {
|
||||
};
|
||||
|
||||
if (!args.comments)
|
||||
sql = sql.replace(/(\/\*(.|[\r\n])*?\*\/)|(--(.*|[\r\n]))/gm, '');// Remove comments
|
||||
sql = removeComments(sql);
|
||||
|
||||
const nestTables = args.nest ? '.' : false;
|
||||
const resultsArr: antares.QueryResult[] = [];
|
||||
|
@@ -2,6 +2,7 @@ import SSH2Promise = require('@fabio286/ssh2-promise');
|
||||
import SSHConfig from '@fabio286/ssh2-promise/lib/sshConfig';
|
||||
import dataTypes from 'common/data-types/postgresql';
|
||||
import * as antares from 'common/interfaces/antares';
|
||||
import { removeComments } from 'common/libs/sqlUtils';
|
||||
import * as pg from 'pg';
|
||||
import * as pgAst from 'pgsql-ast-parser';
|
||||
import { ConnectionOptions } from 'tls';
|
||||
@@ -1660,7 +1661,7 @@ export class PostgreSQLClient extends BaseClient {
|
||||
};
|
||||
|
||||
if (!args.comments)
|
||||
sql = sql.replace(/(\/\*(.|[\r\n])*?\*\/)|(--(.*|[\r\n]))/gm, '');// Remove comments
|
||||
sql = removeComments(sql);
|
||||
|
||||
const resultsArr: antares.QueryResult[] = [];
|
||||
let paramsArr = [];
|
||||
|
@@ -2,6 +2,7 @@ import * as sqlite from 'better-sqlite3';
|
||||
import dataTypes from 'common/data-types/sqlite';
|
||||
import { DATETIME, FLOAT, NUMBER, TIME } from 'common/fieldTypes';
|
||||
import * as antares from 'common/interfaces/antares';
|
||||
import { removeComments } from 'common/libs/sqlUtils';
|
||||
|
||||
import { BaseClient } from './BaseClient';
|
||||
|
||||
@@ -624,7 +625,7 @@ export class SQLiteClient extends BaseClient {
|
||||
};
|
||||
|
||||
if (!args.comments)
|
||||
sql = sql.replace(/(\/\*(.|[\r\n])*?\*\/)|(--(.*|[\r\n]))/gm, '');// Remove comments
|
||||
sql = removeComments(sql);
|
||||
|
||||
const resultsArr = [];
|
||||
let paramsArr = [];
|
||||
|
@@ -527,14 +527,14 @@ watch(() => props.connection, () => {
|
||||
localConnection.value = JSON.parse(JSON.stringify(props.connection));
|
||||
});
|
||||
|
||||
const startConnection = async () => {
|
||||
const startConnection = async (): Promise<void> => {
|
||||
await saveConnection();
|
||||
isConnecting.value = true;
|
||||
|
||||
if (localConnection.value.ask)
|
||||
isAsking.value = true;
|
||||
else {
|
||||
await connectWorkspace(localConnection.value, { signal: abortController.value.signal }).catch(() => undefined);
|
||||
await connectWorkspace(localConnection.value, { signal: abortController.value.signal }).catch((): void => undefined);
|
||||
isConnecting.value = false;
|
||||
}
|
||||
};
|
||||
@@ -582,7 +582,7 @@ const continueTest = async (credentials: {user: string; password: string }) => {
|
||||
try {
|
||||
if (isConnecting.value) {
|
||||
const params = Object.assign({}, props.connection, credentials);
|
||||
await connectWorkspace(params, { signal: abortController.value.signal }).catch(() => undefined);
|
||||
await connectWorkspace(params, { signal: abortController.value.signal }).catch((): void => undefined);
|
||||
isConnecting.value = false;
|
||||
}
|
||||
else {
|
||||
|
@@ -36,7 +36,7 @@ export const esES = {
|
||||
stay: 'Mantener',
|
||||
author: 'Autor',
|
||||
upload: 'Subir',
|
||||
browse: 'Navegar',
|
||||
browse: 'Explorar',
|
||||
content: 'Contenido',
|
||||
cut: 'Cortar',
|
||||
copy: 'Copiar',
|
||||
@@ -91,7 +91,7 @@ export const esES = {
|
||||
user: 'Usuario',
|
||||
password: 'Contraseña',
|
||||
credentials: 'Credenciales',
|
||||
connect: 'Connectar',
|
||||
connect: 'Conectar',
|
||||
connected: 'Conectado',
|
||||
disconnect: 'Desconectar',
|
||||
disconnected: 'Desconectado',
|
||||
@@ -117,7 +117,7 @@ export const esES = {
|
||||
readOnlyMode: 'Solo lectura',
|
||||
allConnections: 'Todas las conexiones',
|
||||
searchForConnections: 'Buscar por conexiones',
|
||||
keepAliveInterval: 'Tiempo de mantenimiento de conexión',
|
||||
keepAliveInterval: 'Mantenimiento de conexión',
|
||||
singleConnection: 'Conexión única'
|
||||
},
|
||||
database: { // Database related terms
|
||||
@@ -198,11 +198,11 @@ export const esES = {
|
||||
onUpdate: 'On UPDATE',
|
||||
deleteField: 'Eliminar campo',
|
||||
createNewIndex: 'Crear nuevo índice',
|
||||
createNewCheck: 'Crear nueva verificación',
|
||||
createNewCheck: 'Crear nueva validación',
|
||||
checkClause: 'Comprobar cláusula',
|
||||
addToIndex: 'Añadir al índice',
|
||||
createNewTable: 'Crear nueva tabla',
|
||||
emptyTable: 'Tabla vacía',
|
||||
emptyTable: 'Vaciar tabla',
|
||||
duplicateTable: 'Duplicar tabla',
|
||||
deleteTable: 'Eliminar tabla',
|
||||
exportTable: 'Exportar tabla',
|
||||
@@ -376,10 +376,10 @@ export const esES = {
|
||||
newFolder: 'Crear nueva carpeta',
|
||||
outOfFolder: 'Fuera de la carpeta',
|
||||
editConnectionAppearance: 'Modificar apariencia de conexión',
|
||||
defaultCopyType: 'Default copy type',
|
||||
defaultCopyType: 'Copiar fichero por defecto',
|
||||
showTableSize: 'Mostrar tamaño de tabla en la barra lateral',
|
||||
showTableSizeDescription: 'Solo para MySQL/MariaDB. Habilitar esta opción puede afectar al rendimiento en esquemas con muchas tablas.',
|
||||
switchSearchMethod: 'Switch search method',
|
||||
switchSearchMethod: 'Cambiar método de búsqueda',
|
||||
phpArray: 'Array de PHP',
|
||||
closeAllTabs: 'Cerrar todas las pestañas',
|
||||
closeOtherTabs: 'Cerrar las otras pestañas',
|
||||
@@ -396,27 +396,32 @@ export const esES = {
|
||||
importDataExplanation: 'Importará un fichero con extensión .antares que contiene conexiones. Necesitará la contraseña con la que se encriptó el mismo.',
|
||||
includeConnectionPasswords: 'Incluir contraseñas de conexión',
|
||||
includeFolders: 'Incluir carpetas',
|
||||
encryptionPassword: 'Encryption password',
|
||||
encryptionPasswordError: 'The encryption password must be at least 8 characters long.',
|
||||
ignoreDuplicates: 'Ignore duplicates',
|
||||
wrongImportPassword: 'Wrong import password',
|
||||
wrongFileFormat: 'Wrong file format',
|
||||
dataImportSuccess: 'Data successfully imported',
|
||||
note: 'Note | Notes',
|
||||
thereAreNoNotesYet: 'There are no notes yet',
|
||||
addNote: 'Add note',
|
||||
editNote: 'Edit note',
|
||||
saveAsNote: 'Save as note',
|
||||
showArchivedNotes: 'Show archived notes',
|
||||
hideArchivedNotes: 'Hide archived notes',
|
||||
tag: 'Tag', // Note tag,
|
||||
saveFile: 'Save file',
|
||||
saveFileAs: 'Save file as',
|
||||
openFile: 'Open file',
|
||||
openNotes: 'Open notes',
|
||||
debugConsole: 'Debug console', // <- console tab name
|
||||
executedQueries: 'Executed queries', // <- console tab name
|
||||
sizeLimitError: 'Maximum size of {size} exceeded'
|
||||
encryptionPassword: 'Contraseña de encriptado',
|
||||
encryptionPasswordError: 'La contraseña de encriptado debe tener al menos 8 caracteres',
|
||||
ignoreDuplicates: 'Ignorar duplicados',
|
||||
wrongImportPassword: 'Contraseña de importación errónea',
|
||||
wrongFileFormat: 'Formato de fichero erróneo',
|
||||
invalidFile: 'Fichero no válido',
|
||||
dataImportSuccess: 'Datos importados correctamente',
|
||||
note: 'Nota | Notas',
|
||||
thereAreNoNotesYet: 'No hay notas',
|
||||
addNote: 'Nueva nota',
|
||||
editNote: 'Modificar nota',
|
||||
saveAsNote: 'Guardar como nota',
|
||||
showArchivedNotes: 'Mostrar notas archivadas',
|
||||
hideArchivedNotes: 'Ocultar notas archivadas',
|
||||
tag: 'Etiqueta', // Note tag,
|
||||
saveFile: 'Guardar fichero',
|
||||
saveFileAs: 'Guardar fichero como...',
|
||||
openFile: 'Abrir fichero',
|
||||
openNotes: 'Abrir notas',
|
||||
debugConsole: 'Consola de Depuración', // <- console tab name
|
||||
executedQueries: 'Consultas realizadas', // <- console tab name
|
||||
sizeLimitError: 'Tamaño maximo de {size} excedido',
|
||||
fullScreen: 'Pantalla completa',
|
||||
zoomIn: 'Mas zoom',
|
||||
zoomOut: 'Menos zoom',
|
||||
zoomReset: 'Restablecer zoom'
|
||||
},
|
||||
faker: { // Faker.js methods, used in random generated content
|
||||
address: 'Dirección',
|
||||
@@ -569,12 +574,12 @@ export const esES = {
|
||||
alphaNumeric: 'Alfanumérico',
|
||||
hexaDecimal: 'Hexadecimal',
|
||||
fileName: 'Nombre de fichero',
|
||||
commonFileName: 'Common file name',
|
||||
commonFileName: 'Nombre de fichero común',
|
||||
mimeType: 'Mime-Type',
|
||||
commonFileType: 'Common file type',
|
||||
commonFileExt: 'Common file extension',
|
||||
commonFileType: 'Tipo de fichero común',
|
||||
commonFileExt: 'Extensión de fichero común',
|
||||
fileType: 'Tipo de fichero',
|
||||
fileExt: 'Extension de fichero',
|
||||
fileExt: 'Extensión de fichero',
|
||||
directoryPath: 'Ruta de directorio',
|
||||
filePath: 'Ruta de fichero',
|
||||
semver: 'SemVer',
|
||||
|
@@ -163,7 +163,8 @@ export const useConnectionsStore = defineStore('connections', {
|
||||
uid: connection.uid,
|
||||
client: connection.client,
|
||||
icon: conn.icon,
|
||||
name: conn.name
|
||||
name: conn.name,
|
||||
hasCustomIcon: conn.hasCustomIcon
|
||||
};
|
||||
}
|
||||
return conn;
|
||||
|
@@ -151,7 +151,7 @@ export const useWorkspacesStore = defineStore('workspaces', {
|
||||
this.workspaces = (this.workspaces as Workspace[]).map(workspace => workspace.uid === connection.uid
|
||||
? {
|
||||
...workspace,
|
||||
structure: [],
|
||||
structure: [] as WorkspaceStructure[],
|
||||
breadcrumbs: {},
|
||||
loadedSchemas: new Set(),
|
||||
database: connection.database,
|
||||
@@ -167,7 +167,7 @@ export const useWorkspacesStore = defineStore('workspaces', {
|
||||
this.workspaces = (this.workspaces as Workspace[]).map(workspace => workspace.uid === connection.uid
|
||||
? {
|
||||
...workspace,
|
||||
structure: [],
|
||||
structure: [] as WorkspaceStructure[],
|
||||
breadcrumbs: {},
|
||||
loadedSchemas: new Set(),
|
||||
connectionStatus: 'disconnected'
|
||||
@@ -187,7 +187,7 @@ export const useWorkspacesStore = defineStore('workspaces', {
|
||||
this.workspaces = (this.workspaces as Workspace[]).map(workspace => workspace.uid === connection.uid
|
||||
? {
|
||||
...workspace,
|
||||
structure: [],
|
||||
structure: [] as WorkspaceStructure[],
|
||||
breadcrumbs: {},
|
||||
loadedSchemas: new Set(),
|
||||
connectionStatus: 'failed'
|
||||
@@ -200,9 +200,7 @@ export const useWorkspacesStore = defineStore('workspaces', {
|
||||
return reject(new Error('Connection aborted by user'));
|
||||
else {
|
||||
let clientCustomizations: Customizations;
|
||||
const { updateLastConnection } = connectionsStore;
|
||||
|
||||
updateLastConnection(connection.uid);
|
||||
connectionsStore.updateLastConnection(connection.uid);
|
||||
|
||||
switch (connection.client) {
|
||||
case 'mysql':
|
||||
@@ -418,7 +416,7 @@ export const useWorkspacesStore = defineStore('workspaces', {
|
||||
this.workspaces = (this.workspaces as Workspace[]).map(workspace => workspace.uid === uid
|
||||
? {
|
||||
...workspace,
|
||||
structure: [],
|
||||
structure: [] as WorkspaceStructure[],
|
||||
breadcrumbs: {},
|
||||
loadedSchemas: new Set(),
|
||||
connectionStatus: 'disconnected'
|
||||
|
Reference in New Issue
Block a user