2009年4月28日星期二

Re: [fw-mvc] Zend_Session with Sqlite DbTable not working

Marcel Alburg schrieb:
> Hello List,
>
> i've a problem if i use Zend_Session with Zend_Session_SaveHandler_DbTable.
>
> I've i use the Zend_DB functions, it's not possible to store the
> sessiondata into the Sqllite DB.
>
> I use a normal script without Zend
>
> ----
> $dbh = new PDO('sqlite2:foo.sqlite3');


The file is called 'foo.sqlite3' but you use the SQLite2-Adapter? [1]


>
> $stmt = $dbh->prepare('INSERT INTO "session" ("session_id", "modified",
> "session_data", "lifetime") VALUES (?, ?, ?, ?)');
>
> if (!$stmt) {
> echo "\nPDO::errorInfo():\n";
> print_r($dbh->errorInfo());
> exit;
> }
>
>
> $aData = array(
> '893ac6d16bdfce75018cd7f4bd8cc165',
> 1240951239,
> '',
> 1440
> );
>
> $stmt->execute($aData);
> ---
>
> Works fine.
>
> But if i use Zend i get an exception.
>
>
>
> My Script:
>
> -----
>
> function exception_handler($e)
> {
> print $e->getMessage();
> exit;
> }
>
> require_once 'Zend/Loader.php';
>
> Zend_Loader::registerAutoload('Zend_Loader_Autoloader');
>
>
> $db = Zend_Db::factory('Pdo_Sqlite', array(
> 'username' => '',
> 'password' => '',
> 'dbname' => 'session.sqlite3',
> 'sqlite2' => '1'
> ));


Above the file is called 'foo.sqlite3', here its 'session.sqlite3'. Is
this correct? Try realpath() to find out, if the file is found.


>
> Zend_Db_Table_Abstract::setDefaultAdapter($db);
>
> $config = array(
> 'name' => 'session',
> 'primary' => 'session_id',
> 'modifiedColumn' => 'modified',
> 'dataColumn' => 'session_data',
> 'lifetimeColumn' => 'lifetime'
> );
>
>
> Zend_Session::setSaveHandler(new
> Zend_Session_SaveHandler_DbTable($config));
>
> // Session starten
> Zend_Session::start();
> ---
>
> gets the Exception:
>
> ---
> [Exception deleted]
> ---
>
>
> Thanks a lot
>
> Marcel Alburg

[1]

--
Sebastian Krebs
http://www.kingcrunch2000.de
PGP public key for encryption
http://kingcrunch2000.de/public/0x44291B2B-pub.asc

没有评论: