Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SQLite = dbConnect("sqlite", "sqlite.db")
- MySQL = dbConnect("mysql", "localhost", "root")
- SQLiteQuery = dbQuery(SQLite, "BEGIN TRANSACTION; CREATE TABLE IF NOT EXISTS 'Test' (Kolumna_1 TEXT, Kolumna_2 INTEGER, Kolumna_3 TEXT);")
- MySQLQuery = dbQuery(MySQL, "CREATE TABLE IF NOT EXISTS Test (Kolumna_1 TEXT, Kolumna_2 INT(2), Kolumna_3 TEXT);")
- function Insert_Record(text, ID, text_2)
- local QueryHandleSQLite = dbQuery(SQLite, "INSERT INTO 'Test' VALUES('?, ?, ?');", text, ID, text_2);
- local QueryHandleMySQL = dbQuery(MySQL, "INSERT INTO 'Test' VALUES('?, ?, ?');", text, ID, text_2);
- end
- function Fill_Tables()
- local now = getTickCount()
- for i = 0, 10000 do
- Insert_Record("ID I: " .. i, i, "ID II: " ..i)
- end
- local diff = getTickCount() - now;
- outputDebugString("Pomyślnie wypełniono tabelę 10000 debilizmów w czasie " .. diff .. ".")
- end
- function Select()
- local now = getTickCount()
- local QueryHandleSQLite = dbQuery(SQLite, "COMMIT; SELECT Kolumna_1 FROM 'Test';")
- local QueryHandleSQLite = dbQuery(MySQL, "SELECT Kolumna_1 FROM 'Test';")
- local diff = getTickCount() - now;
- outputDebugString("Pomyślnie wybrano 10000 debilizmów z tabeli w czasie " .. diff .. ".")
- end
- addCommandHandler("insert", Fill_Tables)
- addCommandHandler("show", Select)
- --
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement