Overview
Comment:Cohérence avec SQLite3 en ligne de commande: utilisation de .load au lieu de .import
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev
Files: files | file ages | folders
SHA1: 26b4188c1158b9ee82a914542f37696e6cdbadc5
User & Date: bohwaz on 2017-08-03 04:21:10
Other Links: branch diff | manifest | tags
Context
2017-08-03
04:21
Contrainte de date ici, pas de datetime check-in: 0a855a0a53 user: bohwaz tags: dev
04:21
Cohérence avec SQLite3 en ligne de commande: utilisation de .load au lieu de .import check-in: 26b4188c11 user: bohwaz tags: dev
02:07
Modernisation du code: suppression des _POST et passage au système d'erreurs des formulaires check-in: 143ddfa442 user: bohwaz tags: dev
Changes

Modified src/include/lib/Garradin/DB.php from [ef10557379] to [527ac0b77d].

47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70

        $this->db->createFunction('transliterate_to_ascii', ['Garradin\Utils', 'transliterateToAscii']);
    }


    /**
     * Import a file containing SQL commands
     * Allows to use the statement ".import other_file.sql" to load other files
     * @param  string $file Path to file containing SQL commands
     * @return boolean
     */
    public function import($file)
    {
        $sql = file_get_contents($file);

        $dir = dirname($file);

        $sql = preg_replace_callback('/^\.import (.+\.sql)$/m', function ($match) use ($dir) {
            return file_get_contents($dir . DIRECTORY_SEPARATOR . $match[1]) . "\n";
        }, $sql);

        return $this->db->exec($sql);
    }
}







|









|






47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70

        $this->db->createFunction('transliterate_to_ascii', ['Garradin\Utils', 'transliterateToAscii']);
    }


    /**
     * Import a file containing SQL commands
     * Allows to use the statement ".read other_file.sql" to load other files
     * @param  string $file Path to file containing SQL commands
     * @return boolean
     */
    public function import($file)
    {
        $sql = file_get_contents($file);

        $dir = dirname($file);

        $sql = preg_replace_callback('/^\.read (.+\.sql)$/m', function ($match) use ($dir) {
            return file_get_contents($dir . DIRECTORY_SEPARATOR . $match[1]) . "\n";
        }, $sql);

        return $this->db->exec($sql);
    }
}