#ifndef DATABASESQL_H
#define DATABASESQL_H

#define CREATE_TABLE_ITEMLIST "CREATE TABLE itemlist ("\
                                "id integer primary key  NOT NULL, "\
                                "itemId integer NOT NULL, "\
                                "desktopName varchar, "\
                                "name varchar, "\
                                "iconName varchar, "\
                                "type integer NOT NULL, "\
                                "placeholder varchar NOT NULL, "\
                                "categories varchar NOT NULL)"
#define CREATE_TABLE_SETS "CREATE TABLE sets ("\
                            "id integer primary key NOT NULL, "\
                            "setId integer NOT NULL, "\
                            "sequence varchar, "\
                            "scrollable integer NOT NULL)"

#define CREATE_TABLE_PAGE "CREATE TABLE page ("\
                            "id integer primary key NOT NULL, "\
                            "pageId integer NOT NULL, "\
                            "sequence varchar)"


#define SELECT_ITEMLIST_BY_DESKTOPNAME "SELECT * FROM itemlist WHERE desktopName=:desktopName"
#define SELECT_ITEMLIST "SELECT * FROM itemlist"
#define SELECT_SETS "SELECT * FROM sets"
#define SELECT_PAGE "SELECT * FROM page"
#define SELECT_ITEMLIST_BY_ID "SELECT * FROM itemlist WHERE id=:id"
#define SELECT_SETS_BY_SETID "SELECT * FROM sets WHERE setId=:setId"
#define SELECT_PAGE_BY_PAGEID "SELECT * FROM page WHERE pageId=:pageId"
#define SELECT_ITEMLIST_BY_DESKTOPNAME "SELECT * FROM itemlist WHERE desktopName=:desktopName"
#define SELECT_ITEMLIST_BY_ITEMID "SELECT * FROM itemlist WHERE itemId=:itemId"

#define UPDATE_ITEMLIST "UPDATE itemlist SET desktopName=?, name=?, iconName=?, categories=? WHERE itemId=?"
#define UPDATE_SETS "UPDATE sets SET sequence=? WHERE setId=?"
#define UPDATE_ITEMLIST_NAME_ITEMID "UPDATE itemlist SET name=? WHERE itemId=?"
#define UPDATE_PAGE "UPDATE page SET sequence=? WHERE pageId=?"

#define INSERT_ITEMLIST "INSERT INTO itemlist (itemId, desktopName, name, iconName, type, placeholder, categories) "\
                                        "VALUES (?, ?, ?, ?, ?, ?, ?)"
#define INSERT_SETS "INSERT INTO sets (setId, sequence, scrollable) VALUES (?, ?, ?)"
#define INSERT_PAGE "INSERT INTO page (pageId, sequence) VALUES (?, ?)"
#define DELETE_ITEMLIST_BY_ITEMID "DELETE FROM itemlist WHERE itemId = %1"
#define DELETE_PAGE_BY_PAGEID "DELETE FROM page WHERE pageId = %1"
#define DELETE_ITEMLIST_BY_ID "DELETE FROM itemlist WHERE id = %1"
#define DELETE_SETS_BY_SETID "DELETE FROM sets WHERE setId = %1"
#define DROP_TABLE_BY_TABLENAME "DROP TABLE %1"
#define DELETE_TABLEDATA_BY_TABLENAME "DELETE FROM %1"

#endif // DATABASESQL_H
