Re: Indexing with MySql
1) Why not use "CREATE TABLE IF NOT EXITS .." ? I also don't see the need of two tables. Just make one, and put PRIMARY KEY (mac). This means MACs will be unique.
2) You can try to insert the data and catch the exception when a duplicate key is found:
try:
cur.execute("INSERT INTO data (mac,..) VALUES ('newmacaddress',..)
except IntegrityError:
# Do something when the MAC was already in the table
else:
# Do something when the MAC was newly inserted
Sorry for the late reply, but I hope it helps anyways.
Geert
Geert Vanderkelen
Software Developer at Oracle
Subject
Written By
Posted
Re: Indexing with MySql
April 19, 2011 05:47AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.