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

[6.0b1] Decimal parameter edge case. #22

Closed
felixxm opened this Issue May 5, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@felixxm
Copy link

felixxm commented May 5, 2017

I think that there is regression in cx_Oracle==6.0b1. Passing Decimal('0.000') as a parameter to the cursor doesn't return correct result, moreover passing Decimal('0'), '0', '0.000' works. Please find below regression test that fails in cx_Oracle==6.0b1 and works in cx_Oracle==5.3:

import cx_Oracle
connection = cx_Oracle.connect("user", "password", "TNS")
cursor = connection.cursor()
cursor.execute('CREATE TABLE "TEST"("DATA" NUMBER(5,3) PRIMARY KEY)')
cursor.execute('INSERT INTO "TEST"("DATA") VALUES (0)')
cursor.execute(
    'SELECT 1 FROM "TEST" WHERE "TEST"."DATA" = :arg0',
    {':arg0': Decimal('0.000')},
)
row = cursor.fetchone()
assert row is not None
assert row[0] == 1
  • Python 3.4.3 (64-bit)

@anthony-tuininga anthony-tuininga added the bug label May 5, 2017

anthony-tuininga added a commit to oracle/odpi that referenced this issue May 5, 2017

anthony-tuininga added a commit that referenced this issue May 5, 2017

@anthony-tuininga

This comment has been minimized.

Copy link
Member

anthony-tuininga commented May 5, 2017

Bug has been corrected and a test case has been added to ODPI-C. Effectively if the number of zeroes following the decimal point was odd it wouldn't work correctly but if the number of zeroes following the decimal point was even it would work fine. Thanks for pointing out this anomaly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment