roundcubemail/program/lib/Roundcube/rcube_db_sqlite.php
protected function conn_configure($dsn, $dbh)
    {
        // Initialize database structure in file is empty
        if (!empty($dsn['database']) && !filesize($dsn['database'])) {
            $data = file_get_contents(RCUBE_INSTALL_PATH . 'SQL/sqlite.initial.sql');

            if (strlen($data)) {
                $this->debug('INITIALIZE DATABASE');

                $q = $dbh->exec($data);

                if ($q === false) {
                    $error = $dbh->errorInfo();
                    $this->db_error = true;
                    $this->db_error_msg = sprintf('[%s] %s', $error[1], $error[2]);

                    rcube::raise_error(array('code' => 500, 'type' => 'db',
                        'line' => __LINE__, 'file' => __FILE__,
                        'message' => $this->db_error_msg), true, false);
                }
            }
        }
    }
protected function conn_configure($dsn, $dbh)
    {
        // Initialize database structure in file is empty
        if (!empty($dsn['database']) && !filesize($dsn['database'])) {
            $data = file_get_contents(RCUBE_INSTALL_PATH . 'SQL/sqlite.initial.sql');

            if (strlen($data)) {
                $this->debug('INITIALIZE DATABASE');

                $q = $dbh->exec($data);

                if ($q === false) {
                    $error = $dbh->errorInfo();
                    $this->db_error = true;
                    $this->db_error_msg = sprintf('[%s] %s', $error[1], $error[2]);

                    rcube::raise_error(array('code' => 500, 'type' => 'db',
                        'line' => __LINE__, 'file' => __FILE__,
                        'message' => $this->db_error_msg), true, false);
                }
            }
        }
    }
protected function conn_configure ( $ dsn , $ dbh ) { // Initialize database structure in file is empty if ( ! empty ( $ dsn [ 'database' ] ) && ! filesize ( $ dsn [ 'database' ] ) ) { $ data = file_get_contents ( RCUBE_INSTALL_PATH . 'SQL/sqlite.initial.sql' ) ; if ( strlen ( $ data ) ) { $ this -> debug ( 'INITIALIZE DATABASE' ) ; $ q = $ dbh -> exec ( $ data ) ; if ( $ q === false ) { $ error = $ dbh -> errorInfo ( ) ; $ this -> db_error = true ; $ this -> db_error_msg = sprintf ( '[%s] %s' , $ error [ 1 ] , $ error [ 2 ] ) ; rcube :: raise_error ( array ( 'code' => 500 , 'type' => 'db' , 'line' => __LINE__ , 'file' => __FILE__ , 'message' => $ this -> db_error_msg ) , true , false ) ; } } } }
Configure connection, create database if not exists
Configure connection create database if not exists