Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Isolation Level Constants #387

Open
BrendanC23 opened this issue Jun 17, 2024 · 0 comments
Open

[BUG] Isolation Level Constants #387

BrendanC23 opened this issue Jun 17, 2024 · 0 comments

Comments

@BrendanC23
Copy link

The documentation says that the transaction isolation level constants "can be accessed through the base exported package":

  • odbc.SQL_TXN_READ_UNCOMMITTED
  • odbc.SQL_TXN_READ_COMMITTED
  • odbc.SQL_TXN_REPEATABLE_READ
  • odbc.SQL_TXN_SERIALIZABLE

The documentation has an example of

await connection.setIsolationLevel(odbc.SQL_TXN_READ_COMMITTED);

When I do

import odbc from "odbc";

console.log(odbc);

I get this output:

{
  // Other fields
  SQL_TXN_READ_UNCOMMITTED: 1,
  SQL_TRANSACTION_READ_UNCOMMITTED: 1,
  SQL_TXN_READ_COMMITTED: 2,
  SQL_TRANSACTION_READ_COMMITTED: 2,
  SQL_TXN_REPEATABLE_READ: 4,
  SQL_TRANSACTION_REPEATABLE_READ: 4,
  SQL_TXN_SERIALIZABLE: 8,
  SQL_TRANSACTION_SERIALIZABLE: 8
}

The odbc object has the constants. However, the odbc TypeScript types do not contain the constants. This results in the error Property 'SQL_TXN_SERIALIZABLE' does not exist on type 'typeof odbc'. The constants are not defined in the odbc.d.ts file, which makes calling setIsolationLevel in a typesafe manner difficult.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant