[freetds] Are LOBs supported?
freddy77 at gmail.com
Thu Jan 10 01:45:14 EST 2008
Il giorno mar, 08/01/2008 alle 17.44 +0100, Sebastien FLAESCH ha
> ZIGLIO, Frediano, VF-IT wrote:
> >> Sebastien FLAESCH wrote:
> >>> SQLBindParameter(m_hstmt, 2, SQL_PARAM_INPUT,
> >>> SQL_C_BINARY,
> >>> SQL_LONGVARCHAR, 0x10000000, 0, buf2, 0,
> >>> &vind1);
> >>> CHECK_RCODE(SQL_HANDLE_STMT,m_hstmt,"SQLBindParameter 2");
> >> Note that we have to bind the blob params with a large size
> >> for SQL Server
> >> drivers, otherwise you can't insert into the database...
> >> -> get SQLSTATE 07002 "COUNT field incorrect or syntax error"
> >> ... no idea why.
> >> Other APIs like DB2 CLI don't need to pass a size in such case.
> >> Don't know if this matters when using SQL_DATA_AT_EXEC with
> >> FreeTDS, but
> >> wanted to warn you about this strange thing.
> >> Note also that we use column-wise binding to fetch rows with:
> >> SQL_ATTR_ROW_BIND_TYPE, SQL_BIND_BY_COLUMN
> >> The test does not use this but our driver does, so if you fix
> >> this problem
> >> I can continue to test with our driver code.
> >> Thanks!
> >> Seb
> > SQL_DATA_AT_EXEC is not supported. SQLGetInfo report this. Perhaps error
> > from our library is not correct but it's not easy to implement (i'll fix
> > error report ASAP). You can however use SQL_LEN_AT_EXEC witch require a
> > length and which should be even faster.
> Ok will try the SQL_LEN_AT_EXEC way...
> I noted also that in many
> > examples you bind parameters after SQLPrepare. I would suggest to bind
> > before. In many cases (using many drivers) it's faster.
> Thanks for the tip, but actually we have to do SQLPrepare() before because
> the basic SQL instructions in Informix 4gl are PREPARE, then EXECUTE with
> parameter definition and values:
> PREPARE s1 FROM "INSERT INTO tab VALUES( ?, ?, ? )" -- SQLPrepare()
> EXECUTE s1 USING var1, var2, var3 -- SQLExecute()
I would try to prepare before even for Informix. Driver should just not
use binding informations if protocol does not require them. Binding data
is a way to say "take missing data from here" it do not force anything.
If it works (as it should) you will gain performance with drivers that
work better with type informations on prepare.
More information about the FreeTDS