Re: SQLBulkOperations question

From: Dmitri Ivanov (divanov_NOSP_at_M_.aha.ru)
Date: 11/19/04

  • Next message: Brant: "MDAC installation problem"
    Date: Fri, 19 Nov 2004 22:34:53 +0300
    
    

    Hello TSH,
    "TSH" <mathematicus@yahoo.com> wrote:

    T> In trying to write to a table WITH a primary key, suppose that there
    T> are TWO different arrays containing the desired data that need to be
    T> written one after the other. The arrays are not of the same length.
    T>
    T> The procedure would be something like:
    T>
    T> SQLBindCol(StmtHndl, column, SQL_dataType, Pointer to array1...
    T> SQLBulkOperations(StmtHndl,SQL_ADD,...
    T> SQLBindCol(StmtHndl, column, SQL_dataType, Pointer to array2...
    T> SQLBulkOperations(StmtHndl,SQL_ADD,...
    T>
    T> Upon doing this,
    T> The first array is written ok, but onthe second BulkOps the driver
    T> gives an error saying that duplicate values are being written though
    T> there are NO such duplcates between the contents of the arrays.
    T> The error seems to be given on the SECOND row of the array2, the
    T> first row gets written ok.
    T>
    T> Other symptoms:
    T> If the table does not have a primary key things go ok.
    T> OR
    T> If the first arrays is recycled to hold the second batch of data SO
    T> THAT the second BINDCOL is deleted, things go ok.
    T>
    T> So I need to know how can one write more than one array of data via
    T> BulkOps without the totla data being a multiple of the first array?

    AFAIR, you are trying to add several rows in bulk from compound memory
    blocks. As you have said that the arrays are not of the same length, make
    sure to set the corresponding row array size every time. Are you really
    changing the contents of the array for the primary key column (or rebind
    it)?

    Generally, interleaving SQLBindCol is not a good practice. Binding offsets
    could be of value if the driver did support them.

    --
    Sincerely,
    Dmitri Ivanov
    Common Lisp ODBC interface - www.ystok.ru
    

  • Next message: Brant: "MDAC installation problem"

    Relevant Pages

    • Question on Use of BulkOperations
      ... In trying to write to a table WITH a primary key, ... The arrays are not of the same length. ... The error seems to be given on the SECOND row of the array2, ... without the total data being a multiple of the first array? ...
      (microsoft.public.sqlserver.odbc)
    • SQLBulkOperations question
      ... In trying to write to a table WITH a primary key, ... The arrays are not of the same length. ... The error seems to be given on the SECOND row of the array2, ... without the totla data being a multiple of the first array? ...
      (microsoft.public.data.odbc)
    • Re: Recognize directories and files.
      ... What is annoying, is that the arrays are empty at program load, ... and Perl returns an error saying it cannot sort empty void. ...
      (comp.lang.perl.misc)
    • Choose two numbers
      ... code finds the largest number in the first row of the first array ... By writing these two numbers from each row of the arrays ... Dim lastrow As Long ... Wend ...
      (microsoft.public.excel.programming)
    • Re: Idiom for array index that Im foreaching over?
      ... I have taken the first array to be the measure of all. ... > minimum length of all arrays offered, ... > be other useful strategies. ... Assigning to the "goob" routine both chooses this option and sets the ...
      (comp.lang.perl.misc)