Skip to content

Issue Related to Prepare or Bind #86

@hansaliyad1

Description

@hansaliyad1

Hello,

I am having this weird issue with ODBC just on my production environment but not on development. I have this below function. When this function is called, it returns a result based on what my code can decide if the record exists or not.

async function functionName(bindValue) {
    try {
        const conn = await db.conn();
        const statement = await conn.createStatement();
        await statement.prepare('select count(*) as ttl_recs from hcc_ccs_grtrack2 where risk_no=? and random_id=?');
        await statement.bind(bindValue);
        await console.log(statement);
        const result = await statement.execute();
        return Promise.resolve(result)
    }
    catch (e) {
        return Promise.reject(e);
    } 
}

In the development environment, the result I get back is below.

Statement { odbcStatement: ODBCStatement {} }
[
  { ttl_recs: 1 },
  statement: 'select count(*) as ttl_recs from hcc_ccs_grtrack2 where risk_no=? and random_id=?',
  parameters: [ 'xxxxxxxxxxx', 'xxxxxxxxxxx' ],
  return: undefined,
  count: -1,
  columns: [ { name: 'ttl_recs', dataType: 4 } ]
]

In the production environment, with the same function and same ODBC connection, the result I get back is below.

Statement { odbcStatement: ODBCStatement {} }
[
  { t: 1 },
  statement: 's',
  parameters: [ 'xxxxxxxxxxx', 'xxxxxxxxxxx' ],
  return: undefined,
  count: -1,
  columns: [
    {
      name: 't',
      dataType: 4,
      columnSize: 10,
      decimalDigits: 0,
      nullable: false
    }
  ]
]

On production, ttl_recs changes to just t even though the query is select count(*) as ttl_recs. Both the production and development environment is windows server 2016 with NodeJS version of 12.18.2 on development and 12.18.3 on production. I will really appreciate any assistance with this weird issue. Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions