Huh? The coca happened here?
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts MenuQuote from: Thijn on Oct 12, 2016, 07:12 PMI'm not sure what your question is
Open = ::INI_Open(File);
File = ["????????.ini", "????????.ini", "????????.ini", "????????.ini"];
Close = ::INI_Close(File);
function sqlite()
{
local t = SqTimer();
print( "SQLite Benchmark" );
printf( "Start: %dms", t.RestartRaw() / 1000);
local db = SQLite.Connection("test.sqlite");
printf( "Connection made: %dms", t.RestartRaw() / 1000 );
db.Exec(@"CREATE TABLE IF NOT EXISTS `benchmark` (`testInt` INTEGER, `testChar` TEXT, `testFloat` REAL);");
printf( "Table made: %dms", t.RestartRaw() / 1000 );
{
// Pre-compile the query
local query = db.Query("INSERT INTO `benchmark` (testInt, testChar, testFloat) VALUES(@testInt, 'test string omfg', 123456.789);");
// Cache the parameters
local p_testInt = query.Param("@testInt");
// Begin transaction
local transaction = SQLite.Transaction(db);
for( local i = 0; i < 10000; i++ )
{
query.Reset(); // Reset the query
p_testInt.SetInteger(i); // Update parameter value
query.Exec(); // Execute query
}
// Commit changes
transaction.Commit();
printf( "10.000 records inserted: %dms", t.RestartRaw() / 1000 );
}
{
// Pre-compile the query
local query = db.Query("SELECT * FROM `benchmark` WHERE `testInt` = @testInt;");
// Cache the parameters
local p_testInt = query.Param("@testInt");
for( local i = 0; i < 10000; i++ )
{
query.Reset(); // Reset the query
p_testInt.SetInteger(i); // Update parameter value
query.Step(); // Step query
}
printf( "10.000 records selected: %dms", t.RestartRaw() / 1000 );
}
print( "SQLite finished." );
}
sqlite();
[USR] SQLite Benchmark
[USR] Start: 1ms
[USR] Connection made: 1ms
[USR] Table made: 79ms
[USR] 10.000 records inserted: 150ms
[USR] 10.000 records selected: 4353ms
[USR] SQLite finished.
Quote from: Mötley on Oct 10, 2016, 11:41 PM local ip = player.IP.tostring();
local sliceip = split( ip, "." );
local ip1 = sliceip[ 0 ], ip2 = sliceip[ 1 ];
local subnet = format( ip1 + "." + ip2 );
[test]
name=squirrel
age=19
ratio=2.3
active=false
[option]
max=99
count=322153
local document = SqIni.Document();
local result = document.LoadFile("test.ini");
if (!result.Valid)
{
throw "cannot load ini file";
}
print(document.GetValue("test", "name", "unknown"));
print(document.GetValue("test", "n@me", "unknown"));
print(document.GetInteger("test", "age", 17));
print(document.GetInteger("test", "ag3", 42));
print(document.GetFloat("test", "ratio", 4.3));
print(document.GetFloat("test", "rtio", 1.34));
print(document.GetBoolean("test", "active", false));
print(document.GetBoolean("test", "act!ve", true));
print(document.GetInteger("option", "max", 0));
print(document.GetInteger("option", "count", 0));
document.SetValue("test", "name", "mikado");
document.SetInteger("option", "stage", 27);
result = document.SaveFile("test2.ini");
if (!result.Valid)
{
throw "cannot to save ini file";
}
[USR] squirrel
[USR] unknown
[USR] 19
[USR] 42
[USR] 2.3
[USR] 1.34
[USR] false
[USR] true
[USR] 99
[USR] 322153
[test]
name = mikado
age = 19
ratio = 2.3
active = false
[option]
max = 99
count = 322153
stage = 27
Quote from: Thijn on Oct 09, 2016, 04:28 PMPeople actually still play this?