diff --git a/src/main/ipc-handlers/tables.js b/src/main/ipc-handlers/tables.js
index ad7395ca..c6e063e7 100644
--- a/src/main/ipc-handlers/tables.js
+++ b/src/main/ipc-handlers/tables.js
@@ -81,6 +81,8 @@ export default (connections) => {
escapedParam = `b'${sqlEscaper(params.content)}'`;
reload = true;
}
+ else if (params.content === null)
+ escapedParam = 'NULL';
else
escapedParam = `"${sqlEscaper(params.content)}"`;
diff --git a/src/renderer/components/WorkspaceQueryTable.vue b/src/renderer/components/WorkspaceQueryTable.vue
index 6082c367..eec2831c 100644
--- a/src/renderer/components/WorkspaceQueryTable.vue
+++ b/src/renderer/components/WorkspaceQueryTable.vue
@@ -9,6 +9,7 @@
:context-event="contextEvent"
:selected-rows="selectedRows"
@delete-selected="deleteSelected"
+ @set-null="setNull"
@close-context="isContext = false"
/>
@@ -315,6 +316,21 @@ export default {
};
this.$emit('delete-selected', params);
},
+ setNull () {
+ const row = this.localResults.find(row => this.selectedRows.includes(row._id));
+ delete row._id;
+
+ const params = {
+ primary: this.primaryField.name,
+ schema: this.getSchema(this.resultsetIndex),
+ table: this.getTable(this.resultsetIndex),
+ id: this.getPrimaryValue(row),
+ row,
+ field: this.selectedCell.field,
+ content: null
+ };
+ this.$emit('update-field', params);
+ },
applyUpdate (params) {
const { primary, id, field, table, content } = params;
diff --git a/src/renderer/components/WorkspaceQueryTableContext.vue b/src/renderer/components/WorkspaceQueryTableContext.vue
index 2599fa6c..cb3e6d46 100644
--- a/src/renderer/components/WorkspaceQueryTableContext.vue
+++ b/src/renderer/components/WorkspaceQueryTableContext.vue
@@ -3,8 +3,19 @@
:context-event="contextEvent"
@close-context="closeContext"
>
+
+
+ {{ $t('message.setNull') }}
+
+
- {{ $tc('message.deleteRows', selectedRows.length) }}
+
+ {{ $tc('message.deleteRows', selectedRows.length) }}
+
{
- acc.add(curr.table);
- acc.add(curr.schema);
+ acc.add(this.fields[curr].table);
+ acc.add(this.fields[curr].schema);
return acc;
}, new Set([]));
@@ -441,9 +441,6 @@ export default {
};
this.willBeDeleted = true;
},
- contextMenu (event, cell) {
- this.$emit('update-field', event, cell);
- },
selectRow (event, row) {
this.$emit('select-row', event, row);
},
@@ -452,6 +449,12 @@ export default {
return this.keyUsage.find(key => key.field === keyName.split('.').pop());
return this.keyUsage.find(key => key.field === keyName);
},
+ openContext (event, payload) {
+ if (this.isEditable) {
+ payload.field = this.fields[payload.field].name;// Ensures field name only
+ this.$emit('contextmenu', event, payload);
+ }
+ },
onKey (e) {
e.stopPropagation();
if (e.key === 'Escape') {
diff --git a/src/renderer/i18n/en-US.js b/src/renderer/i18n/en-US.js
index 71744225..05977fb0 100644
--- a/src/renderer/i18n/en-US.js
+++ b/src/renderer/i18n/en-US.js
@@ -192,7 +192,8 @@ module.exports = {
searchForElements: 'Search for elements',
selectAll: 'Select all',
queryDuration: 'Query duration',
- includeBetaUpdates: 'Include beta updates'
+ includeBetaUpdates: 'Include beta updates',
+ setNull: 'Set NULL'
},
faker: {
address: 'Address',