Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- main () {
- new
- DB:db = db_open("temp.db")
- ;
- // synchronous
- db_query(db, "PRAGMA synchronous = ON");
- db_query(db, "CREATE TABLE test (a, b, c)");
- new start_tick = GetTickCount();
- for (new i = 0; i < 50; i++)
- db_free_result(db_query(db, "INSERT INTO test VALUES(1, 2, 3)"));
- printf("Inserting 50 rows synchronously took %dms.", GetTickCount() - start_tick);
- db_query(db, "DROP TABLE test");
- // asynchronous
- db_query(db, "CREATE TABLE test (a, b, c)");
- start_tick = GetTickCount();
- db_query(db, "PRAGMA synchronous = OFF");
- for (new i = 0; i < 50; i++)
- db_free_result(db_query(db, "INSERT INTO test VALUES(1, 2, 3)"));
- printf("Inserting 50 rows asynchronously took %dms.", GetTickCount() - start_tick);
- db_query(db, "DROP TABLE test");
- quit();
- }
Add Comment
Please, Sign In to add comment