privatestaticfinalStringCREATE_STORE_VERSION="INSERT INTO metainfo (key,value) VALUES ('"+STORE_VERSION+"','0')";
privatestaticfinalStringSELECT_STORE_VERSION="SELECT * FROM metainfo WHERE key = '"+STORE_VERSION+"'";
privatestaticfinalStringSET_STORE_VERSION="UPDATE metainfo SET value = ? WHERE key = '"+STORE_VERSION+"'";
privatestaticfinalStringCREATE_SESSION_TABLE="CREATE TABLE sessions (id VARCHAR(64) PRIMARY KEY, userId VARCHAR(64) NOT NULL, expiration LONG NOT NULL)";
privatestaticfinalStringCREATE_STORE_VERSION="INSERT INTO metainfo (key,value) VALUES ('"+STORE_VERSION+"','0')";
privatestaticfinalStringSELECT_STORE_VERSION="SELECT * FROM metainfo WHERE key = '"+STORE_VERSION+"'";
privatestaticfinalStringSET_STORE_VERSION="UPDATE metainfo SET value = ? WHERE key = '"+STORE_VERSION+"'";
privatestaticfinalStringCREATE_USER_TABLE="CREATE TABLE IF NOT EXISTS users(uuid VARCHAR(255) NOT NULL PRIMARY KEY, password VARCHAR(255), email VARCHAR(255), session_duration INT NOT NULL DEFAULT 10, username VARCHAR(255), realname VARCHAR(255));";
privatestaticfinalStringCREATE_USER_TABLE="CREATE TABLE IF NOT EXISTS users(uuid VARCHAR(255) NOT NULL PRIMARY KEY, password VARCHAR(255), email VARCHAR(255), session_duration INT NOT NULL DEFAULT 10, username VARCHAR(255), realname VARCHAR(255));";
privatestaticfinalStringCREATE_USER_PERMISSION_TABLE="CREATE TABLE IF NOT EXISTS user_permissions(uuid VARCHAR(255), permission VARCHAR(50), PRIMARY KEY(uuid,permission));";
privatestaticfinalStringCREATE_USER_PERMISSION_TABLE="CREATE TABLE IF NOT EXISTS user_permissions(uuid VARCHAR(255), permission VARCHAR(50), PRIMARY KEY(uuid,permission));";
privatestaticfinalStringCOUNT_USERS="SELECT count(*) FROM users";
privatestaticfinalStringCOUNT_USERS="SELECT count(*) FROM users";
@ -26,8 +31,6 @@ public class SqliteUserService extends SqliteStore implements UserService {
privatestaticfinalStringLOAD_PERMISSIONS="SELECT permission FROM user_permissions WHERE uuid = ?";
privatestaticfinalStringLOAD_PERMISSIONS="SELECT permission FROM user_permissions WHERE uuid = ?";
privatestaticfinalStringFIND_USER="SELECT * FROM users WHERE uuid = ? OR username LIKE ? OR realname LIKE ? OR email = ? ORDER BY COALESCE(uuid, ?), username";
privatestaticfinalStringFIND_USER="SELECT * FROM users WHERE uuid = ? OR username LIKE ? OR realname LIKE ? OR email = ? ORDER BY COALESCE(uuid, ?), username";
privatestaticfinalStringLIST_USERS="SELECT * FROM users";
privatestaticfinalStringLIST_USERS="SELECT * FROM users";
privatestaticfinalStringSELECT_USERSTORE_VERSION="SELECT * FROM metainfo WHERE key = 'user_store_version'";
privatestaticfinalStringSET_USERSTORE_VERSION="UPDATE metainfo SET value = ? WHERE key = 'user_store_version'";
privatestaticfinalStringINSERT_USER="INSERT INTO users (uuid,password,email,session_duration,username,realname) VALUES (?,?,?,?,?,?) ON CONFLICT DO UPDATE SET password = ?, email = ?, session_duration = ?, username = ?, realname = ?;";
privatestaticfinalStringINSERT_USER="INSERT INTO users (uuid,password,email,session_duration,username,realname) VALUES (?,?,?,?,?,?) ON CONFLICT DO UPDATE SET password = ?, email = ?, session_duration = ?, username = ?, realname = ?;";
privatestaticfinalStringINSERT_PERMISSIONS="INSERT INTO user_permissions (uuid, permission) VALUES (?,?)";
privatestaticfinalStringINSERT_PERMISSIONS="INSERT INTO user_permissions (uuid, permission) VALUES (?,?)";
privatestaticfinalStringDROP_PERMISSIONS="DELETE FROM user_permissions WHERE uuid = ?";
privatestaticfinalStringDROP_PERMISSIONS="DELETE FROM user_permissions WHERE uuid = ?";
@ -57,7 +60,7 @@ public class SqliteUserService extends SqliteStore implements UserService {