mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 13:46:00 +00:00
#182 support for MySQL binary keys
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
const { SqlDumper } = global.DBGATE_TOOLS;
|
||||
const { SqlDumper, toHexString } = global.DBGATE_TOOLS;
|
||||
const _isArray = require('lodash/isArray');
|
||||
|
||||
class Dumper extends SqlDumper {
|
||||
/** @param type {import('dbgate-types').TransformType} */
|
||||
@@ -63,6 +64,11 @@ class Dumper extends SqlDumper {
|
||||
selectTableIntoNewTable(sourceName, targetName) {
|
||||
this.putCmd('^create ^table %f (^select * ^from %f)', targetName, sourceName);
|
||||
}
|
||||
|
||||
putValue(value) {
|
||||
if (value.type == 'Buffer' && _isArray(value.data)) this.putRaw(`unhex('${toHexString(value.data)}')`);
|
||||
else super.putValue(value);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Dumper;
|
||||
|
||||
Reference in New Issue
Block a user