Skip to Content.
Sympa Menu

freetds - Re: [freetds] SELECT @@IDENTITY AS InsertID

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Thompson, Bill D (London)" <bill_d_thompson AT ml.com>
  • To: <s.craig AT andronics.com>, "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] SELECT @@IDENTITY AS InsertID
  • Date: Wed, 12 Oct 2005 09:22:11 +0100

Shaun,

get us a TDSDUMP log file:

export TDSDUMP=<filename>

run the application.

Post us the results.

Bill


-----Original Message-----
From: freetds-bounces AT lists.ibiblio.org
[mailto:freetds-bounces AT lists.ibiblio.org] On Behalf Of Shaun Craig
Sent: 12 October 2005 09:12
To: FreeTDS Development Group
Subject: Re: [freetds] SELECT @@IDENTITY AS InsertID


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

_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds
--------------------------------------------------------

If you are not an intended recipient of this e-mail, please notify the
sender, delete it and do not read, act upon, print, disclose, copy, retain or
redistribute it. Click here for important additional terms relating to this
e-mail. http://www.ml.com/email_terms/
--------------------------------------------------------




Archive powered by MHonArc 2.6.24.

Top of Page