@op-engineering/op-sqlite 15.2.0-beta.0 โ 15.2.1-beta.0
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/ios/sqlitevec.xcframework/ios-arm64/sqlitevec.framework/_CodeSignature/CodeResources +105 -0
- package/ios/sqlitevec.xcframework/ios-arm64/sqlitevec.framework/sqlitevec +0 -0
- package/ios/sqlitevec.xcframework/ios-arm64_x86_64-simulator/sqlitevec.framework/_CodeSignature/CodeResources +105 -0
- package/ios/sqlitevec.xcframework/ios-arm64_x86_64-simulator/sqlitevec.framework/sqlitevec +0 -0
- package/ios/sqlitevec.xcframework/tvos-arm64/sqlitevec.framework/_CodeSignature/CodeResources +101 -0
- package/ios/sqlitevec.xcframework/tvos-arm64/sqlitevec.framework/sqlitevec +0 -0
- package/ios/sqlitevec.xcframework/tvos-arm64_x86_64-simulator/sqlitevec.framework/_CodeSignature/CodeResources +101 -0
- package/ios/sqlitevec.xcframework/tvos-arm64_x86_64-simulator/sqlitevec.framework/sqlitevec +0 -0
- package/package.json +3 -1
- package/node/dist/database.d.ts +0 -53
- package/node/dist/database.d.ts.map +0 -1
- package/node/dist/database.js +0 -277
- package/node/dist/database.js.map +0 -1
- package/node/dist/example.d.ts +0 -2
- package/node/dist/example.d.ts.map +0 -1
- package/node/dist/example.js +0 -145
- package/node/dist/example.js.map +0 -1
- package/node/dist/index.d.ts +0 -42
- package/node/dist/index.d.ts.map +0 -1
- package/node/dist/index.js +0 -47
- package/node/dist/index.js.map +0 -1
- package/node/dist/test.d.ts +0 -2
- package/node/dist/test.d.ts.map +0 -1
- package/node/dist/test.js +0 -196
- package/node/dist/test.js.map +0 -1
- package/node/dist/test.spec.d.ts +0 -2
- package/node/dist/test.spec.d.ts.map +0 -1
- package/node/dist/test.spec.js +0 -145
- package/node/dist/test.spec.js.map +0 -1
- package/node/dist/types.d.ts +0 -102
- package/node/dist/types.d.ts.map +0 -1
- package/node/dist/types.js +0 -2
- package/node/dist/types.js.map +0 -1
package/node/dist/database.js
DELETED
|
@@ -1,277 +0,0 @@
|
|
|
1
|
-
import * as fs from 'node:fs';
|
|
2
|
-
import * as path from 'node:path';
|
|
3
|
-
import Database from 'better-sqlite3';
|
|
4
|
-
export class NodeDatabase {
|
|
5
|
-
constructor(name, location) {
|
|
6
|
-
const dbLocation = location || './';
|
|
7
|
-
this.dbPath = path.join(dbLocation, name);
|
|
8
|
-
// Ensure directory exists
|
|
9
|
-
const dir = path.dirname(this.dbPath);
|
|
10
|
-
if (!fs.existsSync(dir)) {
|
|
11
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
12
|
-
}
|
|
13
|
-
this.db = new Database(this.dbPath);
|
|
14
|
-
this.setupHooks();
|
|
15
|
-
}
|
|
16
|
-
setupHooks() {
|
|
17
|
-
// Setup update hook if needed
|
|
18
|
-
// if (this.db.function) {
|
|
19
|
-
// Note: better-sqlite3 doesn't have direct update hook support
|
|
20
|
-
// This is a limitation compared to the native implementation
|
|
21
|
-
// }
|
|
22
|
-
}
|
|
23
|
-
convertParams(params) {
|
|
24
|
-
if (!params)
|
|
25
|
-
return undefined;
|
|
26
|
-
return params.map(param => {
|
|
27
|
-
if (param instanceof ArrayBuffer) {
|
|
28
|
-
return Buffer.from(param);
|
|
29
|
-
}
|
|
30
|
-
else if (ArrayBuffer.isView(param)) {
|
|
31
|
-
return Buffer.from(param.buffer, param.byteOffset, param.byteLength);
|
|
32
|
-
}
|
|
33
|
-
return param;
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
convertRows(stmt, rows) {
|
|
37
|
-
const columnNames = stmt.columns().map(col => col.name);
|
|
38
|
-
const metadata = stmt.columns().map((col, index) => ({
|
|
39
|
-
name: col.name,
|
|
40
|
-
type: col.type || 'UNKNOWN',
|
|
41
|
-
index,
|
|
42
|
-
}));
|
|
43
|
-
return {
|
|
44
|
-
rowsAffected: 0,
|
|
45
|
-
rows: rows,
|
|
46
|
-
columnNames,
|
|
47
|
-
metadata,
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
executeSync(query, params) {
|
|
51
|
-
try {
|
|
52
|
-
const convertedParams = this.convertParams(params);
|
|
53
|
-
const stmt = this.db.prepare(query);
|
|
54
|
-
// Check if it's a SELECT query
|
|
55
|
-
const isSelect = query.trim().toUpperCase().startsWith('SELECT');
|
|
56
|
-
if (isSelect) {
|
|
57
|
-
const rows = convertedParams
|
|
58
|
-
? stmt.all(...convertedParams)
|
|
59
|
-
: stmt.all();
|
|
60
|
-
return this.convertRows(stmt, rows);
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
const info = convertedParams
|
|
64
|
-
? stmt.run(...convertedParams)
|
|
65
|
-
: stmt.run();
|
|
66
|
-
return {
|
|
67
|
-
rowsAffected: info.changes,
|
|
68
|
-
insertId: info.lastInsertRowid,
|
|
69
|
-
rows: [],
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
catch (error) {
|
|
74
|
-
throw new Error(`SQL Error: ${error.message}`);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
async execute(query, params) {
|
|
78
|
-
return Promise.resolve(this.executeSync(query, params));
|
|
79
|
-
}
|
|
80
|
-
async executeWithHostObjects(query, params) {
|
|
81
|
-
// For Node.js, this is the same as execute since we don't have HostObjects
|
|
82
|
-
return this.execute(query, params);
|
|
83
|
-
}
|
|
84
|
-
executeRawSync(query, params) {
|
|
85
|
-
try {
|
|
86
|
-
const convertedParams = this.convertParams(params);
|
|
87
|
-
const stmt = this.db.prepare(query);
|
|
88
|
-
const rows = convertedParams
|
|
89
|
-
? stmt.raw().all(...convertedParams)
|
|
90
|
-
: stmt.raw().all();
|
|
91
|
-
return rows;
|
|
92
|
-
}
|
|
93
|
-
catch (error) {
|
|
94
|
-
throw new Error(`SQL Error: ${error.message}`);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
async executeRaw(query, params) {
|
|
98
|
-
return Promise.resolve(this.executeRawSync(query, params));
|
|
99
|
-
}
|
|
100
|
-
async executeBatch(commands) {
|
|
101
|
-
let totalRowsAffected = 0;
|
|
102
|
-
const transaction = this.db.transaction(() => {
|
|
103
|
-
for (const command of commands) {
|
|
104
|
-
const [query, params] = command;
|
|
105
|
-
if (Array.isArray(params) && params.length > 0 && Array.isArray(params[0])) {
|
|
106
|
-
// Multiple parameter sets
|
|
107
|
-
const stmt = this.db.prepare(query);
|
|
108
|
-
for (const paramSet of params) {
|
|
109
|
-
const converted = this.convertParams(paramSet);
|
|
110
|
-
const info = converted ? stmt.run(...converted) : stmt.run();
|
|
111
|
-
totalRowsAffected += info.changes;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
// Single parameter set or no parameters
|
|
116
|
-
const converted = this.convertParams(params);
|
|
117
|
-
const stmt = this.db.prepare(query);
|
|
118
|
-
const info = converted ? stmt.run(...converted) : stmt.run();
|
|
119
|
-
totalRowsAffected += info.changes;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
transaction();
|
|
124
|
-
return { rowsAffected: totalRowsAffected };
|
|
125
|
-
}
|
|
126
|
-
async loadFile(location) {
|
|
127
|
-
const fileContent = fs.readFileSync(location, 'utf-8');
|
|
128
|
-
const statements = fileContent
|
|
129
|
-
.split(';')
|
|
130
|
-
.map(s => s.trim())
|
|
131
|
-
.filter(s => s.length > 0);
|
|
132
|
-
let totalRowsAffected = 0;
|
|
133
|
-
let commandCount = 0;
|
|
134
|
-
const transaction = this.db.transaction(() => {
|
|
135
|
-
for (const statement of statements) {
|
|
136
|
-
const info = this.db.prepare(statement).run();
|
|
137
|
-
totalRowsAffected += info.changes;
|
|
138
|
-
commandCount++;
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
transaction();
|
|
142
|
-
return {
|
|
143
|
-
rowsAffected: totalRowsAffected,
|
|
144
|
-
commands: commandCount,
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
async transaction(fn) {
|
|
148
|
-
const transaction = {
|
|
149
|
-
execute: async (query, params) => {
|
|
150
|
-
return this.execute(query, params);
|
|
151
|
-
},
|
|
152
|
-
commit: async () => {
|
|
153
|
-
return { rowsAffected: 0, rows: [] };
|
|
154
|
-
},
|
|
155
|
-
rollback: () => {
|
|
156
|
-
throw new Error('ROLLBACK');
|
|
157
|
-
},
|
|
158
|
-
};
|
|
159
|
-
// Manually control transaction with BEGIN/COMMIT/ROLLBACK to support async operations
|
|
160
|
-
this.executeSync('BEGIN TRANSACTION');
|
|
161
|
-
try {
|
|
162
|
-
await fn(transaction);
|
|
163
|
-
this.executeSync('COMMIT');
|
|
164
|
-
if (this.commitHookCallback) {
|
|
165
|
-
this.commitHookCallback();
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
catch (error) {
|
|
169
|
-
this.executeSync('ROLLBACK');
|
|
170
|
-
if (this.rollbackHookCallback) {
|
|
171
|
-
this.rollbackHookCallback();
|
|
172
|
-
}
|
|
173
|
-
throw error;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
prepareStatement(query) {
|
|
177
|
-
const stmt = this.db.prepare(query);
|
|
178
|
-
let boundParams = [];
|
|
179
|
-
return {
|
|
180
|
-
bindSync: (params) => {
|
|
181
|
-
boundParams = this.convertParams(params) || [];
|
|
182
|
-
},
|
|
183
|
-
bind: async (params) => {
|
|
184
|
-
boundParams = this.convertParams(params) || [];
|
|
185
|
-
},
|
|
186
|
-
execute: async () => {
|
|
187
|
-
const isSelect = query.trim().toUpperCase().startsWith('SELECT');
|
|
188
|
-
if (isSelect) {
|
|
189
|
-
const rows = boundParams.length > 0
|
|
190
|
-
? stmt.all(...boundParams)
|
|
191
|
-
: stmt.all();
|
|
192
|
-
return this.convertRows(stmt, rows);
|
|
193
|
-
}
|
|
194
|
-
else {
|
|
195
|
-
const info = boundParams.length > 0
|
|
196
|
-
? stmt.run(...boundParams)
|
|
197
|
-
: stmt.run();
|
|
198
|
-
return {
|
|
199
|
-
rowsAffected: info.changes,
|
|
200
|
-
insertId: info.lastInsertRowid,
|
|
201
|
-
rows: [],
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
|
-
},
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
attach(params) {
|
|
208
|
-
const dbLocation = params.location || './';
|
|
209
|
-
const dbPath = path.join(dbLocation, params.secondaryDbFileName);
|
|
210
|
-
this.db.prepare(`ATTACH DATABASE ? AS ?`).run(dbPath, params.alias);
|
|
211
|
-
}
|
|
212
|
-
detach(alias) {
|
|
213
|
-
this.db.prepare(`DETACH DATABASE ?`).run(alias);
|
|
214
|
-
}
|
|
215
|
-
updateHook(callback) {
|
|
216
|
-
this.updateHookCallback = callback;
|
|
217
|
-
// Note: better-sqlite3 doesn't support update hooks directly
|
|
218
|
-
console.warn('Update hooks are not fully supported in the Node.js implementation');
|
|
219
|
-
}
|
|
220
|
-
commitHook(callback) {
|
|
221
|
-
this.commitHookCallback = callback;
|
|
222
|
-
}
|
|
223
|
-
rollbackHook(callback) {
|
|
224
|
-
this.rollbackHookCallback = callback;
|
|
225
|
-
}
|
|
226
|
-
loadExtension(path, entryPoint) {
|
|
227
|
-
// better-sqlite3 supports loadExtension but it may not be enabled by default
|
|
228
|
-
try {
|
|
229
|
-
if (entryPoint) {
|
|
230
|
-
this.db.loadExtension(path, entryPoint);
|
|
231
|
-
}
|
|
232
|
-
else {
|
|
233
|
-
this.db.loadExtension(path);
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
catch (error) {
|
|
237
|
-
throw new Error(`Failed to load extension: ${error.message}`);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
getDbPath(location) {
|
|
241
|
-
return this.dbPath;
|
|
242
|
-
}
|
|
243
|
-
reactiveExecute(params) {
|
|
244
|
-
// Reactive queries are not supported in Node.js implementation
|
|
245
|
-
console.warn('Reactive queries are not supported in the Node.js implementation');
|
|
246
|
-
return () => { };
|
|
247
|
-
}
|
|
248
|
-
sync() {
|
|
249
|
-
// LibSQL sync is not supported in the Node.js implementation
|
|
250
|
-
throw new Error('sync() is only available with libsql');
|
|
251
|
-
}
|
|
252
|
-
setReservedBytes(reservedBytes) {
|
|
253
|
-
// SQLCipher specific, not supported in standard SQLite
|
|
254
|
-
console.warn('setReservedBytes is not supported in the Node.js implementation');
|
|
255
|
-
}
|
|
256
|
-
getReservedBytes() {
|
|
257
|
-
// SQLCipher specific, not supported in standard SQLite
|
|
258
|
-
return 0;
|
|
259
|
-
}
|
|
260
|
-
async flushPendingReactiveQueries() {
|
|
261
|
-
// No-op for Node.js implementation
|
|
262
|
-
}
|
|
263
|
-
close() {
|
|
264
|
-
if (this.db && this.db.open) {
|
|
265
|
-
this.db.close();
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
delete(location) {
|
|
269
|
-
this.close();
|
|
270
|
-
const dbLocation = location || './';
|
|
271
|
-
const dbPath = path.join(dbLocation, path.basename(this.dbPath));
|
|
272
|
-
if (fs.existsSync(dbPath)) {
|
|
273
|
-
fs.unlinkSync(dbPath);
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
//# sourceMappingURL=database.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"database.js","sourceRoot":"","sources":["../src/database.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AActC,MAAM,OAAO,YAAY;IAYvB,YAAY,IAAY,EAAE,QAAiB;QACzC,MAAM,UAAU,GAAG,QAAQ,IAAI,IAAI,CAAC;QACpC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QAE1C,0BAA0B;QAC1B,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAA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,CAAC,MAAM,CAAC,CAAC;QACxB,CAAC;IACH,CAAC;CACF"}
|
package/node/dist/example.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"example.d.ts","sourceRoot":"","sources":["../src/example.ts"],"names":[],"mappings":""}
|
package/node/dist/example.js
DELETED
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import { open } from './src/index.js';
|
|
2
|
-
async function main() {
|
|
3
|
-
console.log('๐ Starting op-sqlite Node.js example...\n');
|
|
4
|
-
// Open a database
|
|
5
|
-
const db = open({
|
|
6
|
-
name: 'example.sqlite',
|
|
7
|
-
location: './',
|
|
8
|
-
});
|
|
9
|
-
console.log('โ
Database opened at:', db.getDbPath());
|
|
10
|
-
// Create a table
|
|
11
|
-
console.log('\n๐ Creating users table...');
|
|
12
|
-
db.executeSync(`
|
|
13
|
-
CREATE TABLE IF NOT EXISTS users (
|
|
14
|
-
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
15
|
-
name TEXT NOT NULL,
|
|
16
|
-
email TEXT UNIQUE NOT NULL,
|
|
17
|
-
age INTEGER,
|
|
18
|
-
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
|
19
|
-
)
|
|
20
|
-
`);
|
|
21
|
-
// Insert some data using a transaction
|
|
22
|
-
console.log('๐ Inserting users...');
|
|
23
|
-
await db.transaction(async (tx) => {
|
|
24
|
-
await tx.execute('INSERT INTO users (name, email, age) VALUES (?, ?, ?)', [
|
|
25
|
-
'Alice Johnson',
|
|
26
|
-
'alice@example.com',
|
|
27
|
-
28,
|
|
28
|
-
]);
|
|
29
|
-
await tx.execute('INSERT INTO users (name, email, age) VALUES (?, ?, ?)', [
|
|
30
|
-
'Bob Smith',
|
|
31
|
-
'bob@example.com',
|
|
32
|
-
35,
|
|
33
|
-
]);
|
|
34
|
-
await tx.execute('INSERT INTO users (name, email, age) VALUES (?, ?, ?)', [
|
|
35
|
-
'Charlie Brown',
|
|
36
|
-
'charlie@example.com',
|
|
37
|
-
42,
|
|
38
|
-
]);
|
|
39
|
-
});
|
|
40
|
-
// Query data synchronously
|
|
41
|
-
console.log('\n๐ Querying all users (sync):');
|
|
42
|
-
const allUsers = db.executeSync('SELECT * FROM users ORDER BY id');
|
|
43
|
-
console.log(`Found ${allUsers.rows.length} users:`);
|
|
44
|
-
allUsers.rows.forEach((user) => {
|
|
45
|
-
console.log(` - ${user.name} (${user.email}), Age: ${user.age}`);
|
|
46
|
-
});
|
|
47
|
-
// Query with parameters
|
|
48
|
-
console.log('\n๐ Querying users older than 30:');
|
|
49
|
-
const olderUsers = await db.execute('SELECT * FROM users WHERE age > ? ORDER BY age DESC', [30]);
|
|
50
|
-
olderUsers.rows.forEach((user) => {
|
|
51
|
-
console.log(` - ${user.name}, Age: ${user.age}`);
|
|
52
|
-
});
|
|
53
|
-
// Use prepared statement for multiple queries
|
|
54
|
-
console.log('\n๐ Using prepared statement:');
|
|
55
|
-
const stmt = db.prepareStatement('SELECT * FROM users WHERE age >= ?');
|
|
56
|
-
stmt.bindSync([30]);
|
|
57
|
-
const result1 = await stmt.execute();
|
|
58
|
-
console.log(`Users age >= 30: ${result1.rows.length}`);
|
|
59
|
-
stmt.bindSync([40]);
|
|
60
|
-
const result2 = await stmt.execute();
|
|
61
|
-
console.log(`Users age >= 40: ${result2.rows.length}`);
|
|
62
|
-
// Execute batch operations
|
|
63
|
-
console.log('\n๐ Batch inserting more users...');
|
|
64
|
-
await db.executeBatch([
|
|
65
|
-
[
|
|
66
|
-
'INSERT INTO users (name, email, age) VALUES (?, ?, ?)',
|
|
67
|
-
['David Lee', 'david@example.com', 31],
|
|
68
|
-
],
|
|
69
|
-
[
|
|
70
|
-
'INSERT INTO users (name, email, age) VALUES (?, ?, ?)',
|
|
71
|
-
['Emma Wilson', 'emma@example.com', 26],
|
|
72
|
-
],
|
|
73
|
-
[
|
|
74
|
-
'INSERT INTO users (name, email, age) VALUES (?, ?, ?)',
|
|
75
|
-
['Frank Miller', 'frank@example.com', 45],
|
|
76
|
-
],
|
|
77
|
-
]);
|
|
78
|
-
// Get raw results (faster for large datasets)
|
|
79
|
-
console.log('\n๐ Getting raw results:');
|
|
80
|
-
const rawResults = db.executeRawSync('SELECT name, age FROM users WHERE age > 30 ORDER BY age');
|
|
81
|
-
console.log('Raw results (array of arrays):');
|
|
82
|
-
rawResults.forEach((row) => {
|
|
83
|
-
console.log(` - ${row[0]}, Age: ${row[1]}`);
|
|
84
|
-
});
|
|
85
|
-
// Show metadata
|
|
86
|
-
console.log('\n๐ Query metadata:');
|
|
87
|
-
const metadataResult = db.executeSync('SELECT * FROM users LIMIT 1');
|
|
88
|
-
if (metadataResult.metadata) {
|
|
89
|
-
console.log('Columns:');
|
|
90
|
-
metadataResult.metadata.forEach((col) => {
|
|
91
|
-
console.log(` - ${col.name} (${col.type})`);
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
// Update example
|
|
95
|
-
console.log('\nโ๏ธ Updating user...');
|
|
96
|
-
const updateResult = db.executeSync('UPDATE users SET age = ? WHERE email = ?', [29, 'alice@example.com']);
|
|
97
|
-
console.log(`Rows affected: ${updateResult.rowsAffected}`);
|
|
98
|
-
// Delete example
|
|
99
|
-
console.log('\n๐๏ธ Deleting user...');
|
|
100
|
-
const deleteResult = db.executeSync('DELETE FROM users WHERE email = ?', [
|
|
101
|
-
'frank@example.com',
|
|
102
|
-
]);
|
|
103
|
-
console.log(`Rows affected: ${deleteResult.rowsAffected}`);
|
|
104
|
-
// Final count
|
|
105
|
-
const countResult = db.executeSync('SELECT COUNT(*) as count FROM users');
|
|
106
|
-
console.log(`\n๐ Total users remaining: ${countResult.rows[0].count}`);
|
|
107
|
-
// Create a secondary database and attach it
|
|
108
|
-
console.log('\n๐ Testing database attachment...');
|
|
109
|
-
const db2 = open({
|
|
110
|
-
name: 'example2.sqlite',
|
|
111
|
-
location: './',
|
|
112
|
-
});
|
|
113
|
-
db2.executeSync('CREATE TABLE IF NOT EXISTS products (id INTEGER PRIMARY KEY, name TEXT)');
|
|
114
|
-
db2.executeSync('INSERT INTO products (name) VALUES (?)', ['Laptop']);
|
|
115
|
-
db2.close();
|
|
116
|
-
db.attach({
|
|
117
|
-
secondaryDbFileName: 'example2.sqlite',
|
|
118
|
-
alias: 'secondary',
|
|
119
|
-
location: './',
|
|
120
|
-
});
|
|
121
|
-
const attachedResult = db.executeSync('SELECT * FROM secondary.products');
|
|
122
|
-
console.log(`Products from attached db: ${attachedResult.rows.length}`);
|
|
123
|
-
attachedResult.rows.forEach((product) => {
|
|
124
|
-
console.log(` - ${product.name}`);
|
|
125
|
-
});
|
|
126
|
-
db.detach('secondary');
|
|
127
|
-
console.log('โ
Database detached');
|
|
128
|
-
// Clean up
|
|
129
|
-
console.log('\n๐งน Cleaning up...');
|
|
130
|
-
db.close();
|
|
131
|
-
console.log('โ
Database closed');
|
|
132
|
-
// Delete the example databases
|
|
133
|
-
const db3 = open({ name: 'example.sqlite', location: './' });
|
|
134
|
-
db3.delete('./');
|
|
135
|
-
console.log('โ
example.sqlite deleted');
|
|
136
|
-
const db4 = open({ name: 'example2.sqlite', location: './' });
|
|
137
|
-
db4.delete('./');
|
|
138
|
-
console.log('โ
example2.sqlite deleted');
|
|
139
|
-
console.log('\n๐ Example completed successfully!');
|
|
140
|
-
}
|
|
141
|
-
main().catch((error) => {
|
|
142
|
-
console.error('โ Error:', error);
|
|
143
|
-
process.exit(1);
|
|
144
|
-
});
|
|
145
|
-
//# sourceMappingURL=example.js.map
|
package/node/dist/example.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"example.js","sourceRoot":"","sources":["../src/example.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,KAAK,UAAU,IAAI;IACjB,OAAO,CAAC,GAAG,CAAC,4CAA4C,CAAC,CAAC;IAE1D,kBAAkB;IAClB,MAAM,EAAE,GAAG,IAAI,CAAC;QACd,IAAI,EAAE,gBAAgB;Q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AAI,CAAC,EAAE,IAAI,EAAE,gBAAgB,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7D,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACjB,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;IAExC,MAAM,GAAG,GAAG,IAAI,CAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9D,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACjB,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;IAEzC,OAAO,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC;AACtD,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IACjC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/node/dist/index.d.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { DB, DBParams, OPSQLiteProxy } from './types';
|
|
2
|
-
export { NodeDatabase as Database } from './database';
|
|
3
|
-
export type { BatchQueryResult, ColumnMetadata, DB, DBParams, FileLoadResult, OPSQLiteProxy, PreparedStatement, QueryResult, Scalar, SQLBatchTuple, Transaction, UpdateHookOperation } from './types';
|
|
4
|
-
declare class OPSQLiteProxyImpl implements OPSQLiteProxy {
|
|
5
|
-
open(options: {
|
|
6
|
-
name: string;
|
|
7
|
-
location?: string;
|
|
8
|
-
encryptionKey?: string;
|
|
9
|
-
}): DB;
|
|
10
|
-
openV2(options: {
|
|
11
|
-
path: string;
|
|
12
|
-
encryptionKey?: string;
|
|
13
|
-
}): DB;
|
|
14
|
-
openRemote(options: {
|
|
15
|
-
url: string;
|
|
16
|
-
authToken: string;
|
|
17
|
-
}): DB;
|
|
18
|
-
openSync(options: DBParams): DB;
|
|
19
|
-
isSQLCipher(): boolean;
|
|
20
|
-
isLibsql(): boolean;
|
|
21
|
-
isIOSEmbedded(): boolean;
|
|
22
|
-
}
|
|
23
|
-
declare const proxy: OPSQLiteProxyImpl;
|
|
24
|
-
export declare const open: (options: {
|
|
25
|
-
name: string;
|
|
26
|
-
location?: string;
|
|
27
|
-
encryptionKey?: string;
|
|
28
|
-
}) => DB;
|
|
29
|
-
export declare const openV2: (options: {
|
|
30
|
-
path: string;
|
|
31
|
-
encryptionKey?: string;
|
|
32
|
-
}) => DB;
|
|
33
|
-
export declare const openRemote: (options: {
|
|
34
|
-
url: string;
|
|
35
|
-
authToken: string;
|
|
36
|
-
}) => DB;
|
|
37
|
-
export declare const openSync: (options: DBParams) => DB;
|
|
38
|
-
export declare const isSQLCipher: () => boolean;
|
|
39
|
-
export declare const isLibsql: () => boolean;
|
|
40
|
-
export declare const isIOSEmbedded: () => boolean;
|
|
41
|
-
export default proxy;
|
|
42
|
-
//# sourceMappingURL=index.d.ts.map
|
package/node/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE3D,OAAO,EAAE,YAAY,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtD,YAAY,EACR,gBAAgB,EAAE,cAAc,EAAE,EAAE,EACpC,QAAQ,EAAE,cAAc,EAAE,aAAa,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,mBAAmB,EACnI,MAAM,SAAS,CAAC;AAEjB,cAAM,iBAAkB,YAAW,aAAa;IAC9C,IAAI,CAAC,OAAO,EAAE;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,aAAa,CAAC,EAAE,MAAM,CAAC;KACxB,GAAG,EAAE;IASN,MAAM,CAAC,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,EAAE;IAY7D,UAAU,CAAC,OAAO,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,GAAG,EAAE;IAM3D,QAAQ,CAAC,OAAO,EAAE,QAAQ,GAAG,EAAE;IAM/B,WAAW,IAAI,OAAO;IAItB,QAAQ,IAAI,OAAO;IAInB,aAAa,IAAI,OAAO;CAGzB;AAGD,QAAA,MAAM,KAAK,mBAA0B,CAAC;AAGtC,eAAO,MAAM,IAAI,YAtDD;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,KAAG,EAkDoC,CAAC;AAC3C,eAAO,MAAM,MAAM,YA1CD;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,KAAG,EA0Cf,CAAC;AAC/C,eAAO,MAAM,UAAU,YA/BD;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,KAAG,EA+BL,CAAC;AACvD,eAAO,MAAM,QAAQ,YA1BD,QAAQ,KAAG,EA0BmB,CAAC;AACnD,eAAO,MAAM,WAAW,QArBP,OAqBuC,CAAC;AACzD,eAAO,MAAM,QAAQ,QAlBP,OAkBoC,CAAC;AACnD,eAAO,MAAM,aAAa,QAfP,OAeyC,CAAC;AAG7D,eAAe,KAAK,CAAC"}
|
package/node/dist/index.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import * as path from 'node:path';
|
|
2
|
-
import { NodeDatabase } from './database';
|
|
3
|
-
export { NodeDatabase as Database } from './database';
|
|
4
|
-
class OPSQLiteProxyImpl {
|
|
5
|
-
open(options) {
|
|
6
|
-
if (options.encryptionKey) {
|
|
7
|
-
console.warn('Encryption is not supported in the Node.js implementation. Use @journeyapps/sqlcipher for encryption support.');
|
|
8
|
-
}
|
|
9
|
-
return new NodeDatabase(options.name, options.location);
|
|
10
|
-
}
|
|
11
|
-
openV2(options) {
|
|
12
|
-
if (options.encryptionKey) {
|
|
13
|
-
console.warn('Encryption is not supported in the Node.js implementation. Use @journeyapps/sqlcipher for encryption support.');
|
|
14
|
-
}
|
|
15
|
-
const dir = path.dirname(options.path);
|
|
16
|
-
const name = path.basename(options.path);
|
|
17
|
-
return new NodeDatabase(name, dir);
|
|
18
|
-
}
|
|
19
|
-
openRemote(options) {
|
|
20
|
-
throw new Error('openRemote is not supported in the Node.js implementation. Use the libsql client directly for remote connections.');
|
|
21
|
-
}
|
|
22
|
-
openSync(options) {
|
|
23
|
-
throw new Error('openSync is not supported in the Node.js implementation. Use the libsql client directly for sync functionality.');
|
|
24
|
-
}
|
|
25
|
-
isSQLCipher() {
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
28
|
-
isLibsql() {
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
isIOSEmbedded() {
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
// Create singleton instance
|
|
36
|
-
const proxy = new OPSQLiteProxyImpl();
|
|
37
|
-
// Export proxy functions for easier usage
|
|
38
|
-
export const open = proxy.open.bind(proxy);
|
|
39
|
-
export const openV2 = proxy.openV2.bind(proxy);
|
|
40
|
-
export const openRemote = proxy.openRemote.bind(proxy);
|
|
41
|
-
export const openSync = proxy.openSync.bind(proxy);
|
|
42
|
-
export const isSQLCipher = proxy.isSQLCipher.bind(proxy);
|
|
43
|
-
export const isLibsql = proxy.isLibsql.bind(proxy);
|
|
44
|
-
export const isIOSEmbedded = proxy.isIOSEmbedded.bind(proxy);
|
|
45
|
-
// Default export
|
|
46
|
-
export default proxy;
|
|
47
|
-
//# sourceMappingURL=index.js.map
|
package/node/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG1C,OAAO,EAAE,YAAY,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AAMtD,MAAM,iBAAiB;IACrB,IAAI,CAAC,OAIJ;QACC,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;YAC1B,OAAO,CAAC,IAAI,CACV,+GAA+G,CAChH,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,YAAY,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC1D,CAAC;IAED,MAAM,CAAC,OAAiD;QACtD,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;YAC1B,OAAO,CAAC,IAAI,CACV,+GAA+G,CAChH,CAAC;QACJ,CAAC;QAED,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACvC,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACzC,OAAO,IAAI,YAAY,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IACrC,CAAC;IAED,UAAU,CAAC,OAA2C;QACpD,MAAM,IAAI,KAAK,CACb,mHAAmH,CACpH,CAAC;IACJ,CAAC;IAED,QAAQ,CAAC,OAAiB;QACxB,MAAM,IAAI,KAAK,CACb,iHAAiH,CAClH,CAAC;IACJ,CAAC;IAED,WAAW;QACT,OAAO,KAAK,CAAC;IACf,CAAC;IAED,QAAQ;QACN,OAAO,KAAK,CAAC;IACf,CAAC;IAED,aAAa;QACX,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAED,4BAA4B;AAC5B,MAAM,KAAK,GAAG,IAAI,iBAAiB,EAAE,CAAC;AAEtC,0CAA0C;AAC1C,MAAM,CAAC,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC3C,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC/C,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACvD,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACnD,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACzD,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACnD,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAE7D,iBAAiB;AACjB,eAAe,KAAK,CAAC"}
|
package/node/dist/test.d.ts
DELETED
package/node/dist/test.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../src/test.ts"],"names":[],"mappings":""}
|