<html>
<!-- BEGIN WEBMAIL STATIONERY -->
<head></head>
<body>
<!-- WEBMAIL STATIONERY noneset -->
<DIV></DIV>
<P>I'm wondering if I can do both queries at once, such as "SELECT @article_id FROM CALL sp_Create()".</P>
<P> </P>
<P>Carl<BR></P>
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">-------------- Original message from "Carl Olsen" <carl-olsen@mchsi.com>: -------------- <BR><BR><BR>> I like your attitude. I can't remember when the last user meeting was <BR>> scheduled, but this would be a great topic! <BR>> <BR>> Thank you! <BR>> <BR>> Carl <BR>> <BR>> -----Original Message----- <BR>> From: Tony Bibbs [mailto:tony@tonybibbs.com] <BR>> Sent: Tuesday, July 11, 2006 7:15 AM <BR>> To: carl-olsen@mchsi.com; ciapug@cialug.org <BR>> Subject: Re: [ciapug] Re: Re: MySQL 5 Stored Procedures (correction) <BR>> <BR>> More than likely, yes, you will need to do two queries. One does the <BR>> insert, one to get the last_insert_id. FWIW that ORM I was speaking of, <BR>> Propel, would have given you the id: <BR>> <BR>> // Instantiate some generated Propel Object <BR>> $myObj = new SomePropelObject(); <BR>> <BR>> // Set so
me data on object <BR>> $myObj->setAttribute1($foo); <BR>> $myObj->setAttribute2($foo); <BR>> <BR>> // Now save. Propel can manage if it needs to do an INSERT <BR>> // or an UPDATE for you. <BR>> $myObj->save(); <BR>> <BR>> // After the save our autogenerated ID will have a value <BR>> echo $myObj->getSomePrimaryKey(); <BR>> <BR>> Writing SP's (and SQL in general) is over-rated. I'd rather on meeting <BR>> business requirements and leave the lower level database stuff to the ORM. <BR>> <BR>> Speaking of which, if it hasn't been done already, I'd be willing to <BR>> cover Propel at one of the meetings since I'm yapping about it so much. <BR>> <BR>> --Tony <BR>> <BR>> Carl Olsen wrote: <BR>> > I put EVERYTHING possible in my databases, but I never use a third party <BR>> > tool to do it. I use the SQL Server Enterprise Manager for SQL Server, <BR>> > SQLyog for MySQL, and linux command line for Pos
tgreSQL. I guess I just <BR>> > find this stuff interesting and it works well for what I'm doing. In <BR>> regard <BR>> > to my original question, I have code for PostgreSQL stored procedures that <BR>> > just returns the value of the inserted ID without having to do two <BR>> queries. <BR>> > That's why I was wondering if I was doing something wrong with MySQL. I <BR>> > looks like I have to do two queries to do the same thing I can do with <BR>> > PostgreSQL or SQL Server with one query. <BR>> <BR>> _______________________________________________ <BR>> ciapug mailing list <BR>> ciapug@cialug.org <BR>> http://cialug.org/mailman/listinfo/ciapug </BLOCKQUOTE>
<!-- END WEBMAIL STATIONERY -->
</body>
</html>