Subject | fdb 0.9.1: possible issue with varchar fields |
---|---|
Author | Maximiliano Robaina |
Post date | 2012-10-25T22:48:12Z |
I'm testing django-firebird using fdb 0.9.1
I fall into strange problem testing models with CharFields which are defined as varchar field at database level.
Then, I tried to isolate the problem testing directly with fdb.
Environment:
Ubuntu 11.04 32 bits
Python 2.7.1
Firebird2.5-super
fdb 0.9.1
Table structure:
DATABASE CHARSET ISO8859_1, PAGE SIZE 4096
CREATE TABLE TEST_BASE_BIGS
(
ID Integer NOT NULL,
S Varchar(255) NOT NULL,
PRIMARY KEY (ID)
);
First, I insert by hand (using FlameRobin) a record in TEST_BASE_BIGS
INSERT INTO TEST_BASE_BIGS (ID, S) VALUES ('1', 'slugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslug');
Now:
As we can see, It return a empty string instead of the correct value from "s" field
But, adding ID field into query:
Am I doing something wrong?
Is it just a fdb bug ?
--
Maxi
I fall into strange problem testing models with CharFields which are defined as varchar field at database level.
Then, I tried to isolate the problem testing directly with fdb.
Environment:
Ubuntu 11.04 32 bits
Python 2.7.1
Firebird2.5-super
fdb 0.9.1
Table structure:
DATABASE CHARSET ISO8859_1, PAGE SIZE 4096
CREATE TABLE TEST_BASE_BIGS
(
ID Integer NOT NULL,
S Varchar(255) NOT NULL,
PRIMARY KEY (ID)
);
First, I insert by hand (using FlameRobin) a record in TEST_BASE_BIGS
INSERT INTO TEST_BASE_BIGS (ID, S) VALUES ('1', 'slugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslugslug');
Now:
>>> import fdb('',)
>>>
>>> conn = fdb.connect(dsn='django-test', user='sysdba', password='masterkey')
>>> cur = conn.cursor()
>>> cur.execute('select s from test_base_bigs where id = 1')
>>> cur.fetchone()
As we can see, It return a empty string instead of the correct value from "s" field
But, adding ID field into query:
>>> cur.execute('select id, s from test_base_bigs where id = 1')(1, '')
>>> cur.fetchone()
Am I doing something wrong?
Is it just a fdb bug ?
--
Maxi