Varias inserciones que no funcionan con SQLite 3

El error específico, usando una base de datos SQLite con PDO en PHP:

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 1 near ",": syntax error' in D:\Projects\2013\Stat collection plugin\stats\htdocs\index.php:8 Stack trace: #0 D:\Projects\2013\Stat collection plugin\stats\htdocs\index.php(8): PDO->exec('CREATE TABLE IF...') #1 {main} thrown in D:\Projects\2013\Stat collection plugin\stats\htdocs\index.php on line 8

El código:

 $dbSchema = file_get_contents('../schema.sql'); $PDO = new PDO('sqlite:../stats.db'); $PDO->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $PDO->exec($dbSchema); 

Aquí está mi esquema. El error parece estar allí cuando acabo de tener la primera instrucción CREATE TABLE, pero si he cometido el mismo error en las siguientes afirmaciones, lo agradecería si me lo dijera. ¡Gracias por adelantado!

 CREATE TABLE IF NOT EXISTS game ( id INTEGER PRIMARY KEY AUTOINCREMENT, serverName STRING NOT NULL, map STRING NOT NULL, winner INTEGER NOT NULL, gameMode STRING NOT NULL, controlPoints INTEGER, setupGate BOOLEAN, capsRed INTEGER, capsBlue INTEGER, winsRed INTEGER, winsBlue INTEGER, CONSTRAINT game_winner_teamTypes_id FOREIGN KEY (winner) REFERENCES teamTypes(id) ); CREATE TABLE IF NOT EXISTS player ( id INTEGER PRIMARY KEY AUTOINCREMENT, gameId INTEGER NOT NULL, name STRING NOT NULL, team INTEGER NOT NULL, class INTEGER NOT NULL, queueJump BOOLEAN NOT NULL, CONSTRAINT player_gameId_game_id FOREIGN KEY (gameId) REFERENCES game(id), CONSTRAINT player_team_teamTypes_id FOREIGN KEY (team) REFERENCES teamTypes(id), CONSTRAINT player_class_classTypes_id FOREIGN KEY (class) REFERENCES classTypes(id) ); CREATE TABLE IF NOT EXISTS stat ( playerId INTEGER NOT NULL, type INTEGER NOT NULL, value INTEGER NOT NULL, CONSTRAINT stat_playerId_player_id FOREIGN KEY (playerId) REFERENCES player(id), CONSTRAINT stat_type_statTypes_id FOREIGN KEY (type) REFERENCES statTypes(id) ); CREATE TABLE IF NOT EXISTS teamTypes ( id INTEGER PRIMARY KEY AUTOINCREMENT, name STRING NOT NULL ); INSERT OR IGNORE INTO teamTypes(id, name) VALUES (0, 'Red'), (1, 'Blue'), (2, 'Spectator'); CREATE TABLE IF NOT EXISTS classTypes ( id INTEGER PRIMARY KEY AUTOINCREMENT, name STRING NOT NULL ); INSERT OR IGNORE INTO classTypes(id, name) VALUES (0, 'Runner'), (1, 'Rocketman'), (2, 'Rifleman'), (3, 'Detonator'), (4, 'Healer'), (5, 'Constructor'), (6, 'Overweight'), (7, 'Infiltrator'), (8, 'Firebug'), (9, 'Querly'); CREATE TABLE IF NOT EXISTS statTypes ( id INTEGER PRIMARY KEY AUTOINCREMENT, name STRING NOT NULL ); INSERT OR IGNORE INTO statTypes(id, name) VALUES (0, 'Kills'), (1, 'Deaths'), (2, 'Caps'), (3, 'Assists'), (4, 'Destruction'), (5, 'Stabs'), (6, 'Healing'), (7, 'Defenses'), (8, 'Invulns'), (9, 'Bonus'), (10, 'Dominations'), (11, 'Revenge'), (12, 'Points'); 

Resulta que el problema era que tenía múltiples grupos VALUES (1,2,3), (4,5,6) ).

La característica que permite insertar múltiples filas con una statement ( INSERT INTO foobar VALUES (1,2), (3,4); ) en lugar de INSERT INTO foobar VALUES (1,2); INSERT INTO foobar VALUES (3,4); INSERT INTO foobar VALUES (1,2); INSERT INTO foobar VALUES (3,4); fue agregado en SQLite 3.7.11:

2012-03-20 (3.7.11)

 Enhance the INSERT syntax to allow multiple rows to be inserted via the VALUES clause. 

http://www.sqlite.org/changes.html#version_3_7_11

