日期:2014-05-17 浏览次数:20454 次
public static function query($sql, $unbuffered = false) {
$ret = self::$db->query($sql, $unbuffered);//该句成功时$ret为1 注::self::$db->query为mysql_query
if ($unbuffered===true) {
$cmd = trim(strtoupper(substr($sql, 0, strpos($sql, ' '))));
if ($cmd === 'SELECT') { }
elseif ($cmd === 'UPDATE' || $cmd === 'DELETE') {
$ret = self::$db->affected_rows();
}
elseif ($cmd === 'INSERT') {
$ret = self::$db->insert_id();//该处运行时证明执行了,返回的是int类型id号
}
}
return $ret;//最终返回不是int类型id号
}