Redian新闻
>
Re: How to change Default SQL String Buffer Size(1K) for ODBC Driver
avatar
Re: How to change Default SQL String Buffer Size(1K) for ODBC Driver# Database - 数据库
h*r
1
But getObject only exists in Java, not C++, and my problems
is, say
SQL string like
"select .... from ... where ...", if its size over 1K, then
ODBC driver
will not accept it. Is there a way to extend the ODBC SQL
String 1K
limitation?
Thanks.
avatar
a*a
2
I'm a bit confused with what you want.
Are you talking about the lenght of your sql command
statement, or the length of the column?
* If it's command statement, you may try put it in a stored
proc.
* If it's the length of the column (assuming you are using a
TEXT field):
If you use VC++'s ODBC, TEXT column is mapped to RFX_TEXT.
And it takes a default nMaxLength of 255 (you can check the
prototype of RFX_TEXT in afxdb.h). Just supply your length
to overwrite the default value.

【在 h****r 的大作中提到】
: But getObject only exists in Java, not C++, and my problems
: is, say
: SQL string like
: "select .... from ... where ...", if its size over 1K, then
: ODBC driver
: will not accept it. Is there a way to extend the ODBC SQL
: String 1K
: limitation?
: Thanks.

avatar
h*r
3
yes, I mean the lenght of the sql command statement, store
procedure
is good, but maybe not fast. Now I overcome the 1k
limitation to 4k
limitation, it is the limiation of the ODBC packet size,
which is 4k.
Do you have some good way to over the 4k limiation of sql
statement?

【在 a*****a 的大作中提到】
: I'm a bit confused with what you want.
: Are you talking about the lenght of your sql command
: statement, or the length of the column?
: * If it's command statement, you may try put it in a stored
: proc.
: * If it's the length of the column (assuming you are using a
: TEXT field):
: If you use VC++'s ODBC, TEXT column is mapped to RFX_TEXT.
: And it takes a default nMaxLength of 255 (you can check the
: prototype of RFX_TEXT in afxdb.h). Just supply your length

avatar
a*a
4
I don't see why you absolutely need a statement longer than
4K chars.. something must be wrong here.
And actually calling a stored procedure is almost always
faster in such case.

【在 h****r 的大作中提到】
: yes, I mean the lenght of the sql command statement, store
: procedure
: is good, but maybe not fast. Now I overcome the 1k
: limitation to 4k
: limitation, it is the limiation of the ODBC packet size,
: which is 4k.
: Do you have some good way to over the 4k limiation of sql
: statement?

avatar
h*r
5


【在 a*****a 的大作中提到】
: I don't see why you absolutely need a statement longer than
: 4K chars.. something must be wrong here.
: And actually calling a stored procedure is almost always
: faster in such case.

avatar
h*r
6
The reason is I have to provide an updateDb API for other
people to
insert data to tens of differnet kind of table, and some
statement for
insert a record is definetly over 4k, use CLOB by
prepare/bind/exec will overcome the size problem, but
because every table has different coloums,
It is hard to provide an common updateDb API for all tables
by prepare/bind/exec.
for example,
table A is (Number, Number, CLOB),
table B is (Number, CLOB, string, CLOB);
we cannot provide a common updateDb API for

【在 a*****a 的大作中提到】
: I don't see why you absolutely need a statement longer than
: 4K chars.. something must be wrong here.
: And actually calling a stored procedure is almost always
: faster in such case.

avatar
a*a
7
If I were you, I'd use OLEDB instead of ODBC.
In OLEDB, you can just set all the column/param data and
then call IRowsetChan ge::SetData (equivalent of SQL UPDATE)

【在 h****r 的大作中提到】
: The reason is I have to provide an updateDb API for other
: people to
: insert data to tens of differnet kind of table, and some
: statement for
: insert a record is definetly over 4k, use CLOB by
: prepare/bind/exec will overcome the size problem, but
: because every table has different coloums,
: It is hard to provide an common updateDb API for all tables
: by prepare/bind/exec.
: for example,

avatar
h*r
8
I found maybe use the prepare/bind/exec is a good way to
handle the
CLOB, but I meet some problem when use it. Do you ever have
expreience
and can point out what is wrong for my code?
I debugged it, the problem is from the SQLExecute, so the
SQLBindParameter
may have problem. But I really don't know where I can find
an example
to use them.
void updateClob(const char* lobString)
{
SQLRETURN lRetVal;
SQLHSTMT lSqlHstmt;
SQLINTEGER ind = SQL_DATA_AT_EXEC;


【在 a*****a 的大作中提到】
: If I were you, I'd use OLEDB instead of ODBC.
: In OLEDB, you can just set all the column/param data and
: then call IRowsetChan ge::SetData (equivalent of SQL UPDATE)

avatar
a*o
9
big string for a query is not good for network bandwidth.
why not try stored procedure?

【在 h****r 的大作中提到】
: But getObject only exists in Java, not C++, and my problems
: is, say
: SQL string like
: "select .... from ... where ...", if its size over 1K, then
: ODBC driver
: will not accept it. Is there a way to extend the ODBC SQL
: String 1K
: limitation?
: Thanks.

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。