Guest User

Untitled

a guest
Jun 21st, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.83 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. main () {
  4.     new
  5.         DB:db = db_open("temp.db")
  6.     ;
  7.    
  8.     // synchronous
  9.    
  10.     db_query(db, "PRAGMA synchronous = ON");
  11.    
  12.     db_query(db, "CREATE TABLE test (a, b, c)");
  13.    
  14.     new start_tick = GetTickCount();
  15.    
  16.     for (new i = 0; i < 50; i++)
  17.         db_free_result(db_query(db, "INSERT INTO test VALUES(1, 2, 3)"));
  18.    
  19.     printf("Inserting 50 rows synchronously took %dms.", GetTickCount() - start_tick);
  20.    
  21.     db_query(db, "DROP TABLE test");
  22.    
  23.     // asynchronous
  24.    
  25.     db_query(db, "CREATE TABLE test (a, b, c)");
  26.    
  27.     start_tick = GetTickCount();
  28.    
  29.     db_query(db, "PRAGMA synchronous = OFF");
  30.    
  31.     for (new i = 0; i < 50; i++)
  32.         db_free_result(db_query(db, "INSERT INTO test VALUES(1, 2, 3)"));
  33.    
  34.     printf("Inserting 50 rows asynchronously took %dms.", GetTickCount() - start_tick);
  35.    
  36.     db_query(db, "DROP TABLE test");
  37.    
  38.     quit();
  39. }
Add Comment
Please, Sign In to add comment