Sorry, I missed the version at the end of your message. I wouldn't know
about the ?MultipoQuery=True bit. Ive never used or heard of it.

In the select...try

Select @@identity as newid;

Odds are that it's going to give you the same thing since @@identity is
basically a shortcut for last_insert_id() but who knows.
 
..:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.
Bobby Hartsfield
http://acoderslife.com
 
 

-----Original Message-----
From: Baz [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 09, 2006 9:32 AM
To: CF-Talk
Subject: RE: Get last inserted ID

MySQL5... someone mentioned to append: ?MultipleQuery=True (or something
like that) to my connection string in the DB... but it didn't work.


-----Original Message-----
From: Bobby Hartsfield [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 09, 2006 9:26 AM
To: CF-Talk
Subject: RE: Get last inserted ID

What version of MySQL was this?
 
....:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.:.
Bobby Hartsfield
http://acoderslife.com
 
 

-----Original Message-----
From: Baz [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 09, 2006 1:00 AM
To: CF-Talk
Subject: RE: Get last inserted ID

Thanks for the info guys - all this makes me really sad... I remember
researching this a long, long time ago and was recommended using
cftransaction - so I did - for EVERY insert for all my apps. Now it seems I
have major changes ahead of me... 

If I don't post for a while you'll know why...

Baz

P.S. 

Bobby, the query returned this error: 

"You have an error in your SQL syntax; check the manual that corresponds to
your MySQL server version for the right syntax to use near '; Select
LAST_INSERT_ID() as newid' at line 2"

This is the exact test query I used:

<cfquery NAME='myqry' datasource="mydsn">
Insert into customer (customerdate,customeruserid) 
Values (<cfqueryparam value="#now()#"
cfsqltype="CF_SQL_TIMESTAMP">,<cfqueryparam value="1"
cfsqltype="CF_SQL_INTEGER">); Select LAST_INSERT_ID() as newid; 
</cfquery>

My DB is MySQL 5


-----Original Message-----
From: James Holmes [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 09, 2006 12:45 AM
To: CF-Talk
Subject: Re: Get last inserted ID

It happens because Oracle and most other DBs do not default to
serializable transactions; Oracle, for example, defaults to read
committed, which means that your transaction can read other committed
data even if it happened during your transaction (although in Oracle
this level does provide statement-level consistency). MySql defaults
to repeatable read as far as I could tell from a quick google.

Info on Oracle:
http://www.oracle.com/technology/oramag/oracle/05-nov/o65asktom.html

and MySQL
http://dev.mysql.com/doc/refman/4.1/en/innodb-transaction-isolation.html


On 1/9/06, Baz <[EMAIL PROTECTED]> wrote:
> What does cftransaction do then?
>
> The livedocs say that it "can be used to group multiple queries that use
> CFQUERY into one business event". How do other events occur in between
"one"
> event?
>
--
CFAJAX docs and other useful articles:
http://jr-holmes.coldfusionjournal.com/









~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:228828
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to