Dear all,
I am trying to find a way of obtaining the primary key field name on a mySQL
db. I wish to perform an operation at run-time which necessitates the use
of the PK field name.
The operation is as follows. The purpose of this code is to create a log of
user activity on the database as a whole. I want to store the record they
altered/added in the log. form.userid has been hard coded. it should
contain "form.whatever the primary key for the active table is". Active
table being defined in another variable "auditQueryTable".
INSERT INTO applicationaudit
(username,action,querytype,querytable,recordid,datetime)
VALUES
('#session.username#','#auditAction#','#auditQueryType#','#auditQueryTable#'
,
#IIF(auditQueryType EQ "update", DE("form.userid"),
DE("LAST_INSERT_ID()"))#,
#CreateODBCDateTime(Now())#)
What I need to know is, is there a way of obtaining the name of the PK
field. Also, does SHOW return a usable result set? It has been suggested
this might be a valid support case, so if you guys don't know, I'll put it
to the programming team at mySQL.com and post the results here for your
reference.
Kind regards,
Martin.
______________________________________________________________________
Get Your Own Dedicated Windows 2000 Server
PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
Instant Activation � $99/Month � Free Setup
http://www.pennyhost.com/redirect.cfm?adcode=coldfusionb
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists