Jump to content

WITHOUT ROWID SQLite


'LinKin

Recommended Posts

Posted

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") 

Posted

You need SQLite version 3.8.2 or later in order to use 'WITHOUT ROWID'. The latest version of SQLite included with MTA 1.4.1 is "3.7.17".

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...