[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]



On Thu, 2005-06-09 at 08:25 -0400, Michael B. Trausch wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: RIPEMD160
> 
> James Sumners wrote:
> > It would be better to do the INSERT first and then get the number.
> > That way you can be sure that it is the correct number. But, "SELECT
> > pri_key_num + 1 FROM table ORDER BY pri_key_num DESC LIMIT 1;"
> > 
> 
> Also, note that this will only work if there are zero deletions from the
> table in question.  If you make a deletion in a table, and you don't
> re-order the table by pri_key_num, then eventually you will find that
> you're performing INSERTs that aren't any longer using the correct row
> ids, and you'll have gaps in numbering if you use any other method to
> add a number.
> 
> Checking the new Row ID after an insert is the only real way to go about it.
> 
> 	- Mike
> 
> - --
> Michael B. Trausch                                     fd0man at gmail.com
&gt; Web: <a  rel="nofollow" href="http://fd0man.theunixplace.com/";>http://fd0man.theunixplace.com/</a>        Jabber: mtrausch at jabber.com
&gt; Phone: +1-(678)-522-7934                  FAX (US Only): 1-866-806-4647
&gt; =======================================================================
&gt;   Do you have PGP or GPG?  Key at pgp.mit.edu, Please Encrypt E-Mail!
&gt; 
&gt; 
&gt; -----BEGIN PGP SIGNATURE-----
&gt; Version: GnuPG v1.4.1 (GNU/Linux)
&gt; Comment: Using GnuPG with Thunderbird - <a  rel="nofollow" href="http://enigmail.mozdev.org";>http://enigmail.mozdev.org</a>
&gt; 
&gt; iD8DBQFCqDVWPXInbkqM7nwRA8CDAJ0VdF6T7s7ll93/wKScKIqoxiXGdwCeKgeH
&gt; /eiTjnrIkApxNRBfTsmRGPI=
&gt; =xfuC
&gt; -----END PGP SIGNATURE-----
&gt; _______________________________________________
&gt; Ale mailing list
&gt; Ale at ale.org
&gt; <a  rel="nofollow" href="http://www.ale.org/mailman/listinfo/ale";>http://www.ale.org/mailman/listinfo/ale</a>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: serial.pl
Type: application/x-perl
Size: 1843 bytes
Desc: not available



</pre>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<hr>
<ul><li><strong>Follow-Ups</strong>:
<ul>
<li><strong><a name="00406" href="msg00406.html">[ale] Getting the next index of a table in mysql</a></strong>
<ul><li><em>From:</em> fd0man at gmail.com (Michael B. Trausch)</li></ul></li>
</ul></li></ul>
<!--X-Follow-Ups-End-->
<!--X-References-->
<ul><li><strong>References</strong>:
<ul>
<li><strong><a name="00401" href="msg00401.html">[ale] Getting the next index of a table in mysql</a></strong>
<ul><li><em>From:</em> cfowler at outpostsentinel.com (Chris Fowler)</li></ul></li>
<li><strong><a name="00402" href="msg00402.html">[ale] Getting the next index of a table in mysql</a></strong>
<ul><li><em>From:</em> james.sumners at gmail.com (James Sumners)</li></ul></li>
<li><strong><a name="00403" href="msg00403.html">[ale] Getting the next index of a table in mysql</a></strong>
<ul><li><em>From:</em> fd0man at gmail.com (Michael B. Trausch)</li></ul></li>
</ul></li></ul>
<!--X-References-End-->
<!--X-BotPNI-->
<ul>
<li>Prev by Date:
<strong><a href="msg00404.html">[ale] Question: Transparent document sharing over the Internet</a></strong>
</li>
<li>Next by Date:
<strong><a href="msg00406.html">[ale] Getting the next index of a table in mysql</a></strong>
</li>
<li>Previous by thread:
<strong><a href="msg00403.html">[ale] Getting the next index of a table in mysql</a></strong>
</li>
<li>Next by thread:
<strong><a href="msg00406.html">[ale] Getting the next index of a table in mysql</a></strong>
</li>
<li>Index(es):
<ul>
<li><a href="maillist.html#00405"><strong>Date</strong></a></li>
<li><a href="threads.html#00405"><strong>Thread</strong></a></li>
</ul>
</li>
</ul>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
</body>
</html>