Skip to Content.
Sympa Menu

freetds - Re: [freetds] How does FreeTDS support bulk export

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Johnny Yan <jyan AT tableau.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] How does FreeTDS support bulk export
  • Date: Tue, 16 Aug 2016 20:14:15 +0000

Hi Bill,

So sorry about the delay.

The "bulk export" is referred to insert multiple rows into a temp table which
we just created. In terms of the ODBC API calls, the stack is roughly like
this,

SQLAllocHandle( SQL_HANDLE_STMT, ...) );
SQLExecDirectW(..., "CREATE TABLE [#temp_table_name] (columns)",...);

SQLAllocHandle( SQL_HANDLE_STMT, ... );
SQLPrepare(..., "INSERT INTO [#temp_table_name] (columns) VALUES (?,...)
",...)
SQLSetStmtAttrW(..., SQL_ATTR_PARAMSET_SIZE, num_rows_export, SQL_IS_UINTEGER
);
SQLBindParameter(..., SQL_PARAM_INPUT, ...)
SQLExecDirect(...,"INSERT INTO [#temp_table_name] (columns) VALUES (?,...)
",...)

With MS Native Client on Windows and/or Simba driver on OSX, this is working
just fine. But with FreeTDS, we found that the placeholds(?) in the prepared
statement were replaced with the value of the params. I actually debugged a
little bit of the FreeTDS code. In _SQLExecute(TDS_STMT * stmt):odbc.c(3270),
it goes into the branch "else if (stmt->query)" and the following comments
are confusing since we're passing in a prepared statement. Because of this,
the code path then goes into tds_multiple_query -> tds_send_emulated_execute,
which looks like really "emulating"(bulk export).

I suspect the "stmt->query" condition might be misleading in the first place
but not sure at all. What do you think?

If you need more info, please let me know.

Thanks,
Johnny

-----Original Message-----
From: FreeTDS [mailto:freetds-bounces AT lists.ibiblio.org] On Behalf Of
Thompson, William
Sent: Wednesday, August 10, 2016 5:37 AM
To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
Subject: Re: [freetds] How does FreeTDS support bulk export

Hi Johnny,

What is this "bulk export" you refer to?
If there's INSERT statements going on, it sounds more like an import to me...
What is wrapped around FreeTDS in your application?
I think it's more likely that it's this that is deciding on the approach of
generating multiple INSERT statements, rather than FreeTDS.

Bill

-----Original Message-----
From: FreeTDS [mailto:freetds-bounces AT lists.ibiblio.org] On Behalf Of Johnny
Yan
Sent: 09 August 2016 23:29
To: freetds AT lists.ibiblio.org
Subject: [freetds] How does FreeTDS support bulk export

Hi,

We've observed, through the freetds.log, that when we try to bulk export
multiple rows, what FreeTDS really does is replacing the ? placehold with the
corresponding param value(s), then concatenating multiple "INSERT INTO..."
statements into a single query, and finally sent it through the wire. Is this
what we're supposed to expect? How does FreeTDS support bulk export?

Thanks,
Johnny
_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds

----------------------------------------------------------------------
This message, and any attachments, is for the intended recipient(s) only, may
contain information that is privileged, confidential and/or proprietary and
subject to important terms and conditions available at
http://www.bankofamerica.com/emaildisclaimer. If you are not the intended
recipient, please delete this message.
_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds





Archive powered by MHonArc 2.6.24.

Top of Page