Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-06-2008, 11:05 PM
troy's Avatar
Junior Member
 
Join Date: Apr 2008
Posts: 11
Default Help needed with sqlite

Hello
I am very new to Zend moving from CodeIgnitor

Following code will list the tables but not execute anything else.
I tried DROP, CREATE and SELECT

I even set the file to rw 777
-rwxrwxrwx 1 www-data www-data 2048 2008-04-06 18:19 sqlite.db

PHP Code:
try {
    require_once 
'Zend/Db/Adapter/Pdo/Sqlite.php';
    require_once 
'Zend/Auth/Adapter/DbTable.php';
    
$sqlite = new Zend_Db_Adapter_Pdo_Sqlite(array('dbname' => ROOT.'/sqlite.db'));
    
$sqlite->getConnection();
} catch (
Zend_Db_Adapter_Exception $e) {
    echo 
$e->getMessage();
} catch (
Zend_Exception $e) {
    echo 
$e->getMessage();
}
// This works
echo '<pre> Tables';print_r($sqlite->listTables());

// This doesn't works
$sql 'DROP TABLE IF EXISTS log';
$sqlite->query($sql); 
TablesArray
(
[0] => log
)


Fatal error: Uncaught exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[HY000]: General error: 14 unable to open database file' in /opt/zend/library/Zend/Db/Statement/Pdo.php:238
Stack trace:
#0 /opt/zend/library/Zend/Db/Statement.php(283): Zend_Db_Statement_Pdo->_execute(Array)
#1 /opt/zend/library/Zend/Db/Adapter/Abstract.php(405): Zend_Db_Statement->execute(Array)
#2 /opt/zend/library/Zend/Db/Adapter/Pdo/Abstract.php(205): Zend_Db_Adapter_Abstract->query('DROP TABLE IF E...', Array)
#3 /var/www/pzzazz/zend/accounts.php(75): Zend_Db_Adapter_Pdo_Abstract->query('DROP TABLE IF E...')
#4 /var/www/pzzazz/zend/public/index.php(20): require_once('/var/www/pzzazz...')
#5 {main}
thrown in /opt/zend/library/Zend/Db/Statement/Pdo.php on line 238
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 03:28 AM.