Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[BUG] Cursor with fetchSize > 1 results in error on prepared statement

オープン
#329 コメント 8 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
38/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
javascript, node.js, sql
領域
database

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

confirmed

Describe your system

  • odbc Package 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

  1. Create a simple test table: CREATE TABLE test (id int);
  2. Insert some rows: INSERT INTO test values (1),(2),(3),(4),(5);
  3. 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.

主要言語
JavaScript
スター
159
フォーク
92
平均マージ
5時間 59分
マージ済み PR(30日)
3

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

IBM/node-odbc のほかの issue

IBM/node-odbc の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。