bianbian coding life

便便代码人生: 关注技术, 翻译文档, 偶尔动动手

[原]超级简单访问PostgreSQL的小型php类

Posted by bianbian on 2007-03-17 07:55


本文Tags: , , ,

实在受不了ADOdb之类的庞大库了,还有网上下的几个库也超级难用,我自己写了一个。只当简单的用,事务之类的我还没有用到,所以没有写进去。感兴趣的可以补充。好像里面的函数有些要php 4.2以上的。
使用示例:

  1. <?php
  2. $db = & new PostgreSQL();
  3. //single record:
  4. $record = & $db->query_first("SELECT * FROM table WHERE id=xxx");
  5. //many lines:
  6. if ($records = & $db->query_all("SELECT * FROM table WHERE id>xxx")) {
  7.     foreach ($records as &$record) {
  8.         ...
  9.     }
  10. }
  11. $db->close();
  12. ?>

类的代码:
Read the rest of this entry »

标签: , , ,

遵守创作共用协议,转载请链接形式注明来自http://bianbian.org 做人要厚道

相关日志

Posted in Technology, php | 1 Comment »