Jump to content

WITHOUT ROWID SQLite


'LinKin

Recommended Posts

Hello,

I tried to remove the default ROWID of the tables in SQLite, but I get a warning saying this:

dbExec failed; (1) near "WITHOUT": syntax error

If I remove the WITHOUT ROWID then it works, and I really don't have problems with the script, but I'd like to save space in the database because this row id is useless (because I am defining PK's in each table)

This is the code I use

-- Creating 'teams' entity... 
    dbExec(dbHandler, "CREATE TABLE IF NOT EXISTS `teams` (`name` TEXT PRIMARY KEY, `tag` TEXT UNIQUE, `color` TEXT UNIQUE, `points` INTEGER) WITHOUT ROWID") 
     
     
        -- Creating 'accounts' entity... 
    dbExec(dbHandler, "CREATE TABLE IF NOT EXISTS `accounts` (`name` TEXT PRIMARY KEY, `team` TEXT, FOREIGN KEY(team) REFERENCES teams(name)) WITHOUT ROWID") 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...