vendredi 24 avril 2015

SQL Lite in Android - Syntax Error

I have been working on an Android app for a while and have recently started getting into making a database for the app. That being said I am currently having an issue with my CREATE TABLE commands. I have run these through SQL fiddle and it doesn't seem to think there is a problem, but Eclipse does.

    CREATE TABLE team (_id INTEGER PRIMARY KEY , teamName TEXT , teamYear TEXT , teamLevel TEXT )
    CREATE TABLE matchs (_id INTEGER PRIMARY KEY , oponentName TEXT , matchDate TEXT , teamId INTEGER NOT NULL  , FOREIGN KEY (teamId) REFERENCES team (_id ))
    CREATE TABLE matchSet (_id INTEGER PRIMARY KEY , setNumber TEXT , matchId INTEGER NOT NULL  , FOREIGN KEY (matchId) REFERENCES matchs (_id ))
    CREATE TABLE player (_id INTEGER PRIMARY KEY , playerNumber TEXT , playerPosition TEXT , playerFirstName TEXT , playerLastName TEXT , playerNickname TEXT , playerPic TEXT , playerTagline TEXT , teamId INTEGER NOT NULL  , FOREIGN KEY (teamId) REFERENCES team (_id ))
    CREATE TABLE par (_id INTEGER PRIMARY KEY , action TEXT , result TEXT , playerId INTEGER NOT NULL  , FOREIGN KEY (playerId) REFERENCES player (_id ) , setId INTEGER NOT NULL  , FOREIGN KEY (setId) REFERENCES matchSet (_id ))
    CREATE TABLE stats (_id INTEGER PRIMARY KEY , playerId INTEGER NOT NULL  , FOREIGN KEY (playerId) REFERENCES player (_id ) , setId INTEGER NOT NULL  , FOREIGN KEY (setId) REFERENCES matchSet (_id ) , attackKill TEXT , attackError TEXT , attackTotal TEXT , attackPercentage TEXT , setAssist TEXT , serveAce TEXT , serveError TEXT , serveZero TEXT , passRating TEXT , blockSolo TEXT , blockAssist TEXT , blockError TEXT , genBhe TEXT , pts TEXT )

The error is being thrown on the creation of the par table near the setId foreign key. Any help is greatly appreciated.

Aucun commentaire:

Enregistrer un commentaire