我得到了這樣的錯誤消息列獲取數據的問題
:
Open Client Message:
Message number: LAYER = (1) ORIGIN = (4) SEVERITY = (1) NUMBER = (132)
Message String: ct_fetch(): user api layer: internal common library error: The bind of result set item 3 resulted in truncation.
它只獲取首先255行並截斷其餘的。
我試圖暗示下方ct_connect前行,但沒有奏效
CS_BOOL boolv = CS_TRUE;
CS_RETCODE retcode2 = ct_capability (*connection, CS_GET, CS_CAP_REQUEST, CS_WIDETABLES, &boolv);
這裏的代碼的某些部分,你有什麼建議
for (i = 0; i < num_cols; i++) {
/*
** Get the column description. ct_describe() fills the
** datafmt parameter with a description of the column.
*/
retcode = ct_describe(cmd, (i + 1), &datafmt[i]);
if (retcode != CS_SUCCEED) {
ex_error("ex_fetch_data: ct_describe() failed");
break;
}
/*
** update the datafmt structure to indicate that we want the
** results in a null terminated character string.
**
** First, update datafmt.maxlength to contain the maximum
** possible length of the column. To do this, call
** ex_display_len() to determine the number of bytes needed
** for the character string representation, given the
** datatype described above. Add one for the null
** termination character.
*/
datafmt[i].maxlength = ex_display_dlen(&datafmt[i]) + 1;
/*
** Set datatype and format to tell bind we want things
** converted to null terminated strings
*/
datafmt[i].datatype = CS_LONGCHAR_TYPE;
datafmt[i].format = CS_FMT_NULLTERM;
/*
** Allocate memory for the column string
*/
coldata[i].value = (CS_CHAR *) malloc(datafmt[i].maxlength);
if (coldata[i].value == NULL) {
ex_error("ex_fetch_data: malloc() failed");
retcode = CS_MEM_ERROR;
break;
}
/*
** Now bind.
*/
retcode = ct_bind(cmd, (i + 1), &datafmt[i], coldata[i].value,
&coldata[i].valuelen, (CS_SMALLINT *) &coldata[i].indicator);
if (retcode != CS_SUCCEED) {
ex_error("ex_fetch_data: ct_bind() failed");
break;
}
}
.............
.............
.............
/*
** Fetch the rows. Loop while ct_fetch() returns CS_SUCCEED or
** CS_ROW_FAIL
*/
while (((retcode = ct_fetch(cmd, CS_UNUSED, CS_UNUSED, CS_UNUSED,
&rows_read)) == CS_SUCCEED) || (retcode == CS_ROW_FAIL)) {
@selcuk:你能檢查你的服務器和CT庫版本並將它們添加到問題中嗎?你有沒有嘗試把ct_capability調用*放在* ct_connect之後? – 2010-02-09 07:38:57
你好馬丁 它沒有任何意義,取代ct_capability。我也嘗試過從CS_GET到CS_SET的設置動作,但它沒有奏效。 我不能克服這個問題是當閱讀一個文本區域, 我不熟悉低級分貝,但一位朋友告訴我 它可能是在閱讀區域(文本區域)作爲blob類型來? 如果是這樣的話,ct_lib如何讀取blob類型? 謝謝 – selcuk 2010-02-09 09:11:02
加我試過這樣的代碼,我認爲可能會幫助儘管這個命令沒有失敗它沒有工作太 CS_RETCODE retcode2; int textsize = 1000000; retcode2 = ct_options(連接,CS_SET,CS_OPT_TEXTSIZE,&textsize,CS_UNUSED,NULL); 順便我使用sybase15 libs – selcuk 2010-02-09 09:50:41