Class: mysql

MySQL查询类
$mysql->init($host, $user, $pass, $charse)   // Set the Database Class
$mysql->connect($pconnect)                   // Build a Connection to MySQL to $mysql->DB_conn
$mysql->reconnect($pconnect)                 // Rebuild a Connection to MySQL to $mysql->DB_conn
$mysql->selectDB($the_db)                    // Select a Database of MySQL to $mysql->DB_select (Must Build Connect First)
$mysql->setCharset($charset)                 // Set Charset for the database connection
$mysql->changUser($user, $pass, $db)         // Change the Database User (Unusable in some versoin of MySQL)
$mysql->query($sql)                          // Execute a Query of MySQL, Result into $mysql->DB_resut
$mysql->getRS()                              // Return The Current Result as an Array and Set the Point of Result to the Next Result
$mysql->record()                             // Get the first line of the record set
$mysql->records()                            // Get the all of the lines of the query
$mysql->result()                             // Get the single value of the query with the parameters of buildSel function
$mysql->count($sql)                          // Count the result number of current query
$mysql->getData($line, $field)               // Get specified field or line of a query
$mysql->GetFields($the_db, $the_tbl)         // Get the Columns List of a Table as an Array
$mysql->getCreateScript($the_tbl, $the_db)   // Get the Whole structure of Current Selected Database as an Array
$mysql->getDataScript($the_tbl, $the_db)     // Get All of The Data of a Table
$mysql->getIdxScript($the_tbl, $the_db)      // Get the Indexes List of a Table as an Array
$mysql->getDBs()                             // Get the Databases List of Current MySQL Server as an Array
$mysql->getTbls($the_db)                     // Get the Tables List of Current Selected Database as an Array
$mysql->getPri($the_tbl, $the_db)            // Get the Primary Keys of a Table as an Array
$mysql->getInsertId()                        // Return auto increment id generate by insert query
$mysql->optTabs()                            // Optimize the Tables of Selected Database
$mysql->getStat()                            // Get the Current Status of MySQL
$mysql->getProcesses($mode, $time_limit)     // Get the processes list of MySQL
$mysql->create($name, $para, $type)          // Create Object
$mysql->drop($name, $para, $type)            // Drop Object
$mysql->select()                             // Build a select query use the SQL builder and execute it
$mysql->update()                             // Build a replace query use the SQL builder and execute it
$mysql->delete()                             // Build a delete query use the SQL builder and execute it
$mysql->replace()                            // Build a replace query use the SQL builder and execute it
$mysql->batchExec($SQLs)                     // Execute Multi Query from an Array (Use HandleSQL First)
$mysql->handleSQL($strSQL)                   // Split the SQL Query String into a array from a whole String (Maybe Read from a File)
$mysql->file($file)                          // Read SQL File and execute it
$mysql->check($obj, $type)                   // Check if a db object works
$mysql->free()                               // Free the $mysql->DB_result in order to Release the System Resource
$mysql->close(&$err_info)                    // Close Current MySQL Link
$mysql->checkError()                         // Check if error occured
$mysql->clearError()                         // Clear Errors Information
$mysql->error($str)                          // Handle the Errors
1 __construct
     * 构造函数
     
2 init
     * 初始化实例
     * @param $host
     * @param $user
     * @param $pwd
     * @param string $charset
     
3 connect
     * 连接数据库服务器
     * @param bool $pconnect
     * @param null $the_db
     * @return bool
     
4 reconnect
     * 重连数据库服务器
     * @param bool $pconnect
     * @param null $the_db
     
5 selectDB
     * 选择数据库
     * @param $the_db
     * @return bool
     
6 setCharset
     * 设置字符集
     * @param string $charset
     * @return string
     
7 changUser
     * 变更操作用户
     * @param $user
     * @param $pwd
     * @param null $db
     * @return bool
     
8 query
     * 执行查询
     * @param $sql
     * @param bool $reset
     * @return bool|int
     
9 getRS
     * 取得结果集
     * @param int $mode
     * @return array|bool|null
     
10 getData
     * 获取结果集某一行某一列
     * @param int $line
     * @param string $field
     * @return array|bool|mixed|null
     
