diff --git a/src/common/fieldTypes.js b/src/common/fieldTypes.js index 066ecb1b..5ae03e3f 100644 --- a/src/common/fieldTypes.js +++ b/src/common/fieldTypes.js @@ -7,11 +7,19 @@ export const TEXT = [ export const LONG_TEXT = [ 'TEXT', 'MEDIUMTEXT', - 'LONGTEXT', + 'LONGTEXT' +]; + +export const ARRAY = [ 'ARRAY', 'ANYARRAY' ]; +export const TEXT_SEARCH = [ + 'TSVECTOR', + 'TSQUERY' +]; + export const NUMBER = [ 'INT', 'TINYINT', @@ -49,6 +57,7 @@ export const TIME = [ export const DATETIME = [ 'DATETIME', 'TIMESTAMP', + 'TIMESTAMP WITHOUT TIME ZONE', 'TIMESTAMP WITH TIME ZONE' ]; diff --git a/src/main/ipc-handlers/tables.js b/src/main/ipc-handlers/tables.js index 10f87a83..cb6ee000 100644 --- a/src/main/ipc-handlers/tables.js +++ b/src/main/ipc-handlers/tables.js @@ -2,7 +2,7 @@ import { ipcMain } from 'electron'; import faker from 'faker'; import moment from 'moment'; import { sqlEscaper } from 'common/libs/sqlEscaper'; -import { TEXT, LONG_TEXT, 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 fs from 'fs'; export default (connections) => { @@ -68,6 +68,10 @@ export default (connections) => { escapedParam = params.content; else if ([...TEXT, ...LONG_TEXT].includes(params.type)) escapedParam = `"${sqlEscaper(params.content)}"`; + else if (ARRAY.includes(params.type)) + escapedParam = `'${params.content}'`; + else if (TEXT_SEARCH.includes(params.type)) + escapedParam = `'${params.content.replaceAll('\'', '\'\'')}'`; else if (BLOB.includes(params.type)) { if (params.content) { const fileBlob = fs.readFileSync(params.content); diff --git a/src/renderer/components/WorkspaceExploreBarSchema.vue b/src/renderer/components/WorkspaceExploreBarSchema.vue index a6ee1508..abb398fa 100644 --- a/src/renderer/components/WorkspaceExploreBarSchema.vue +++ b/src/renderer/components/WorkspaceExploreBarSchema.vue @@ -37,7 +37,7 @@ -
+
@@ -65,7 +65,7 @@
-
+
@@ -93,7 +93,7 @@
-
+
@@ -121,7 +121,7 @@
-
+
@@ -194,6 +194,9 @@ export default { breadcrumbs () { return this.getWorkspace(this.connection.uid).breadcrumbs; }, + customizations () { + return this.getWorkspace(this.connection.uid).customizations; + }, loadedSchemas () { return this.getLoadedSchemas(this.connection.uid); }, diff --git a/src/renderer/components/WorkspaceQueryTableRow.vue b/src/renderer/components/WorkspaceQueryTableRow.vue index 1e007048..a3ff7f31 100644 --- a/src/renderer/components/WorkspaceQueryTableRow.vue +++ b/src/renderer/components/WorkspaceQueryTableRow.vue @@ -173,7 +173,7 @@ import { mimeFromHex } from 'common/libs/mimeFromHex'; import { formatBytes } from 'common/libs/formatBytes'; import { bufferToBase64 } from 'common/libs/bufferToBase64'; import hexToBinary from 'common/libs/hexToBinary'; -import { TEXT, LONG_TEXT, NUMBER, FLOAT, DATE, TIME, DATETIME, BLOB, BIT } from 'common/fieldTypes'; +import { TEXT, LONG_TEXT, ARRAY, TEXT_SEARCH, NUMBER, FLOAT, DATE, TIME, DATETIME, BLOB, BIT } from 'common/fieldTypes'; import { VueMaskDirective } from 'v-mask'; import ConfirmModal from '@/components/BaseConfirmModal'; import TextEditor from '@/components/BaseTextEditor'; @@ -225,6 +225,12 @@ export default { return hexToBinary(hex); } + if (ARRAY.includes(type)) { + if (Array.isArray(val)) + return JSON.stringify(val).replaceAll('[', '{').replaceAll(']', '}'); + return val; + } + return val; } }, @@ -350,7 +356,7 @@ export default { this.editingField = field; this.editingLength = this.fields[field].length; - if (LONG_TEXT.includes(type)) { + if ([...LONG_TEXT, ...ARRAY, ...TEXT_SEARCH].includes(type)) { this.isTextareaEditor = true; this.editingContent = this.$options.filters.typeFormat(content, type); return; diff --git a/src/renderer/i18n/en-US.js b/src/renderer/i18n/en-US.js index 253aacca..4b9768bd 100644 --- a/src/renderer/i18n/en-US.js +++ b/src/renderer/i18n/en-US.js @@ -100,7 +100,8 @@ module.exports = { paste: 'Paste', tools: 'Tools', variables: 'Variables', - processes: 'Processes' + processes: 'Processes', + database: 'Database' }, message: { appWelcome: 'Welcome to Antares SQL Client!', diff --git a/src/renderer/scss/_data-types.scss b/src/renderer/scss/_data-types.scss index 0f780119..9ef7f9ec 100644 --- a/src/renderer/scss/_data-types.scss +++ b/src/renderer/scss/_data-types.scss @@ -55,6 +55,7 @@ "time_with_time_zone": $date-color, "year": $date-color, "timestamp": $date-color, + "timestamp_without_time_zone": $date-color, "timestamp_with_time_zone": $date-color, "bit": $bit-color, "bit_varying": $bit-color, @@ -72,6 +73,8 @@ "interval": $array-color, "array": $array-color, "anyarray": $array-color, + "tsvector": $array-color, + "tsquery": $array-color, "pg_node_tree": $array-color, "unknown": $unknown-color, )