When length of text data is 1.

When length of text data is 1.

am 30.10.2006 19:19:33 von nfsr

Hello,

I tried to search in Internet, but didn't find answer...
I'm using PostgreSQL 8.1.5-1, ODBC, MS Visual C++ with MFC, I'm using
Unicode (database has UTF8 encoding and I'm using "PostgreSQL Unicode" odbc
driver).
I create, for example, such table:

***code***
CREATE TABLE section (
idsection INT PRIMARY KEY,")
idparent INT NULL REFERENCES section ON DELETE CASCADE,")
name TEXT NOT NULL")
);
**********

Retrieve data thereby:

***code***
CRecordset rcrd(&db);
CString nm;
.....
rcrd.GetFieldValue(_T("name"),nm);
**********

It works without any problem except when length of 'name' is 1.
For example, It works fine when name is 'John' but when name is 'J' line
rcrd.GetFieldValue(_T("name"),nm);
throws exception with empty exception message and AFAIK with return code
SQL_NO_DATA.
If I catch exception, nm equals 'J', but when application exits, Memory
Leaks is detected.
And I think, catching exception and then checking emptyness of exception
message is not good solution...

So, question...
Is this bug in my code or in MFC code or in ODBC driver's code?
What I should do to support strings with length == 1?
Thank you if you can help me..


Best regards,
Nail Samatov


---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Re: When length of text data is 1.

am 07.11.2006 04:34:02 von Hiroshi Inoue

îæóò wrote:
> Hello,
>=20
> I tried to search in Internet, but didn't find answer...
> I'm using PostgreSQL 8.1.5-1, ODBC, MS Visual C++ with MFC, I'm using
> Unicode (database has UTF8 encoding and I'm using "PostgreSQL Unicode" =
odbc
> driver).
> I create, for example, such table:
>=20
> ***code***
> CREATE TABLE section (
> idsection INT PRIMARY KEY,")
> idparent INT NULL REFERENCES section ON DELETE CASCADE,")
> name TEXT NOT NULL")
> );
> **********
>=20
> Retrieve data thereby:
>=20
> ***code***
> CRecordset rcrd(&db);
> CString nm;
> ....
> rcrd.GetFieldValue(_T("name"),nm);
> **********
>=20
> It works without any problem except when length of 'name' is 1.
> For example, It works fine when name is 'John' but when name is 'J' lin=
e
> rcrd.GetFieldValue(_T("name"),nm);
> throws exception with empty exception message and AFAIK with return cod=
e
> SQL_NO_DATA.

Which version of ODBC driver are you using ?
Could you send me the Mylog output ?

regards,
Hiroshi Inoue

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq