Re: figuring out why I am having this issue

Поиск
Список
Период
Сортировка
От Dave Page
Тема Re: figuring out why I am having this issue
Дата
Msg-id E7F85A1B5FF8D44C8A1AF6885BC9A0E4AC9DF6@ratbert.vale-housing.co.uk
обсуждение исходный текст
Ответ на figuring out why I am having this issue  ("Joel Fradkin" <jfradkin@wazagua.com>)
Ответы Re: figuring out why I am having this issue  ("Joel Fradkin" <jfradkin@wazagua.com>)
Список pgsql-odbc

> -----Original Message-----
> From: Joel Fradkin [mailto:jfradkin@wazagua.com]
> Sent: 01 September 2005 14:48
> To: Dave Page
> Subject: RE: [ODBC] figuring out why I am having this issue
>
> What if the
> size it thinks the field is is wrong?

It defaults the max_longvarchar_size if the DB doesn't return a value.
Note that this is for the column though, not the individual field.

I suppose what could be happening is this:

1) The app queries (using SQLDescribeCol) the results for the data type
etc.
2) The app allocates a buffer based on the size reported for the notes
column.
3) The app reads a notes field (using SQLGetData), which reports the
actual field size.
4) It keeps reading chunks of data until it gets to the end, and
somewhere along the line, overflows the buffer allocated, eg:

char szData[max_longvarchar_size];
char szChunk[1024];

// Get the data in chunks
do
{
    retcode = SQLGetData(hStmt, 1, SQL_C_CHAR, szChunk,
sizeof(szChunk), &cbData);
    strcat(szData, szChunk);

} while (retcode != SQL_SUCCESS && retcode != SQL_NO_DATA);


> This is not an issue for all data in my table (I have a huge amount of
> records it works fine for). I noticed this notes field is
> using some odd
> char like the 1/2 char you know where it makes it small etc.
> Maybe it is not
> calculating the size of this particular note field.

I doubt it - for strings that's handled here:

void
set_tuplefield_string(TupleField *tuple_field, const char *string)
{
    tuple_field->len = strlen(string);
    tuple_field->value = malloc(strlen(string) + 1);
    strcpy(tuple_field->value, string);
}

Regards, Dave

В списке pgsql-odbc по дате отправления:

Предыдущее
От: Alexandra - Gestão XXI Sistemas e Soluções
Дата:
Сообщение: Fw: psqlodbc - PostgreSql 8.0 - Errors accessing tables using ODBC - PostgreSql 8.0
Следующее
От: "Dave Page"
Дата:
Сообщение: Re: figuring out why I am having this issue