column 'pin' is an 5-digit integer auto_increment primary key.
What i want is to insert a new record or update the existing one, if 'pin'
column's value exist. The following statement fails.
[code]
cursor.execute( '''INSERT INTO counters(page, hits) VALUES(%s, %s) RETURNING
(pin)
ON DUPLICATE KEY UPDATE hits = hits + 1''', (htmlpage,
1) )
[/code]
Also except from the inserting/updating job, i also need 'pin' colum's value to
be extracted from the above statement so to be used to subsequent statement
like the following. This is not happening, hence the following statement have
no way to find 'pin' column's value which is to be used as a parameter to it.
[code]
cursor.execute( '''UPDATE visitors SET hits = hits + 1, useros = %s, browser =
%s, date = %s WHERE pin = %s AND host = %s''', (useros, browser, date, pin,
host))
[/code]
Can someone correct this please and explain?
--
http://mail.python.org/mailman/listinfo/python-list