11 getFields
     * 获取某一数据表的所有列
     * @param $the_tbl
     * @param string $the_db
     * @return array
     
12 getCreateScript
     * 取得建立数据表的脚本
     * @param $the_tbl
     * @param string $the_db
     * @return string
     
13 getDataScript
     * 取得插入数据的脚本
     * @param $the_tbl
     * @param string $the_db
     * @return mixed|string
     
14 getIdxScript
     * 取得设置索引项的脚本
     * @param $the_tbl
     * @param string $the_db
     * @return array
     
15 getDBs
     * 取得所有数据库名
     * @return array
     
16 getTbls
     * 取得所有表名
     * @param string $the_db
     * @param string $pattern
     * @return array
     
17 getPri
     * 取得主键名
     * @param $the_tbl
     * @param string $the_db
     * @return mixed|string
     
18 getInsertId
     * 取得新插入的自增ID
     * @return array|bool|int|mixed|null|string
     
19 optTabs
     * 优化数据表
     * @return bool
     
20 getStat
     * 取得数据库当前状态
     * @return array|string
     
21 getProcesses
     * 取得当前进程
     * @param int $mode
     * @param int $time_limit
     * @return array|string
     
22 replace
     * 更新替换数据
     * @return mixed
     
23 batchExe
     * 批量执行查询语句
     * @param $SQLs
     * @return array|bool
     
24 handleSQL
     * 处理批量查询文本
     * @param $strSQL
     * @return array
     
25 file
     * 执行数据查询文件
     * @param $file
     * @param array $find
     * @param array $replace
     * @return array|bool
     
26 check
     * 检测数据连接状态
     * @param string $obj
     * @param string $type
     * @return bool|mixed|null
     
27 free
     * 释放数据查询
     
28 close
     * 关闭数据服务器连接
     * @param array $err_info
     * @return int
     
29 checkError
     * 检查错误
     * @param array $err_info
     * @return bool
     
30 clearError
     * 清空已有错误
     
31 error
     * 错误处理
     * @param $str
     * @param bool $exit
     
32 setErrHandler
     * 设置错误处理函数
     * @param $func
     
33 safeName
     * 获取安全的名称(数据库、表及字段)
     * @param $name
     * @return null|string|string[]
     
34 safeValue
     * 获取安全的字段值
     * @param $val
     * @return mixed
     
35 cache
     * 设置外部缓存模式 0 - 关闭, 1 - 可读, 2 - 可写,3 - 可读写
     * @param null $mode
     * @return int|null
     
36 setCache
     * 设置外部缓存
     * @param $cache
     * @param int $ttl
     
37 getCache
     * 检查缓存是否存在
     * @param $key
     * @return mixed
     
38 writeCache
     * 写入缓存
     * @param $key
     * @param $result
     
39 build
     * 构建数据查询
     * @param $tbl
     * @param null $join
     * @return mixed|void
     
40 create
     * 创建对象
     * @param $name
     * @param array $para
     * @param string $type
     * @param bool $show
     * @return bool|int
     
41 drop
     * 移除对象
     * @param $name
     * @param string $type
     * @param bool $show
     * @return bool|int|string
     
42 insert
     * 插入数据
     * @param bool $show
     * @return bool|int
     
43 select
     * 查询数据
     * @param bool $show
     * @return bool|int|string
     
44 update
     * 更新数据
     * @param bool $show
     * @return bool|int|string
     
45 delete
     * 删除数据
     * @param bool $show
     * @return bool|int|mixed|string
     
46 record
     * 返回单一结果集
     * @param $sql
     * @param int $mode
     * @return array|bool|null
     
47 records
     * 放回全部结果集
     * @param string $sql
     * @param int $mode
     * @return false|mixed
     
48 result
     * 返回单一结果值
     * @param string $sql
     * @return array|bool|mixed|null
     
49 count
     * 返回当前查询的结果数
     * @param string $sql
     * @return array|bool|mixed|null
     
50 correctDelimiter
     * 将mysql定界符更正为对应数据库的定界符
     * @param $sql
     * @return mixed