mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2025-12-13 19:52:13 +00:00
Hopefully finalizes code work.
This commit is contained in:
@@ -43,14 +43,14 @@ SUBSYSTEM_DEF(sqlite)
|
||||
*/
|
||||
var/database/query/init_schema = new(
|
||||
{"
|
||||
CREATE TABLE IF NOT EXISTS feedback
|
||||
CREATE TABLE IF NOT EXISTS [SQLITE_FEEDBACK_COLUMN_DATETIME]
|
||||
(
|
||||
`id` INTEGER NOT NULL UNIQUE,
|
||||
`author` TEXT NOT NULL,
|
||||
`topic` TEXT NOT NULL,
|
||||
`content` TEXT NOT NULL,
|
||||
`datetime` TEXT NOT NULL,
|
||||
PRIMARY KEY(`id`)
|
||||
`[SQLITE_FEEDBACK_COLUMN_ID]` INTEGER NOT NULL UNIQUE,
|
||||
`[SQLITE_FEEDBACK_COLUMN_AUTHOR]` TEXT NOT NULL,
|
||||
`[SQLITE_FEEDBACK_COLUMN_TOPIC]` TEXT NOT NULL,
|
||||
`[SQLITE_FEEDBACK_COLUMN_CONTENT]` TEXT NOT NULL,
|
||||
`[SQLITE_FEEDBACK_COLUMN_DATETIME]` TEXT NOT NULL,
|
||||
PRIMARY KEY(`[SQLITE_FEEDBACK_COLUMN_ID]`)
|
||||
);
|
||||
"}
|
||||
)
|
||||
@@ -85,10 +85,10 @@ SUBSYSTEM_DEF(sqlite)
|
||||
var/sqlite_topic = sql_sanitize_text(topic)
|
||||
|
||||
var/database/query/query = new(
|
||||
"INSERT INTO feedback (\
|
||||
author, \
|
||||
topic, \
|
||||
content, \
|
||||
"INSERT INTO [SQLITE_TABLE_FEEDBACK] (\
|
||||
[SQLITE_FEEDBACK_COLUMN_AUTHOR], \
|
||||
[SQLITE_FEEDBACK_COLUMN_TOPIC], \
|
||||
[SQLITE_FEEDBACK_COLUMN_CONTENT], \
|
||||
[SQLITE_FEEDBACK_COLUMN_DATETIME]) \
|
||||
\
|
||||
VALUES (\
|
||||
@@ -127,8 +127,8 @@ SUBSYSTEM_DEF(sqlite)
|
||||
// First query is to get the most recent time the player has submitted feedback.
|
||||
var/database/query/query = new({"
|
||||
SELECT [SQLITE_FEEDBACK_COLUMN_DATETIME]
|
||||
FROM feedback
|
||||
WHERE author == ? OR author == ?
|
||||
FROM [SQLITE_TABLE_FEEDBACK]
|
||||
WHERE [SQLITE_FEEDBACK_COLUMN_AUTHOR] == ? OR [SQLITE_FEEDBACK_COLUMN_AUTHOR] == ?
|
||||
ORDER BY [SQLITE_FEEDBACK_COLUMN_DATETIME]
|
||||
DESC LIMIT 1;
|
||||
"},
|
||||
|
||||
@@ -39,9 +39,9 @@
|
||||
if(exact) // Useful for ID searches, so searching for 'id 10' doesn't also get 'id 101'.
|
||||
query = new({"
|
||||
SELECT *
|
||||
FROM feedback
|
||||
FROM [SQLITE_TABLE_FEEDBACK]
|
||||
WHERE [row_name] == ?
|
||||
ORDER BY id
|
||||
ORDER BY [SQLITE_FEEDBACK_COLUMN_ID]
|
||||
DESC LIMIT 50;
|
||||
"},
|
||||
thing_to_find
|
||||
@@ -52,9 +52,9 @@
|
||||
thing_to_find = "%[thing_to_find]%"
|
||||
query = new({"
|
||||
SELECT *
|
||||
FROM feedback
|
||||
FROM [SQLITE_TABLE_FEEDBACK]
|
||||
WHERE [row_name] LIKE ?
|
||||
ORDER BY id
|
||||
ORDER BY [SQLITE_FEEDBACK_COLUMN_ID]
|
||||
DESC LIMIT 50;
|
||||
"},
|
||||
thing_to_find
|
||||
@@ -69,8 +69,8 @@
|
||||
if(!last_query) // If no query was done before, just show the most recent feedbacks.
|
||||
var/database/query/query = new({"
|
||||
SELECT *
|
||||
FROM feedback
|
||||
ORDER BY id
|
||||
FROM [SQLITE_TABLE_FEEDBACK]
|
||||
ORDER BY [SQLITE_FEEDBACK_COLUMN_ID]
|
||||
DESC LIMIT 50;
|
||||
"}
|
||||
)
|
||||
@@ -134,29 +134,29 @@
|
||||
if(href_list["filter_id"])
|
||||
var/id_to_search = input(my_client, "Write feedback ID here.", "Filter by ID", null) as null|num
|
||||
if(id_to_search)
|
||||
last_query = feedback_filter("id", id_to_search, TRUE)
|
||||
last_query = feedback_filter(SQLITE_FEEDBACK_COLUMN_ID, id_to_search, TRUE)
|
||||
|
||||
if(href_list["filter_author"])
|
||||
var/author_to_search = input(my_client, "Write desired key or hash here. Partial keys/hashes are allowed.", "Filter by Author", null) as null|text
|
||||
if(author_to_search)
|
||||
last_query = feedback_filter("author", author_to_search)
|
||||
last_query = feedback_filter(SQLITE_FEEDBACK_COLUMN_AUTHOR, author_to_search)
|
||||
|
||||
if(href_list["filter_topic"])
|
||||
var/topic_to_search = input(my_client, "Write desired topic here. Partial topics are allowed. \
|
||||
\nThe current topics in the config are [english_list(config.sqlite_feedback_topics)].", "Filter by Topic", null) as null|text
|
||||
if(topic_to_search)
|
||||
last_query = feedback_filter("topic", topic_to_search)
|
||||
last_query = feedback_filter(SQLITE_FEEDBACK_COLUMN_TOPIC, topic_to_search)
|
||||
|
||||
if(href_list["filter_content"])
|
||||
var/content_to_search = input(my_client, "Write desired content to find here. Partial matches are allowed.", "Filter by Content", null) as null|message
|
||||
if(content_to_search)
|
||||
last_query = feedback_filter("content", content_to_search)
|
||||
last_query = feedback_filter(SQLITE_FEEDBACK_COLUMN_CONTENT, content_to_search)
|
||||
|
||||
if(href_list["filter_datetime"])
|
||||
var/datetime_to_search = input(my_client, "Write desired datetime. Partial matches are allowed.\n\
|
||||
Format is 'YYYY-MM-DD HH:MM:SS'.", "Filter by Datetime", null) as null|text
|
||||
if(datetime_to_search)
|
||||
last_query = feedback_filter("datetime", datetime_to_search)
|
||||
last_query = feedback_filter(SQLITE_FEEDBACK_COLUMN_DATETIME, datetime_to_search)
|
||||
|
||||
// Refresh.
|
||||
display()
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
// Act.
|
||||
SSsqlite.insert_feedback(author = test_author, topic = test_topic, content = test_content, sqlite_object = stub_sqlite_db)
|
||||
var/database/query/Q = new("SELECT * FROM feedback")
|
||||
var/database/query/Q = new("SELECT * FROM [SQLITE_TABLE_FEEDBACK]")
|
||||
Q.Execute(stub_sqlite_db)
|
||||
SSsqlite.sqlite_check_for_errors(Q, "Sqlite Insert Unit Test")
|
||||
Q.NextRow()
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "code\__defines\_compile_options.dm"
|
||||
#include "code\__defines\_lists.dm"
|
||||
#include "code\__defines\_planes+layers.dm"
|
||||
#include "code\__defines\_protect.dm"
|
||||
#include "code\__defines\_tick.dm"
|
||||
#include "code\__defines\admin.dm"
|
||||
#include "code\__defines\appearance.dm"
|
||||
@@ -56,6 +57,7 @@
|
||||
#include "code\__defines\research.dm"
|
||||
#include "code\__defines\sound.dm"
|
||||
#include "code\__defines\species_languages.dm"
|
||||
#include "code\__defines\sqlite_defines.dm"
|
||||
#include "code\__defines\stat_tracking.dm"
|
||||
#include "code\__defines\subsystems.dm"
|
||||
#include "code\__defines\supply.dm"
|
||||
@@ -213,6 +215,7 @@
|
||||
#include "code\controllers\subsystems\planets.dm"
|
||||
#include "code\controllers\subsystems\radiation.dm"
|
||||
#include "code\controllers\subsystems\shuttles.dm"
|
||||
#include "code\controllers\subsystems\sqlite.dm"
|
||||
#include "code\controllers\subsystems\sun.dm"
|
||||
#include "code\controllers\subsystems\time_track.dm"
|
||||
#include "code\controllers\subsystems\timer.dm"
|
||||
@@ -276,6 +279,9 @@
|
||||
#include "code\datums\looping_sounds\machinery_sounds.dm"
|
||||
#include "code\datums\looping_sounds\sequence.dm"
|
||||
#include "code\datums\looping_sounds\weather_sounds.dm"
|
||||
#include "code\datums\managed_browsers\_managed_browser.dm"
|
||||
#include "code\datums\managed_browsers\feedback_form.dm"
|
||||
#include "code\datums\managed_browsers\feedback_viewer.dm"
|
||||
#include "code\datums\observation\_debug.dm"
|
||||
#include "code\datums\observation\_defines.dm"
|
||||
#include "code\datums\observation\destroyed.dm"
|
||||
@@ -2802,6 +2808,7 @@
|
||||
#include "code\unit_tests\map_tests.dm"
|
||||
#include "code\unit_tests\mob_tests.dm"
|
||||
#include "code\unit_tests\research_tests.dm"
|
||||
#include "code\unit_tests\sqlite_tests.dm"
|
||||
#include "code\unit_tests\unit_test.dm"
|
||||
#include "code\unit_tests\zas_tests.dm"
|
||||
#include "code\unit_tests\integrated_circuits\arithmetic.dm"
|
||||
|
||||
Reference in New Issue
Block a user