Browse Source

Merge pull request #4870 from nocodb/fix/base-type-checks

fix: isPg, isMysql calls
pull/4925/head
mertmit 2 years ago committed by GitHub
parent
commit
4f2c2d5c6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  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

@ -299,7 +299,7 @@ export function useMultiSelect(
from: clipboardContext.uidt,
to: columnObj.uidt as UITypes,
},
isMysql.value,
isMysql(meta.value?.base_id),
)
e.preventDefault()
@ -331,7 +331,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