INNODB和mysql PDO驱动程序在共享模式下锁定

With INNODB you can add to your query LOCK IN SHARE MODE; so that other users can still read but not update untill the user that is editing is finished.

My current PDO function in PHP currently looks like:

//$this->db is a PDO connection to the MYSQL innodb database.
try 
    {
    $this->db->beginTransaction();
    $tmp = $this->db->prepare($query);  

    $tmp->execute($arr);
    $this->last_id = $this->db->lastInsertId();
    $this->db->commit();
    return $this->last_id;
    }
catch(PDOException $ex)
    {
    $this->db->rollBack();
    return $ex->getMessage();
    }

Is there an PDO driver function setting to set it in share mode? if so how? The only things I find have no answers to them and the documentation isn't really clear either. Or should I add it simply to the query string?

You have to create your query to mach the MySQL syntax and that's all, for example:

SELECT * FROM parent WHERE NAME = 'Jones' LOCK IN SHARE MODE

Just append the LOCK IN SHARE MODE to the query string.