@rip-lang/db 1.3.4 → 1.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/duckdb.mjs +15 -1
- package/package.json +1 -1
package/lib/duckdb.mjs
CHANGED
|
@@ -103,7 +103,9 @@ const lib = dlopen(libPath, {
|
|
|
103
103
|
duckdb_append_int64: { args: ['ptr', 'i64'], returns: 'i32' },
|
|
104
104
|
duckdb_append_double: { args: ['ptr', 'f64'], returns: 'i32' },
|
|
105
105
|
duckdb_append_varchar: { args: ['ptr', 'ptr'], returns: 'i32' },
|
|
106
|
-
duckdb_append_null:
|
|
106
|
+
duckdb_append_null: { args: ['ptr'], returns: 'i32' },
|
|
107
|
+
duckdb_appender_add_column: { args: ['ptr', 'ptr'], returns: 'i32' },
|
|
108
|
+
duckdb_appender_clear_columns: { args: ['ptr'], returns: 'i32' },
|
|
107
109
|
|
|
108
110
|
// Result inspection
|
|
109
111
|
duckdb_column_count: { args: ['ptr'], returns: 'u64' },
|
|
@@ -846,6 +848,18 @@ class Connection {
|
|
|
846
848
|
const appenderHandle = readPtr(appenderPtr);
|
|
847
849
|
|
|
848
850
|
try {
|
|
851
|
+
if (columns && columns.length > 0) {
|
|
852
|
+
lib.duckdb_appender_clear_columns(appenderHandle);
|
|
853
|
+
for (const col of columns) {
|
|
854
|
+
const colBytes = toCString(col);
|
|
855
|
+
const addStatus = lib.duckdb_appender_add_column(appenderHandle, ptr(colBytes));
|
|
856
|
+
if (addStatus !== 0) {
|
|
857
|
+
const errPtr = lib.duckdb_appender_error(appenderHandle);
|
|
858
|
+
throw new Error(errPtr ? fromCString(errPtr) : `Failed to add column: ${col}`);
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
|
|
849
863
|
for (const row of rows) {
|
|
850
864
|
for (const value of row) {
|
|
851
865
|
this.#appendValue(appenderHandle, value);
|