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

[BUG] callProcedure returns parameter values of incorrect datatype

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

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

評価

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

調査の方向性

エントリポイント callProcedure から開始し、issue に示されている INOUT と OUT の定義を使って、報告された DB2 for i のケースを再現します。パラメーター値と ODBC プロシージャーデータがどのように変換されるかを追跡します。完了条件は、両方のケースで DECIMAL(11,2) の結果の数値と型に一貫性があり、リポジトリに適切なテスト場所がある場合はリグレッションカバレッジも追加されていることです。

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

説明

confirmed
  • odbc Package Version: 2.4.8
  • ODBC Driver: unixODBC 2.3.9
  • Database Name: DB2 for i
  • Database Version: V7R5
  • Database OS: IBM i
  • Node.js Version: v18.20.2
  • Node.js OS: IBM i

When using callProcedure I'm finding the returned results don't respect the datatype of the procedure parameters but instead appear to respect the datatype of the Node.js fields.

For example, if I create the following procedure.

DROP PROCEDURE RMTEMP.MY_PROC ;

CREATE PROCEDURE RMTEMP.MY_PROC (
  INOUT PARAM1 DECIMAL(11,2) ,
  INOUT PARAM2 DECIMAL(11,2) ,
  INOUT PARAM3 DECIMAL(11,2) ,
  INOUT PARAM4 DECIMAL(11,2)
)
BEGIN
  SET PARAM1 = 123.45;
  SET PARAM2 = 123.45;
  SET PARAM3 = 123.45;
  SET PARAM4 = 123.45;
END;

-- CALL RMTEMP.MY_PROC(99.99, 0, '99.99', null);

With the following Node.js code.

const odbc = require('odbc');

odbc.connect('DSN=MYIBMI', (error, connection) => {
  if (error) { throw error; }

  let param1=99.99;
  let param2=0;
  let param3='99.99';
  let param4=null;

  connection.callProcedure(null, 'RMTEMP', 'MY_PROC', [param1, param2, param3, param4], (error, result) => {
    if (error) { throw error; }

    connection.close();
    console.log(result);
  });
});

When I call this from Node I'm expecting all four parameters to have a return value of 123.45 (as numbers) but instead I get this. Of particular concern is the second parameter, which is returned as an integer, though I would expect all values to be returned as numbers rather than strings.

[
  statement: '{ CALL RMTEMP.MY_PROC (?,?,?,?) }',
  parameters: [ 123.45, 123, '123.45', '123.45' ],
  return: undefined,
  count: 0,
  columns: []
]

If I change the procedure to all OUT parameters I get a different result.

DROP PROCEDURE RMTEMP.MY_PROC ;

CREATE PROCEDURE RMTEMP.MY_PROC (
  OUT PARAM1 DECIMAL(11,2) ,
  OUT PARAM2 DECIMAL(11,2) ,
  OUT PARAM3 DECIMAL(11,2) ,
  OUT PARAM4 DECIMAL(11,2)
)
BEGIN
  SET PARAM1 = 123.45;
  SET PARAM2 = 123.45;
  SET PARAM3 = 123.45;
  SET PARAM4 = 123.45;
END;

Running the same Node.js code I get the following. At least I'm getting the correct values but all of the parameters are returned as strings rather than numbers.

[
  statement: '{ CALL RMTEMP.MY_PROC (?,?,?,?) }',
  parameters: [ '123.45', '123.45', '123.45', '123.45' ],
  return: undefined,
  count: 0,
  columns: []
]
主要言語
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 を短くまとめたダイジェスト。