[BUG] Cursor with fetchSize > 1 results in error on prepared statement
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
- 38/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- javascript, node.js, sql
- Lĩnh vực
- database
Hướng nghiên cứu
Start by reproducing the prepared-statement path using statement.prepare, statement.execute({ fetchSize: 2 }), and cursor.fetch against SQL Server. Compare it with execution without a prepared statement and trace the cursor handling that produces the "Invalid cursor position" error. Done means fetchSize greater than 1 works with prepared statements and preserves regular cursor behavior.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe your system
odbcPackage Version: 2.4.7- ODBC Driver: Microsoft ODBC Driver Version 18
- Database Name: SQLServer
- Database Version: 2019
- Database OS: Windows
- Node.js Version: 16.15.1
- Node.js OS: Mac OS Ventura 13.3
Describe the bug
The ODBC driver returns a "Invalid cursor position" error if a fetchSize > 1 is specified for a prepared statement in statement.execute.
Expected behavior
Regular cursor behaviour when specifying a fetchSize > 1
To Reproduce
- Create a simple test table: CREATE TABLE test (id int);
- Insert some rows: INSERT INTO test values (1),(2),(3),(4),(5);
- Execute the code as specified below. This will result in the described error.
Code
const odbc = require('odbc');
async function connectToDatabase() {
const connectionConfig = {
connectionString: 'DSN=MSSQL2019;uid=sa;pwd=iRefact2017;MARS_Connection=no;trustServerCertificate=yes',
connectionTimeout: 10,
loginTimeout: 10
};
const connection = await odbc.connect(connectionConfig);
const statement = await connection.createStatement();
await statement.prepare('select * from IR_TSTGIN.dbo.test;');
let cursor = await statement.execute({
fetchSize: 2
});
let result = await cursor.fetch();
await cursor.close();
}
connectToDatabase()
.catch(error => {
console.dir(error, {
depth: null
});
});
Additional context
Specifying a fetchSize without a prepared statement does return as expected. So it seems that something goes wrong with a cursor on a prepared statement.
- Ngôn ngữ chính
- JavaScript
- Star
- 159
- Fork
- 92
- Merge trung bình
- 5 giờ 59 phút
- Pull request đã merge (30 ngày)
- 3
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
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 IBM/node-odbc
-
doc: how to run the testsĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
-
security
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
-
[Bug] Sybase ASE: Encoding issue (works in msnodesqlv8, fails in node-odbc with \x1A artifacts)Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 38/100
Tất cả issue của IBM/node-odbc
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
jfromaniello/url-join#134 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 60/100
quarto-dev/quarto-cli#15042 ·
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 68/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
extendr/extendr.github.io#134 ·