On 05-Mar-2002 Steffen Goeldner wrote:
> Currently, long get_info() return values (e.g. SQL_KEYWORDS)
> are truncated.
> That's because the buffer has a static size of 256.
> The attached patch allocates the buffer dynamically and
> reallocates it if needed.
> 
> 
> Steffen

As far as I recall you can call SQLGetInfo with a NULL InfoValuePtr but a valid
StringLengthPtr. This then returns the size of the buffer you would need to get
all the data back.

e.g.

if (SQL_SUCCEEDED(SQLGetInfo(hdbc, SQL_KEYWORDS, NULL, 0, &sqlsmallint))) {
        SQLCHAR         buf;

        buf = malloc(sqlsmallint + 1);
        SQLGetInfo(hdbc, SQL_KEYWORDS, buf, sqlsmallint + 1, *sqlsmallint);
        /* copy buf somewhere */
        free(buf);
}

Martin
--
Martin J. Evans
Easysoft Ltd, UK
Development

Reply via email to