Andy's Blog » codeigniter sqlite, CodeIgniter sqlite3, codeigniter pdo, ci pdo, CodeIgniter sqlite3 pdo, codeigniter 使用 pdo, ci sqlite3, php sqlite3 驱动, codeigniter最新pdo驱动下载, system/database/drivers/pdo/pdo_result php): failed to open stream: No such file or directory, ci sqlite, ci sqlite3 driver, codeigniter 使用pdo 怎么换驱动, codeigniter sqlite windows, Codeigniter3 pdo_odbc_driver » CodeIgniter SQLite3 PDO driver

CodeIgniter SQLite3 PDO driver

想试试在CodeIgniter中使用SQLite3, 没想到CodeIgniter本身没有PDO驱动
找了半天找到了, 可惜在新版CodeIgniter1.7.1中报错, 提示

“Fatal error: Call to undefined method CI_DB_pdo_driver::trans_rollback()

我直接给加了这个函数并return false了, 暂不支持事务, 有时间再弄.
下面下载的文件我已经修正这个错误了.

PS: SQLite似乎对大访问量的并发支持不如MySQL, 所以, 还是建议使用MySQL.如果要用SQLite, 还是建议使用CodeIgniter自带的SQLite2驱动.

使用方法

1. 按以下目录结构把解压后的2个文件放到CI里

/system/database/drivers/pdo/pdo_driver.php
/system/database/drivers/pdo/pdo_result.php

2. 编辑 /config/database.php

$active_group = "sqlite";
$active_record = TRUE;
$db['sqlite']['hostname'] = "localhost";
$db['sqlite']['username'] = "";
$db['sqlite']['password'] = "";
$db['sqlite']['database'] = "sqlite:path/to/database.sqlite3";
$db['sqlite']['dbdriver'] = "pdo";
$db['sqlite']['dbprefix'] = "";
$db['sqlite']['pconnect'] = FALSE;
$db['sqlite']['db_debug'] = TRUE;
$db['sqlite']['cache_on'] = FALSE;
$db['sqlite']['cachedir'] = "";
$db['sqlite']['char_set'] = "utf8";
$db['sqlite']['dbcollat'] = "utf8_general_ci";
下载 : CodeIgniter SQLite3 PDO driver 2009-04-29 (4.54 KB, 已下载 368 次)

Incoming search terms:

Tags: CodeIgniter, PDO, SQLite, driver

本文地址: http://www.21andy.com/new/20090430/1203.html