SQLDBC getObject() and bindColumn()/fetch() returning too many chars
====================================================================
hello list,
i always getting too many chars returned from calls to getObject() and the
bindColumn() / fetch() pair.
i am using:
OS : Win 2000 Prof. SP 4
Kernel: 7.5.0 Build 014-123-073-298
SQLDBC Header Version: SQLDBC.H 7.5.0 BUILD 014-123-073-156
Kernel Version : 70500
AutoCommit : OFF
Transact. Isolation : 1
Date Time Format : ISO (ODBC, JDBC)
Unicode Database : NO
default (unchanged) connect properties, so SQL-Mode INTERNAL is in effect.
just create the following table, using SQLStudio
CREATE TABLE theusers (
id CHAR(16) BYTE NOT NULL,
nickname CHAR(64) NOT NULL,
psw CHAR(64) DEFAULT '',
lastlogin DATE DEFAULT DATE,
PRIMARY KEY (id)
)
and then insert something, e.g.
INSERT theusers (id,nickname, psw)
VALUES ('9480bd7406074f20acc6684c12999999','DummyUser999999','null')
check it out with SQLStudio, look at it in the binary zoom window,
go into hex mode. the column nickname is correctly null terminated,
then followed by 0x20's.
now turn to SQLDBC. make a simple select
stmt = m_pConn->createPreparedStatement();
stmt->prepare("SELECT * FROM theusers WHERE id = ?");
...
char nickname[65];
memset(&nickname, 0, sizeof(nickname));
...
rs = stmt->getResultSet();
rs->getObject(2, SQLDBC_HOSTTYPE_ASCII, &nickname, &li,
sizeof(nickname));
now look at nickname; nickname is filled with 'DummyUser999999'
FOLLOWED BY SPACES all the way until terminating null in the last byte.
lengthindicator li is set to 64.
the same is happening if you bind the column
rs->bindColumn(2, SQLDBC_HOSTTYPE_ASCII ,nickname, li, 65);
after the fetch(), you can observe the same results.
you can also observe the same phenomenon with the column psw; after 'null'
it's filled up with trailing spaces until the final null terminator. given
this i don't think that the NOT NULL for nickname in the tabledef play's
any role here.
oops, i think you might have somthing to fix here...
keep it up
andreas bohn
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail
--
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]