[原]超级简单访问PostgreSQL的小型php类
Posted by bianbian on 2007-03-17 07:55
本文Tags: php, PostgreSQL, 数据库, 类
实在受不了ADOdb之类的庞大库了,还有网上下的几个库也超级难用,我自己写了一个。只当简单的用,事务之类的我还没有用到,所以没有写进去。感兴趣的可以补充。好像里面的函数有些要php 4.2以上的。
使用示例:
- <?php
- $db = & new PostgreSQL();
- //single record:
- $record = & $db->query_first("SELECT * FROM table WHERE id=xxx");
- //many lines:
- if ($records = & $db->query_all("SELECT * FROM table WHERE id>xxx")) {
- foreach ($records as &$record) {
- ...
- }
- }
- $db->close();
- ?>
类的代码:
Read the rest of this entry »
遵守创作共用协议,转载请链接形式注明来自http://bianbian.org 做人要厚道
相关日志
Posted in Technology, php | 1 Comment »