Skip to Content.
Sympa Menu

freetds - Re: [freetds] How to apply Bulk Copy hints when using ctlib ?

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Mark Songhurst <mark AT songhurst.org>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] How to apply Bulk Copy hints when using ctlib ?
  • Date: Thu, 3 Mar 2011 17:45:39 +0200

Hello again,

You wrote:

> As long as blkdesc->bcpinfo.hint points to a valid string

I'm using 0.82 of FreeTDS and my BLKDESC structure boils down to this,
in ctlib.h:

struct _cs_blkdesc
{
CS_CONNECTION *con;
CS_CHAR *tablename;
CS_CHAR *insert_stmt;
CS_INT direction;
CS_INT identity_insert_on;
CS_INT bind_count;
CS_INT xfer_init;
CS_INT var_cols;
TDSRESULTINFO *bindinfo;
};

I don't have a bcpinfo member.
Please can you tell me if you are referring to a newer version of
FreeTDS, or perhaps I have misunderstood your suggestion?

Many thanks,
Mark.

On 3 March 2011 17:03, <jklowden AT schemamania.org> wrote:
> On Thu, Mar 03, 2011 at 01:21:53PM +0200, Mark Songhurst wrote:
>> I'm using FreeTDS 0.82 on Linux RedHat Enterprise 4.0 x64. My database
>> is MS SQL Server 2008 Standard Edition.
>> I'm programming in C and using the ctlib API of FreeTDS.
> ...
>> I need the constraint active during the bulk copy to ensure bad data
>> is rejected (it's ok for the whole bulk copy to fail if only one data
>> item is bad).
> ...
>> Please can you suggest how I can keep constraints enabled during a
>> bulk copy using the ctlib API?
>
> To do that, you'll need to modify ct-lib.  Hard, but not too hard.
>
> In db-lib, we extended the possible values of bcp_options to include hints,
> and
> allowed hints to be passed as literal strings.  See
> src/dblib/bcp.c::bcp_options().
>
> You can extend blk_props in the same way.  As long as blkdesc->bcpinfo.hint
> points to a valid string e.g. "CHECK_CONSTRAINTS", the tds library will
> send it
> to the server before sending the first row.
>
> It should work!  :-)
>
> HTH.
>
> --jkl
>
> _______________________________________________
> FreeTDS mailing list
> FreeTDS AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds
>



--
Thanks,
Mark




Archive powered by MHonArc 2.6.24.

Top of Page