PDO4You 3.0 发布,增加MariaDB数据库支持

jopen 11年前

PDO4You这个类是基于PDO,这是一个PHP扩展,允许开发人员创建可移植的代码,从而满足最流行的数据库。包括:MySQL, PostgreSQL, Oracle, MS SQL Server, Sybase。

  • 抽象的连接
  • 防止SQL注入
  • 预定义的CRUD方法
  • 多数据库连接
  • SQL compact using JSON notation
  • Handling errors with Stack Trace

查询数据库中的记录  <?php    // Starting a connection instance. The default connection is not persistent  PDO4You::getInstance();    // Defining a persistent communication with the database  PDO4You::setPersistent(true);    // Selecting records in the database  PDO4You::select('SELECT * FROM books LIMIT 2');    // Selecting records and setting that connection instance will be used  PDO4You::select('SELECT * FROM books LIMIT 2', 'instance_name');      // Query statement  $sql = 'SELECT * FROM books LIMIT 2';    // Selecting records with FETCH_ASSOC  $result = PDO4You::select($sql);    // Selecting records with FETCH_NUM  $result = PDO4You::selectNum($sql);    // Selecting records with FETCH_OBJ  $result = PDO4You::selectObj($sql);    // Selecting records with FETCH_BOTH  $result = PDO4You::selectAll($sql);      // Selecting all records  $result = PDO4You::select('SELECT * FROM books');    // Getting the total number of rows affected by the operation  $total = PDO4You::rowCount();    // Displaying the query results  echo '<pre><h3>Query Result:</h3> ' , print_r($result, true) , '</pre>';    ?>

这次发布主要是支持MariaDB数据库。