background image

37. //发送 SQL 查询,并返回结果集      
38. function query($query_id, $query_type='mysql_query'){      
39. $this->query_id = $query_type($query_id, $this->connection_id);      
40. $this->queries[] = $query_id;      
41. if (! $this->query_id ) {      
42. $this->halt("查询失败:\n$query_id");      
43. }      
44. $this->query_count++;      
45. $this->query_log[] = $str;      
46. return $this->query_id;      
47. }      
48. //发送 SQL 查询,并不获取和缓存结果的行      
49. function query_unbuffered($sql=""){      
50. return $this->query($sql, 'mysql_unbuffered_query');      
51. }      
52. //从结果集中取得一行作为关联数组      
53. function fetch_array($sql = ""){      
54. if ($sql == "") $sql = $this->query_id;      
55. $this->record_row = @mysql_fetch_array($sql, MYSQL_ASSOC);      
56. return $this->record_row;      
57. }      
58. function shutdown_query($query_id = ""){      

59.

$this->shutdown_queries[] = $query_id;      

60. }      
61. //取得结果集中行的数目,仅对 INSERT,UPDATE 或者 DELETE      
62. function affected_rows() {      
63. return @mysql_affected_rows($this->connection_id);      
64. }      
65. //取得结果集中行的数目,仅对 SELECT 语句有效      

66.

function num_rows($query_id="") {      

67. if ($query_id == "") $query_id = $this->query_id;      
68. return @mysql_num_rows($query_id);      
69. }      
70. //返回上一个 MySQL 操作中的错误信息的数字编码      
71. function get_errno(){      
72. $this->errno = @mysql_errno($this->connection_id);      

73.

return $this->errno;      

74. }      
75. //取得上一步 INSERT 操作产生的 ID      
76. function insert_id(){      
77. return @mysql_insert_id($this->connection_id);      
78. }      
79. //得到查询次数      
80. function query_count() {