mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-03 14:03:57 +00:00
feat: pass dataType to bulk insert value put
This commit is contained in:
@@ -74,7 +74,16 @@ function createCassandraBulkInsertStream(driver, stream, dbhan, name, options) {
|
|||||||
dmp.putRaw('uuid()');
|
dmp.putRaw('uuid()');
|
||||||
dmp.putRaw(', ');
|
dmp.putRaw(', ');
|
||||||
}
|
}
|
||||||
dmp.putCollection(',', writable.columnNames, (col) => dmp.putValue(row[col]?.toString()));
|
dmp.putCollection(',', writable.columnNames, (col) => {
|
||||||
|
const existingColumn = getColumnInfo(writable.structure, col);
|
||||||
|
const dataType = existingColumn?.dataType;
|
||||||
|
|
||||||
|
if (dataType) {
|
||||||
|
dmp.putValue(row[col], dataType);
|
||||||
|
} else {
|
||||||
|
dmp.putValue(row[col]?.toString());
|
||||||
|
}
|
||||||
|
});
|
||||||
dmp.putRaw(')');
|
dmp.putRaw(')');
|
||||||
await driver.query(dbhan, dmp.s, { discardResult: true });
|
await driver.query(dbhan, dmp.s, { discardResult: true });
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user