[pear] DB class

DB_Common::quote()
Quotes a string database-dependent, so it can be safely used in a query

DB_Common::nextId()
returns the next free id of a sequence

DB_Common::quote()
ex:

$sql= ‘datr有許功年 ‘;
echo $sql . ‘
‘;
echo $DB->quote($sql);

it show us

datr有許功年
‘datr有許功年 ‘

簡單的說, 他會自動的幫你 addslashes 和判斷要加那種 quote

DB_Common::nextId()

$id= $DB->nextId(’id’)

如果沒有 id 這個 seq, 他會建一個
nextId 很像 MySQL 中的 auto_incretment, 只不過他是另外建一個 table 來紀錄目前的 id, 以汎用性來說, 我想這個會好用多吧 :)

Leave a Reply