]> git.nbdom.net Git - nb.git/commitdiff
sqlite csv
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Mon, 2 May 2016 01:05:48 +0000 (02:05 +0100)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Mon, 2 May 2016 01:05:48 +0000 (02:05 +0100)
lib/php/db/types/sqlite.php

index f6d566a7bfc68d4ef097ff5af43537beb412021e..4c4762f0280773b914e35aef8e5a1926f247d8ed 100644 (file)
@@ -1,4 +1,8 @@
 <?php
+if (!class_exists('Db')) {
+       echo "Hi there! I'm just a plugin, not much I can do when called directly.\n";
+       exit;
+}
 $DB_TYPES['sqlite'] = array (
 'exec' => 'PRAGMA encoding = "'.strtoupper(Db::$encoding).'"', 
 'use_path' => true,
@@ -9,6 +13,7 @@ $DB_TYPES['sqlite'] = array (
 
 'table.sql' => 'SELECT sql FROM sqlite_master WHERE name=\'<NAME>\'',
 'table.truncate' => 'DELETE FROM \'<NAME>\'',
+'table.csv.load' => ['.mode csv','.sep \\t','.import <FILE> <NAME>'],
 
 'sqliteCreateFunction' => array (
   'ip2int' => function ($value) { return ip2long($value); },