[freetds] SELECT @@IDENTITY AS InsertID

Shaun Craig s.craig at andronics.com
Wed Oct 12 04:12:05 EDT 2005


Me again! Just got back to working on this problem, im now finding 
through running gdb debugging the following message:

Program received signal SIGSEGV, Segmentation fault.
0x4007d1c7 in buffer_transfer_bound_data (rowtype=Variable "rowtype" is 
not available.
) at dblib.c:6460
6460                    memcpy(dest, &(dres.dt4), sizeof(TDS_DATETIME4));

It seems that when i try to bind the insertid(int) to my variable its 
trying to bind a date for some reason.

dbbind(dbconn, 1, INTBIND, (DBINT)0, (BYTE *)& InsertID);

Any thoughts?

Lowden, James K wrote:

>>From: Shaun Craig
>>Sent: Thursday, October 06, 2005 11:37 AM
>>
>>I break the query string up depending on how many statements are in
>>    
>>
>it, 
>  
>
>>so for above i have 2, 1 for insert and 1 for select
>>
>>for ( x = 0; x < amount of statments + 1; x++ )
>>{ 
>>    //first time around it will be the insert which inserts ok
>>    dbcmd(dbconn, statements[x])
>>    dbsqlexec(dbconn)
>>    dbresults(dbconn)
>>
>>    if we find that the statement is a 'Select @@Identity..etc' we go
>>    
>>
>in 
>  
>
>>here, we wont the first time but when we go around the second time we 
>>will go in.
>>    {   
>>        // try bind select to variable
>>        dbbind(dbconn, 1, INTBIND, (DBINT)0, (BYTE *)& InsertID);
>>    
>>
>//its 
>  
>
>>says its binding ok but what its binding i cant be sure!
>>
>>       if (dbnextrow(dbconn) != NO_MORE_ROWS)
>>                journey_insert_id = InsertID;
>>    }
>>}
>>    
>>
>
>In addition to Bill's advice, make sure you're checking the return code
>from each db-lib call.  And you might want to do some sanity checks with
>dbcoltype(), dbnumcols(), dbcolname() to make sure the column you're
>binding to is really the one you're expecting.  
>
>BTW, re the pool server, I don't have anything for you.  Someone more
>familiar with the code (and/or more motivated) would need to look at it.
>
>
>HTH.  
>
>--jkl
>
>-----------------------------------------
>The information contained in this transmission may be privileged and
>confidential and is intended only for the use of the person(s) named
>above. If you are not the intended recipient, or an employee or agent responsible
>for delivering this message to the intended recipient, any review, dissemination,
>distribution or duplication of this communication is strictly prohibited. If you are
>not the intended recipient, please contact the sender immediately by reply e-mail
>and destroy all copies of the original message. Please note that we do not accept
>account orders and/or instructions by e-mail, and therefore will not be responsible
>for carrying out such orders and/or instructions.  If you, as the intended recipient
>of this message, the purpose of which is to inform and update our clients, prospects
>and consultants of developments relating to our services and products, would not
>like to receive further e-mail correspondence from the sender, please "reply" to the
>sender indicating your wishes.  In the U.S.: 1345 Avenue of the Americas, New York,
>NY 10105.
>
>  
>


-- 
Shaun Craig
Andronics Ltd. 
Tel: 02871273118
Web: http://www.andronics.co.uk



More information about the FreeTDS mailing list