-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathkv-pgsql.inc
More file actions
50 lines (43 loc) · 1.17 KB
/
kv-pgsql.inc
File metadata and controls
50 lines (43 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
/**
* php safe options - only tests mod pgsql
* Php 5.0+
*/
/** ---------------------------------- Tests functions -------------------------------------------- */
// ------------------------- INTL tests -----------------------
/**
* @since 4.0
*/
function test_47_kvs_pgsql()
{
global $testsLoopLimits, $totalOps, $emptyResult;
global $sqlite3_dbpath, $debugMode;
if (!is_file('kvstorage-pgsql.inc')){
if ($debugMode) print("storage no file");
return $emptyResult;
}
if (!function_exists('pg_query')){
if ($debugMode) print("no func");
return $emptyResult;
}
include_once('kvstorage-pgsql.inc');
$kvstorage=new KVStoragePgsql();
$kvstorage->open();
$kvstorage->drop();
$kvstorage->create();
if (!$kvstorage->available){
if ($debugMode) print("storage noavail");
return $emptyResult;
}
$count = $testsLoopLimits['47_kvs_pgsql'];
$time_start = get_microtime();
for ($i = 0; $i < $count; $i++) {
$num = number_format($i / 100., 2, '.', '');
$kvstorage->set($i, $num);
$v=$kvstorage->get($i);
$kvstorage->del($i);
}
$kvstorage->close();
$totalOps += $count;
return format_result_test(get_microtime() - $time_start, $count, mymemory_usage());
}