Skip to content

Commit

Permalink
fix: support of bit fields in table filler
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabio286 committed Feb 18, 2021
1 parent 0142571 commit 94c4952
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/main/ipc-handlers/tables.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@ export default (connections) => {
else
escapedParam = '""';
}
else if (BIT.includes(type))
escapedParam = `b'${sqlEscaper(params.row[key].value)}'`;
else
escapedParam = `"${sqlEscaper(params.row[key].value)}"`;

Expand Down
2 changes: 2 additions & 0 deletions src/renderer/components/FakerSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ export default {
this.localType = 'datetime';
else if (TIME.includes(this.type))
this.localType = 'time';
else
this.localType = 'none';
return FakerMethods.getGroupsByType(this.localType);
},
Expand Down
5 changes: 4 additions & 1 deletion src/renderer/components/ModalFakerRows.vue
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@

<script>
import moment from 'moment';
import { TEXT, LONG_TEXT, NUMBER, FLOAT, DATE, TIME, DATETIME, BLOB } from 'common/fieldTypes';
import { TEXT, LONG_TEXT, NUMBER, FLOAT, DATE, TIME, DATETIME, BLOB, BIT } from 'common/fieldTypes';
import { mask } from 'vue-the-mask';
import { mapGetters, mapActions } from 'vuex';
import Tables from '@/ipc-api/Tables';
Expand Down Expand Up @@ -262,6 +262,9 @@ export default {
if ([...TIME, ...DATE].includes(field.type))
fieldDefault = field.default;
if (BIT.includes(field.type))
fieldDefault = field.default.replaceAll('\'', '').replaceAll('b', '');
if (DATETIME.includes(field.type)) {
if (field.default && field.default.toLowerCase().includes('current_timestamp')) {
let datePrecision = '';
Expand Down

0 comments on commit 94c4952

Please sign in to comment.