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:21:21 +0200

Many thanks, I'll give this a shot.

Kind regards,
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