in reply to How to count rows using DBI & mysql - Performance results
Declare your unique index to be a primary key. $sth->execute will fail if you try to insert a duplicated primary key.
mysql> create table trial (id varchar(5) primary key, perl_mod varchar +(30), summary varchar(255)); Query OK, 0 rows affected (0.06 sec) mysql> insert into trial set id='aaaaa', > perl_mod='CGI', > summary='Essential'; Query OK, 1 row affected (0.04 sec) mysql> insert into trial set id='aaaab', > perl_mod='DBI', > summary='Essential'; Query OK, 1 row affected (0.00 sec) mysql> insert into trial set id='aaaab', > perl_mod='Lingua__Romana__Perligata', > summary='Fun'; ERROR 1062: Duplicate entry 'aaaab' for key 1 mysql>
After Compline,
Zaxo
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: How to count rows using DBI & mysql - Performance results
by jepri (Parson) on Jun 11, 2001 at 20:20 UTC | |
by Zaxo (Archbishop) on Jun 11, 2001 at 23:11 UTC | |
by elwarren (Priest) on Jun 11, 2001 at 23:14 UTC | |
Re: Re: How to count rows using DBI & mysql - Performance results
by hding (Chaplain) on Jun 11, 2001 at 17:51 UTC | |
Re: Re: How to count rows using DBI & mysql - Performance results
by Brovnik (Hermit) on Jun 11, 2001 at 18:45 UTC | |
by Zaxo (Archbishop) on Jun 11, 2001 at 19:25 UTC | |
by hding (Chaplain) on Jun 11, 2001 at 19:07 UTC | |
by elwarren (Priest) on Jun 11, 2001 at 22:38 UTC |
In Section
Meditations