CodeIgniter Forums
working with sqlite - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: working with sqlite (/showthread.php?tid=60779)



working with sqlite - El Forum - 06-26-2014

[eluser]Pavellicus[/eluser]
Hello,

i have a little question :

i need to create a library to work on sqlite file .

i need to upload the *.sqlite and then open it and work on it .

is possible do something like that :

Code:
class myLibrary extends sqlite3{

        public function __construct()
       {
            parent::__construct();
            $this->open('blabla.sqlite'); // function of sqlite3 library
       }
}





working with sqlite - El Forum - 06-26-2014

[eluser]InsiteFX[/eluser]
Sqlite is built into CI it has its own driver so yes you can use it.

Search the forums for more info on it.



working with sqlite - El Forum - 06-27-2014

[eluser]Pavellicus[/eluser]
yes but i have already a connection open on a Mysql ( in config/database.php i put inside the paramiters) i can already open this connection ?


working with sqlite - El Forum - 06-27-2014

[eluser]InsiteFX[/eluser]
Then do a forum search on using multiple database configurations with the conn->id



working with sqlite - El Forum - 06-27-2014

[eluser]CroNiX[/eluser]
See "Connecting to Multiple Databases" section: http://ellislab.com/codeigniter/user-guide/database/connecting.html


working with sqlite - El Forum - 06-30-2014

[eluser]Pavellicus[/eluser]
Code:
$db['default']['hostname'] = 'sqlite:'.APPPATH.'sqlite/blabla.sqlite';
$db['default']['username'] = '';
$db['default']['password'] = '';
$db['default']['database'] = '';
$db['default']['dbdriver'] = 'pdo';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = FALSE;
$db['default']['db_debug'] = FALSE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;

and then
Code:
$db = $this->load->database();
$query = $db->query('SELECT * FROM table');

doesn't go but if i do

Code:
$this->db->simple_query('SELECT * FROM table');/*

it's works... why????????


working with sqlite - El Forum - 06-30-2014

[eluser]Tpojka[/eluser]
Manual says next:
For example, when using SQLite you will not need to supply a username or password, and the database name will be the path to your database file.

You don't have db name in configuration.