bug: Select * returns {"changes":{"changes":0}}
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
- 28/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- ios, javascript, sqlite
- Lĩnh vực
- databases, mobile-dev
Hướng nghiên cứu
Bắt đầu bằng cách chạy bản tái hiện iOS được cung cấp và theo dõi các lệnh gọi db.execute cho CREATE, INSERT và SELECT. So sánh phản hồi từ truy vấn SELECT với hàng sản phẩm mong đợi; công việc được hoàn tất khi đường dẫn thực thi được ghi trong tài liệu trả về dữ liệu đã chọn thay vì chỉ một đối tượng changes.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Plugin version:
@capacitor-community/sqlite: ^6.0.2
Platform(s):
iOS
Current behavior:
Using Vue2 with capacitor and @capacitor-community/sqlite I can create a sqlite db, connect to it and insert data to it, receiving a
{"changes":{"changes":1}} log that my row inserted, by following examples and documentation - thank you.
When I try to select * to retrieve the row it returns {"changes":{"changes":0}} though. Can you please explain what I'm doing wrong? I've even resorted to putting the select statement into a 9000ms timeout which runs after the insert statement finishes (using await)....
Expected behavior:
Steps to reproduce:
const platform = Capacitor.getPlatform();
const sqlite = new SQLiteConnection(CapacitorSQLite);
const ret = await sqlite.checkConnectionsConsistency();
const isConn = (await sqlite.isConnection("st")).result;
let db;
if (ret.result && isConn) {
db = await sqlite.retrieveConnection("st");
} else {
db = await sqlite.createConnection(
"st",
false,
"no-encryption",
1
);
}
await db.open();
const queries =
CREATE TABLE IF NOT EXISTS products (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT,
price TEXT
);
;
const res = await db.execute(queries);
if (res.changes && res.changes.changes && res.changes.changes < 0) {
throw new Error(Error: execute failed);
} else {
console.log('Executed Create if not Exist queries');
}
const queries2 =
INSERT INTO products (name, price) VALUES ('TestRocket', '$1.23');
;
await db.execute(queries2).then(async function(res2){
if (res2.changes && res2.changes.changes && res2.changes.changes < 0) {
throw new Error(Error: execute failed);
} else {
var str3 = JSON.stringify(res2);
console.log('Executed Insert query: ' + str3);
console.dir(res2);
}
var that = this;
this.timeout = setTimeout(async function(){
const queries4 =
SELECT * FROM products;
;
const res4 = await db.execute(queries4);
if (res4.changes && res4.changes.changes && res4.changes.changes < 0) {
throw new Error(`Error: execute failed`);
} else {
var str4 = JSON.stringify(res4);
console.log('Executed Select query: ' + str4);
console.dir(res4);
}
}, 9000)
});
Related code:
insert short code snippets here
Other information:
Capacitor doctor:
💊 Capacitor Doctor 💊
Latest Dependencies:
@capacitor/cli: 6.2.0
@capacitor/core: 6.2.0
@capacitor/android: 6.2.0
@capacitor/ios: 6.2.0
Installed Dependencies:
@capacitor/cli: 6.2.0
@capacitor/core: 6.2.0
@capacitor/android: 6.2.0
@capacitor/ios: 6.2.0
[success] iOS looking great! 👌
[success] Android looking great! 👌
insert the output from `npx cap doctor` here
- Ngôn ngữ chính
- Swift
- Star
- 663
- Fork
- 161
- 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ự
-
area:shell order:3 status:ready type:bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
krystianslowik/arkt#618 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
nightscout/Trio#1741 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
deepsealabs/libdc-swift#107 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
alexandrereol/ethmensa#30 ·
-
🎉 Add OmuType to Input MethodsĐang mởaddition
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 83/100
jaywcjlove/awesome-mac#4259 ·
Maintainer thường phản hồi trong vòng 1 ngày