Browse Source

fix: isPg, isMysql calls

Signed-off-by: mertmit <mertmit99@gmail.com>
pull/4870/head
mertmit 2 years ago
parent
commit
b00b74933f
  1. 4
      packages/nc-gui/components/cell/MultiSelect.vue
  2. 4
      packages/nc-gui/components/cell/SingleSelect.vue
  3. 4
      packages/nc-gui/composables/useMultiSelect/index.ts

4
packages/nc-gui/components/cell/MultiSelect.vue

@ -224,7 +224,7 @@ async function addIfMissingAndSave() {
// todo: refactor and avoid repetition
if (updatedColMeta.cdf) {
// Postgres returns default value wrapped with single quotes & casted with type so we have to get value between single quotes to keep it unified for all databases
if (isPg.value) {
if (isPg(column.value.base_id)) {
updatedColMeta.cdf = updatedColMeta.cdf.substring(
updatedColMeta.cdf.indexOf(`'`) + 1,
updatedColMeta.cdf.lastIndexOf(`'`),
@ -232,7 +232,7 @@ async function addIfMissingAndSave() {
}
// Mysql escapes single quotes with backslash so we keep quotes but others have to unescaped
if (!isMysql.value) {
if (!isMysql(column.value.base_id)) {
updatedColMeta.cdf = updatedColMeta.cdf.replace(/''/g, "'")
}
}

4
packages/nc-gui/components/cell/SingleSelect.vue

@ -147,7 +147,7 @@ async function addIfMissingAndSave() {
// todo: refactor and avoid repetition
if (updatedColMeta.cdf) {
// Postgres returns default value wrapped with single quotes & casted with type so we have to get value between single quotes to keep it unified for all databases
if (isPg.value) {
if (isPg(column.value.base_id)) {
updatedColMeta.cdf = updatedColMeta.cdf.substring(
updatedColMeta.cdf.indexOf(`'`) + 1,
updatedColMeta.cdf.lastIndexOf(`'`),
@ -155,7 +155,7 @@ async function addIfMissingAndSave() {
}
// Mysql escapes single quotes with backslash so we keep quotes but others have to unescaped
if (!isMysql.value) {
if (!isMysql(column.value.base_id)) {
updatedColMeta.cdf = updatedColMeta.cdf.replace(/''/g, "'")
}
}

4
packages/nc-gui/composables/useMultiSelect/index.ts

@ -295,7 +295,7 @@ export function useMultiSelect(
from: clipboardContext.uidt,
to: columnObj.uidt as UITypes,
},
isMysql.value,
isMysql(meta.value?.base_id),
)
e.preventDefault()
@ -327,7 +327,7 @@ export function useMultiSelect(
from: clipboardContext.uidt,
to: columnObj.uidt as UITypes,
},
isMysql.value,
isMysql(meta.value?.base_id),
)
e.preventDefault()
syncCellData?.(activeCell)

Loading…
Cancel
Save