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

Trancate long text from VARCHAR(5000) [PYFB25] #48

Closed
firebird-issue-importer opened this issue Jan 26, 2013 · 5 comments
Closed

Trancate long text from VARCHAR(5000) [PYFB25] #48

firebird-issue-importer opened this issue Jan 26, 2013 · 5 comments

Comments

@firebird-issue-importer

Submitted by: nepomnyashiy evgeniy (nepomnyashiy evgeniy)

I have table with field
"field" "Text" /* "Text" = VARCHAR(5000) */,

One record have text of about 2500 chars in this field.
If I select this record, I receive only 213 chars.

cur = con.cursor()
cur.execute('SELECT "field" from "table" where id=?', [id])
for m in cur.itermap():
print m["field"]

With kinterbasdb this works fine

Commits: 3354699

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jan 26, 2013

Modified by: nepomnyashiy evgeniy (nepomnyashiy evgeniy)

description: I have table with field
{code}
"field" "Text" /* "Text" = VARCHAR(5000) */,
{code}

One record have text of about 2500 chars in this field.
If I select this record, I receive only 213 chars.
{code}
cur = con.cursor()
cur.execute('SELECT "field" from "table" where id=?', [id])
for m in cur.itermap():
print m["field"]
{code}

With kinterbasdb this works fine

=>

I have table with field
"field" "Text" /* "Text" = VARCHAR(5000) */,

One record have text of about 2500 chars in this field.
If I select this record, I receive only 213 chars.

cur = con.cursor()
cur.execute('SELECT "field" from "table" where id=?', [id])
for m in cur.itermap():
print m["field"]

With kinterbasdb this works fine

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jan 28, 2013

Commented by: nepomnyashiy evgeniy (nepomnyashiy evgeniy)

see fbcore, line 2075

elif vartype == SQL_VARYING:
size = bytes_to_uint(sqlvar.sqldata[:1]) #⁠ ******************************
#⁠value = ctypes.string_at(sqlvar.sqldata[2],2+size)
#⁠#⁠#⁠ Todo: verify handling of P version differences
if PYTHON_MAJOR_VER == 3:
value = bytes(sqlvar.sqldata[2:2 + size])
else:
value = str(sqlvar.sqldata[2:2 + size])
if ((self.__charset or PYTHON_MAJOR_VER == 3)
and sqlvar.sqlsubtype != 1): #⁠ non OCTETS
value = b2u(value,self.__python_charset)

replace selected string with
size = bytes_to_uint(sqlvar.sqldata[:2])

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Feb 27, 2013

Commented by: Slava (slava)

I also ran into this problem. Today I played with driver code and wrote small fix, exactly like your evgeniy.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Mar 6, 2013

Modified by: @pcisar

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 1.0 [ 10500 ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Mar 7, 2013

Modified by: @pcisar

status: Resolved [ 5 ] => Closed [ 6 ]

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

Successfully merging a pull request may close this issue.

None yet
2 participants