Hi,

Newbie question (MySql 5.0 using C API). I've searched the mysql
website/Internet but cannot find the answer.

How do I update a record obtained from a query result while ensuring that:

1) The record is the actual record in the database not a possible duplicate,
e.g. is there a built-in record number identifying the actual DB record or
do I have to organise that in the table structure.

2) The record hasnt been or cannot be changed by another thread/process,
possibly by. locking / re-reading the record (is there another way?).

How do I lock and re-read the [actual] record anyway?

Code snippet:

 sprintf(szStr,
         "SELECT * FROM %s WHERE UserName = '%s'",
         DB_TABLE,
         szUserName);

 if(mysql_real_query(db, szStr, strlen(szStr)) == 0)
  {
   result = mysql_store_result(db);

   if(result)  // There are rows
    {
     while ((row = mysql_fetch_row(result)))
      {
       // *** I need to update the record here! ***
      }

     mysql_free_result(result);
    }

TIA.

Jan




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to