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

</body>
</html>