[PHP-users 3002] Re: PEAR+Postgres¤Ç Ins ert »þ¤Î¥·¥ê¥¢¥ë¤òÃΤꤿ¤¤
À¶¿å¡¡¾¼Çî
[email protected]
Sat, 20 Oct 2001 17:39:02 +0900 (JST)
À¶¿å¤Ç¤¹
On Sat, 20 Oct 2001 16:15:55 +0900
KOYAMA Tetsuji <[email protected]> wrote:
> PHP-4.0.6 ¤ËÉí°¤¹¤ë PEAR ¤«¤é nextId() ¥á¥½¥Ã¥É¤¬»È¤¨¤ë¤è¤¦¤Ë¤Ê¤Ã¤Æ
> ¤Þ¤¹¡£
>
> $db = DB::conecct('pgsql://localhost/dbname');
> $seqnum = $db->nextId('seqname');
ÄɲþðÊó¤Ç¤¹¡£
PostgreSQL¤Î¾ì¹ç¡¢Serial·¿¤Î¾ì¹ç¥·¡¼¥±¥ó¥¹Ì¾¤Ï¡¢¥Ç¥Õ¥©¥ë¥È¤Ç
¥Æ¡¼¥Ö¥ë̾_¥Õ¥£¡¼¥ë¥É̾_seq ¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¤¬¡¢nextId¤Î°ú¿ô¤Ë¤Ä¤±¤ë
seqname¤Ï¡¢ºÇ¸å¤Î _seq ¤ò½ü¤¤¤¿Ì¾Á°¤Ë¤·¤Ê¤¤¤ÈnextId¥á¥½¥Ã¥ÉÆâ¤Ç
¼«Æ°Åª¤Ë _seq ¤ò¤Ä¤±¤Æ¤·¤Þ¤¹¡£
¤µ¤é¤Ë¡¢³ºÅö¤Î¥·¡¼¥±¥ó¥¹¤¬¸«¤Ä¤«¤é¤Ê¤¤¤È¼«Æ°Åª¤Ë¥·¡¼¥±¥ó¥¹¤òÀ¸À®¤·¤Æ¡¢
À¸À®¤·¤¿¥·¡¼¥±¥ó¥¹¤Î nextval ¤òÊÖ¤·¤Æ¤¯¤ì¤Þ¤¹¡£
(¤³¤ì¤Ã¤Æ¥Ð¥°¤¸¤ã¤Ê¤¯¤Æ¡¢»ÅÍͤǤ¹¤è¤Í¤§¡©)
»ä¤Î¤È¤³¤í¤Ç¤Ï¡¢³«È¯¼Ô¤¬¤è¤¯´Ö°ã¤¦¤Î¤Ç¡¢nextId¥á¥½¥Ã¥É¤ò½ñ¤´¹¤¨¤Æ
_seq¤ò¤Ä¤±¤Ê¤¤¤è¤¦¤Ë¤·¤Æ¤·¤Þ¤¤¤Þ¤·¤¿¡£
--
À¶¿å¡¡¾¼Çî <[email protected]>
SETI¥é¥ó¥¥ó¥°¡§87,788/3,121,706°Ì(7/05¸½ºß)
SETI@home(¥»¥Á¡¦¥¢¥Ã¥È¡¦¥Û¡¼¥à)¤È¤Ï¡¢
Ãϵ峰ÃÎŪÀ¸Ì¿ÂΤÎõºº(SETI)¤ò¹Ô¤Ê¤¦²Ê³Ø¼Â¸³¤Ç¤¹¡£