🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: cn.bbs.comp.database
Article #946

Re: ����̡�mysql����

#946
From: wayfarer
Date: Mon, 01 Sep 2008 14:36
44 lines
2654 bytes
perl�Ҳ���

����mysql����������������ֶ���ɡ�����޸�sql�����������⡣

ALTER TABLE todo ADD id INT(32) NOT NULL AUTO_INCREMENT,
                 ADD PRIMARY KEY(id);

�Ҿ���Ӧ���������

���Ҫ����ԭ���������ټ�һ�䣺DROP PRIMARY KEY





�� �� crazymans (����������) �Ĵ������ᵽ: ��
ԭ�����еģ��������ֱ����mysql��ʹ�ã�����
SELECT * FROM todo where id=��
�ǿ��Եģ�

ֻ����perl��������õ�ʱ����������ˡ�

�� �� wayfarer �Ĵ������ᵽ: ��
: ���id���޸���ӵģ����todo����ԭ��û��primary key�᣿
: �� �� crazymans (����������) �Ĵ������ᵽ: ��
: ����һ���Ѿ����ڵ���Ϊ��todo���ı���������һ��id���������£�
: mysql> ALTER TABLE todo ADD id INT NOT NULL AUTO_INCREMENT PRIMARY KEY;
: Ȼ����perl����ݿ��ж�ȡ��ݵ�ʱ���֣�Ҫƥ��id��ʱ��ֻ���á�where id l..
: �����ſ��ԣ����£�
: $sth = $dbh->prepare("SELECT * FROM todo where id like ?");
: $sth->execute($id);
: ���Dz������á�where id= �������������
: $sth = $dbh->prepare("SELECT * FROM todo where id like ?");
: $sth->execute($id);
: �����Ͱ���û�з�Ӧ��Ҳû�б���ʲô�ġ�
: ���ʸ��֣�������ô�����أ���

--
�����ğo�࣬��������
�������o�ģ������Ĝ硿
 
--

�� ��Դ:����ˮ˼Դ bbs.sjtu.edu.cn��[FROM: 58.33.71.25]
Technical Details
Message-ID: <4bg32P$ami@bbs.sjtu.edu.cn>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news.neu.edu.cn!news.shec6.edu.cn!SJTU

Show Full Headers
Complete Article Headers
X-Google-Thread: 101948,8912d7db37f2aa83
X-Google-Attributes: gid101948,domainid0,public,usenet
X-Google-Language: Chinese,GB
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news.neu.edu.cn!news.shec6.edu.cn!SJTU
From: wayfarer.bbs@bbs.sjtu.edu.cn (wayfarer)
Newsgroups: cn.bbs.comp.database
Subject: Re: ����̡�mysql����
Date: 01 Sep 2008 14:36:09 GMT
Organization: ��ˮ˼Դ
Message-ID: <4bg32P$ami@bbs.sjtu.edu.cn>
Mime-Version: 1.0
Content-Type: text/plain; charset="gb2312"
Content-Transfer-Encoding: 8bit
X-Filename: database/M.1220279161.A
Lines: 43