Sin embargo, mi versión SQLite es más antigua. De acuerdo con mi salida phpinfo ():

 pdo_sqlite PDO Driver for SQLite 3.x => enabled SQLite Library => 3.7.7.1 

Por lo tanto, no puedo usarlo.

Cuando cambié esta última parte,

 CREATE TABLE IF NOT EXISTS teamTypes ( id INTEGER PRIMARY KEY AUTOINCREMENT, name STRING NOT NULL ); INSERT OR IGNORE INTO teamTypes(id, name) VALUES (0, 'Red'), (1, 'Blue'), (2, 'Spectator'); CREATE TABLE IF NOT EXISTS classTypes ( id INTEGER PRIMARY KEY AUTOINCREMENT, name STRING NOT NULL ); INSERT OR IGNORE INTO classTypes(id, name) VALUES (0, 'Runner'), (1, 'Rocketman'), (2, 'Rifleman'), (3, 'Detonator'), (4, 'Healer'), (5, 'Constructor'), (6, 'Overweight'), (7, 'Infiltrator'), (8, 'Firebug'), (9, 'Querly'); CREATE TABLE IF NOT EXISTS statTypes ( id INTEGER PRIMARY KEY AUTOINCREMENT, name STRING NOT NULL ); INSERT OR IGNORE INTO statTypes(id, name) VALUES (0, 'Kills'), (1, 'Deaths'), (2, 'Caps'), (3, 'Assists'), (4, 'Destruction'), (5, 'Stabs'), (6, 'Healing'), (7, 'Defenses'), (8, 'Invulns'), (9, 'Bonus'), (10, 'Dominations'), (11, 'Revenge'), (12, 'Points'); 

a esto,

 CREATE TABLE IF NOT EXISTS teamTypes ( id INTEGER PRIMARY KEY AUTOINCREMENT, name STRING NOT NULL ); INSERT OR IGNORE INTO teamTypes(id, name) VALUES (0, 'Red'); INSERT OR IGNORE INTO teamTypes(id, name) VALUES (1, 'Blue'); INSERT OR IGNORE INTO teamTypes(id, name) VALUES (2, 'Spectator'); CREATE TABLE IF NOT EXISTS classTypes ( id INTEGER PRIMARY KEY AUTOINCREMENT, name STRING NOT NULL ); INSERT OR IGNORE INTO classTypes(id, name) VALUES (0, 'Runner'); INSERT OR IGNORE INTO classTypes(id, name) VALUES (1, 'Rocketman'); INSERT OR IGNORE INTO classTypes(id, name) VALUES (2, 'Rifleman'); INSERT OR IGNORE INTO classTypes(id, name) VALUES (3, 'Detonator'); INSERT OR IGNORE INTO classTypes(id, name) VALUES (4, 'Healer'); INSERT OR IGNORE INTO classTypes(id, name) VALUES (5, 'Constructor'); INSERT OR IGNORE INTO classTypes(id, name) VALUES (6, 'Overweight'); INSERT OR IGNORE INTO classTypes(id, name) VALUES (7, 'Infiltrator'); INSERT OR IGNORE INTO classTypes(id, name) VALUES (8, 'Firebug'); INSERT OR IGNORE INTO classTypes(id, name) VALUES (9, 'Querly'); CREATE TABLE IF NOT EXISTS statTypes ( id INTEGER PRIMARY KEY AUTOINCREMENT, name STRING NOT NULL ); INSERT OR IGNORE INTO statTypes(id, name) VALUES (0, 'Kills'); INSERT OR IGNORE INTO statTypes(id, name) VALUES (1, 'Deaths'); INSERT OR IGNORE INTO statTypes(id, name) VALUES (2, 'Caps'); INSERT OR IGNORE INTO statTypes(id, name) VALUES (3, 'Assists'); INSERT OR IGNORE INTO statTypes(id, name) VALUES (4, 'Destruction'); INSERT OR IGNORE INTO statTypes(id, name) VALUES (5, 'Stabs'); INSERT OR IGNORE INTO statTypes(id, name) VALUES (6, 'Healing'); INSERT OR IGNORE INTO statTypes(id, name) VALUES (7, 'Defenses'); INSERT OR IGNORE INTO statTypes(id, name) VALUES (8, 'Invulns'); INSERT OR IGNORE INTO statTypes(id, name) VALUES (9, 'Bonus'); INSERT OR IGNORE INTO statTypes(id, name) VALUES (10, 'Dominations'); INSERT OR IGNORE INTO statTypes(id, name) VALUES (11, 'Revenge'); INSERT OR IGNORE INTO statTypes(id, name) VALUES (12, 'Points'); 

El problema fue resuelto.