Skip to content

Commit

Permalink
fix(SQLite): update rows with a text primary key
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabio286 committed Nov 25, 2021
1 parent c462246 commit d7f1aa9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/common/customizations/sqlite.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ module.exports = {
views: true,
triggers: true,
// Settings
elementsWrapper: '',
stringsWrapper: '"',
elementsWrapper: '"',
stringsWrapper: '\'',
tableAdd: true,
viewAdd: true,
triggerAdd: true,
Expand Down
4 changes: 3 additions & 1 deletion src/main/ipc-handlers/tables.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import faker from 'faker';
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';

export default (connections) => {
Expand Down Expand Up @@ -85,11 +86,12 @@ export default (connections) => {

ipcMain.handle('update-table-cell', async (event, params) => {
delete params.row._antares_id;
const { stringsWrapper: sw } = customizations[connections[params.uid]._client];

try { // TODO: move to client classes
let escapedParam;
let reload = false;
const id = typeof params.id === 'number' ? params.id : `"${params.id}"`;
const id = typeof params.id === 'number' ? params.id : `${sw}${params.id}${sw}`;

if ([...NUMBER, ...FLOAT].includes(params.type))
escapedParam = params.content;
Expand Down

0 comments on commit d7f1aa9

Please sign in to comment.