public function create($table, array $fields, $tokenize = 'porter')
    {
        $fields = implode(', ', $fields);
        $query = "CREATE VIRTUAL TABLE {$table} USING fts4({$fields}, tokenize={$tokenize})";
        $executed = $this->db->info('tables', $table);
        if ($query == $executed) {
            return false; // the table has already been created
        }
        if (!is_null($executed)) {
            $this->db->exec('DROP TABLE '.$table);
        }
        $this->db->exec($query);
        $this->db->info('tables', $table, $query); // add or update
        return true; // the table has been created anew
    }
public function create($table, array $fields, $tokenize = 'porter')
    {
        $fields = implode(', ', $fields);
        $query = "CREATE VIRTUAL TABLE {$table} USING fts4({$fields}, tokenize={$tokenize})";
        $executed = $this->db->info('tables', $table);
        if ($query == $executed) {
            return false; // the table has already been created
        }
        if (!is_null($executed)) {
            $this->db->exec('DROP TABLE '.$table);
        }
        $this->db->exec($query);
        $this->db->info('tables', $table, $query); // add or update
        return true; // the table has been created anew
    }
public function create ( $ table , array $ fields , $ tokenize = 'porter' ) { $ fields = implode ( ', ' , $ fields ) ; $ query = "CREATE VIRTUAL TABLE {$table} USING fts4({$fields}, tokenize={$tokenize})" ; $ executed = $ this -> db -> info ( 'tables' , $ table ) ; if ( $ query == $ executed ) { return false ; // the table has already been created } if ( ! is_null ( $ executed ) ) { $ this -> db -> exec ( 'DROP TABLE ' . $ table ) ; } $ this -> db -> exec ( $ query ) ; $ this -> db -> info ( 'tables' , $ table , $ query ) ; // add or update return true ; // the table has been created anew }
Create an SQLite FTS4 virtual table for fulltext searching.

@param string $table    The database table name.
@param mixed  $fields   An ``array($field, ...)`` of names to create, or just a string (eg. '**search**') if there is only one field name.
@param string $tokenize Either '**simple**', or '**porter**' (the default).

@return bool Either ``false`` if the table has already been created, or ``true`` if the table has been created anew.

@example

```php
if ($db->created) {

$db->fts->create('results', 'search');

// You can insert, update, and query an FTS table the same as any other.
if ($stmt = $db->insert('results', array('docid', 'search'))) {
$db->insert($stmt, array(100, 'Fisherman never die, they just get reel tired.'));
$db->insert($stmt, array(101, 'If wishes were fishes, we\'d have a fish fry.'));
$db->insert($stmt, array(102, 'Women want me, fish fear me.'));
$db->insert($stmt, array(103, 'Good things come to those who bait.'));
$db->insert($stmt, array(104, 'A reel expert can tackle anything.'));
}

}
```
Create an SQLite FTS4 virtual table for fulltext searching .