Welcome Guest, Not a member yet? Register   Sign In
working with sqlite
#1

[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
       }
}


#2

[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.
#3

[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 ?
#4

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

[eluser]CroNiX[/eluser]
See "Connecting to Multiple Databases" section: http://ellislab.com/codeigniter/user-gui...cting.html
#6

[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????????
#7

[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.




Theme © iAndrew 2016 - Forum software by © MyBB