Re: How to apply Bulk Copy hints when using ctlib ?
Mark Songhurst <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <[email protected]> |
Many thanks, I'll give this a shot. Kind regards, Mark. On 3 March 2011 17:03, <[email protected]> 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 > [email protected] > http://lists.ibiblio.org/mailman/listinfo/freetds > -- Thanks, Mark