bug: exportToJson: Error get tables 'Full' failed : Query result not well formatted
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- javascript, sqlite, swift
Hướng nghiên cứu
Bắt đầu với wrapper exportToJson của sqliteLoader.js và tái hiện lỗi trên iOS bằng schema users được cung cấp. Kiểm tra thiết lập createSyncTable và đường dẫn export iOS của plugin để tìm hiểu tại sao kết quả truy vấn Full bị từ chối; được xem là hoàn thành khi export các bảng sang JSON thành công đối với cơ sở dữ liệu này.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Plugin version:
7.0.1
Platform(s):
iOS
Current behavior:
exportToJson: Error get tables 'Full' failed : Query result not well formatted
Expected behavior:
Succeed in exporting tables to JSON
Steps to reproduce:
async exportToJson(mode = 'full') {
console.log('[ sqliteLoader.js ] Exporting database to JSON...');
return await sqlite.exportToJson({
database: DB_NAME,
jsonexportmode: mode
});
},
Related code:
Sample table:
CREATE TABLE IF NOT EXISTS users (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT,
lastName TEXT,
phoneNumber TEXT,
email TEXT,
sobrietyDate TEXT,
homeGroups TEXT,
preferences TEXT,
privacySettings TEXT,
notificationSettings TEXT, -- JSON string for notification preferences
createdAt TEXT DEFAULT CURRENT_TIMESTAMP,
updatedAt TEXT DEFAULT CURRENT_TIMESTAMP,
sql_deleted BOOLEAN DEFAULT 0 CHECK (sql_deleted IN (0, 1)),
last_modified INTEGER DEFAULT (strftime('%s', 'now'))
)
import { CapacitorSQLite } from '@capacitor-community/sqlite';
// Default database name for consistency
const DB_NAME = 'tracker.db';
/**
* Initialize SQLite database
* @returns {Promise<object>} Database connection object
*/
export default async function initSQLiteDatabase() {
console.log('[ sqliteLoader.js:14 ] Initializing SQLite database via Capacitor...');
try {
const sqlite = CapacitorSQLite;
if (!sqlite) {
throw new Error('CapacitorSQLite plugin not found - this app requires SQLite for iOS');
}
console.log('[ sqliteLoader.js ] Found CapacitorSQLite plugin:', !!sqlite);
// Step 1: Create connection (check if already exists first)
try {
await sqlite.createConnection({
database: DB_NAME,
version: 1,
encrypted: false,
mode: 'no-encryption',
readonly: false
});
console.log('[ sqliteLoader.js:50 ] Database connection created');
} catch (connectionError) {
console.log('[ sqliteLoader.js:52 ] Connection may already exist:', connectionError.message);
}
// Step 2: Open the database
await sqlite.open({ database: DB_NAME, readonly: false });
console.log('[ sqliteLoader.js:56 ] Database opened successfully');
// Step 3: Create sync table (required for CapacitorSQLite export/import operations)
await sqlite.createSyncTable({ database: DB_NAME });
console.log('[ sqliteLoader.js:58 ] Sync table created successfully');
// Sync methods for iCloud integration
async exportToJson(mode = 'full') {
console.log('[ sqliteLoader.js ] Exporting database to JSON...');
return await sqlite.exportToJson({
database: DB_NAME,
jsonexportmode: mode
});
},
async importFromJson(jsonData) {
console.log('[ sqliteLoader.js ] Importing database from JSON...');
return await sqlite.importFromJson({
jsonstring: JSON.stringify(jsonData)
});
},
async setSyncDate(syncDate) {
console.log('[ sqliteLoader.js ] Setting sync date...');
return await sqlite.setSyncDate({
database: DB_NAME,
syncdate: syncDate
});
},
async deleteExportedRows() {
console.log('[ sqliteLoader.js ] Deleting exported rows...');
return await sqlite.deleteExportedRows({
database: DB_NAME
});
}
};
} catch (error) {
console.error('[ sqliteLoader.js ] Database initialization failed:', error);
throw error;
}
}
Other information:
I have read through https://github.com/capacitor-community/sqlite/issues/59 and it is long-closed, but I am having this problem repeatedly and cannot find a fix for it.
Capacitor doctor:
% npx cap doctor
💊 Capacitor Doctor 💊
Latest Dependencies:
@capacitor/cli: 7.4.2
@capacitor/core: 7.4.2
@capacitor/android: 7.4.2
@capacitor/ios: 7.4.2
Installed Dependencies:
@capacitor/cli: 7.4.2
@capacitor/core: 7.4.2
@capacitor/android: 7.4.2
@capacitor/ios: 7.4.2
[success] iOS looking great! 👌
[error] gradlew file is missing in android
AndroidManifest.xml is missing in app/src/main
Expected, since I'm not currently working on Android.
- Ngôn ngữ chính
- Swift
- Star
- 663
- Fork
- 159
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của capacitor-community/sqlite
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
capacitor-community/sqlite#700 · 1 bình luận · 1 reaction ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
capacitor-community/sqlite#693 · 7 reaction ·
-
bug/fix needs: triage
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
capacitor-community/sqlite#690 ·
-
feature needs: triage
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
capacitor-community/sqlite#689 ·
-
bug/fix needs: triage
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
capacitor-community/sqlite#685 ·
Tất cả issue của capacitor-community/sqlite
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
permissionlesstech/bitchat#1743 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 70/100
521xueweihan/HelloGitHub#3816 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 65/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
jamesmontemagno/tiny-clips#378 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
图标看起来比其他应用小一圈Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100