[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
- <!--x-content-type: text/plain -->
- <!--x-date: Thu Jun 9 09:03:10 2005 -->
- <!--x-from-r13: psbjyre ng bhgcbfgfragvary.pbz (Quevf Tbjyre) -->
- <!--x-message-id: [email protected] -->
- <!--x-reference: [email protected] -->
- <!--x-reference: [email protected] -->
- <!--x-reference: [email protected] --> "http://www.w3.org/TR/html4/loose.dtd">
- <!--x-subject: [ale] Getting the next index of a table in mysql -->
- <li><em>date</em>: Thu Jun 9 09:03:10 2005</li>
- <li><em>from</em>: cfowler at outpostsentinel.com (Chris Fowler)</li>
- <li><em>in-reply-to</em>: <<a href="msg00403.html">[email protected]</a>></li>
- <li><em>references</em>: <<a href="msg00401.html">[email protected]</a>> <<a href="msg00402.html">[email protected]</a>> <<a href="msg00403.html">[email protected]</a>></li>
- <li><em>subject</em>: [ale] Getting the next index of a table in mysql</li>
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
> Web: <a rel="nofollow" href="http://fd0man.theunixplace.com/">http://fd0man.theunixplace.com/</a> Jabber: mtrausch at jabber.com
> Phone: +1-(678)-522-7934 FAX (US Only): 1-866-806-4647
> =======================================================================
> Do you have PGP or GPG? Key at pgp.mit.edu, Please Encrypt E-Mail!
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.1 (GNU/Linux)
> Comment: Using GnuPG with Thunderbird - <a rel="nofollow" href="http://enigmail.mozdev.org">http://enigmail.mozdev.org</a>
>
> iD8DBQFCqDVWPXInbkqM7nwRA8CDAJ0VdF6T7s7ll93/wKScKIqoxiXGdwCeKgeH
> /eiTjnrIkApxNRBfTsmRGPI=
> =xfuC
> -----END PGP SIGNATURE-----
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> <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>