@deepagents/text2sql 7.1.2 → 7.1.4
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/dist/index.js +358 -479
- package/dist/index.js.map +4 -4
- package/dist/lib/adapters/spreadsheet/index.js +14 -17
- package/dist/lib/adapters/spreadsheet/index.js.map +2 -2
- package/dist/lib/adapters/spreadsheet/spreadsheet.d.ts.map +1 -1
- package/dist/lib/fs/mssql/mssql-fs.d.ts.map +1 -1
- package/dist/lib/fs/mssql/sqlserver-schema-lock.d.ts +14 -0
- package/dist/lib/fs/mssql/sqlserver-schema-lock.d.ts.map +1 -0
- package/dist/lib/fs/postgres/postgres-fs.d.ts.map +1 -1
- package/dist/lib/fs/sqlite/sqlite-fs.d.ts.map +1 -1
- package/package.json +9 -8
|
@@ -1701,6 +1701,7 @@ function rowCount(config = {}) {
|
|
|
1701
1701
|
}
|
|
1702
1702
|
|
|
1703
1703
|
// packages/text2sql/src/lib/adapters/spreadsheet/spreadsheet.ts
|
|
1704
|
+
import { transaction } from "@zukhruf/sqlite-transaction";
|
|
1704
1705
|
import { DatabaseSync } from "node:sqlite";
|
|
1705
1706
|
|
|
1706
1707
|
// packages/text2sql/src/lib/adapters/spreadsheet/parser.ts
|
|
@@ -1877,23 +1878,19 @@ function loadData(db, sheet) {
|
|
|
1877
1878
|
const placeholders = sheet.columns.map(() => "?").join(", ");
|
|
1878
1879
|
const insertSQL = `INSERT INTO "${escapeIdentifier(sheet.name)}" (${columns}) VALUES (${placeholders})`;
|
|
1879
1880
|
const stmt = db.prepare(insertSQL);
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
const
|
|
1884
|
-
const
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
} catch {
|
|
1894
|
-
}
|
|
1895
|
-
throw error;
|
|
1896
|
-
}
|
|
1881
|
+
transaction(
|
|
1882
|
+
db,
|
|
1883
|
+
() => {
|
|
1884
|
+
for (const row of sheet.rows) {
|
|
1885
|
+
const values = sheet.columns.map((col) => {
|
|
1886
|
+
const rawValue = row[col.originalKey];
|
|
1887
|
+
return convertValue(rawValue, col.type);
|
|
1888
|
+
});
|
|
1889
|
+
stmt.run(...values);
|
|
1890
|
+
}
|
|
1891
|
+
},
|
|
1892
|
+
{ mode: "deferred" }
|
|
1893
|
+
);
|
|
1897
1894
|
}
|
|
1898
1895
|
function convertValue(value, type) {
|
|
1899
1896
|
if (value == null || value === "") {
|