pyquery scraper beginnings
[disclosr.git] / couchdb / settee / examples / db.ops.php
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
#!/usr/bin/env php
 
<?php
 
require (realpath(dirname(__FILE__) . '/../src/settee.php'));
 
$server = new SetteeServer('http://127.0.0.1:5984');
 
 
$dbs = array (
  1 => "settee_test_perf_01",
  2 => "settee_test_perf_02",
  3 => "settee_test_perf_03",
);
 
print ("creating databases: \n");
 
foreach ($dbs as $db) {
  $start = microtime(true);
  try {
    $ret = $server->create_db($db);
  } catch (Exception $e) {
    //-- re-throw. this is just for demo
    throw $e;
  }
  $elapsed = microtime(true) - $start;
  print("Time elapsed: $elapsed \n");
}
 
$ret = $server->list_dbs();
print_r($ret);
print ("\n");
 
print ("dropping databases: \n");
 
foreach ($dbs as $db) {
  $start = microtime(true);
  try {
    $ret = $server->drop_db($db);
  } catch (Exception $e) {
    //-- re-throw. this is just for demo
    throw $e;
  }
  $elapsed = microtime(true) - $start;
  print("Time elapsed: $elapsed \n");
}
 
$ret = $server->list_dbs();
print_r($ret);