Example #1
0
 function testQuery()
 {
     $dbh = bmark_connect('drizzle');
     print_r($dbh);
     $sql = "select * from items order by stuff";
     $result = bmark_query($sql, $dbh);
     print_r($result);
     $this->assertTrue($result);
 }
require_once 'functions.php';
require 'Benchmark/Timer.php';
$shortopts = "h";
$options = getopt($shortopts);
if (isset($options['h'])) {
    print "usage: php build_tables.php <rows> <partitions> <mysql|drizzle>\n";
    die;
}
$max_rows = $_SERVER['argv'][1];
$parts = $_SERVER['argv'][2];
$db_type = $_SERVER['argv'][3];
// db select is contained with bmark_connect
if (strlen($db_type) <= 0) {
    $db_type = 'drizzle';
}
$dbh = bmark_connect($db_type);
$timer = new Benchmark_Timer();
$timer->start();
// build it 3 types of tables
// 1) a table with 5000 users indexed
// 2) a table with 5000 users code partitioned and indexed
// 3) a table with 5000 users mysql partitioned
/*
$max_rows    = 500;
$parts       = 5;
*/
$perpart = ceil($max_rows / $parts);
$mid_perpart = ceil($perpart / 2);
$mid_id = ceil($max_rows / 2);
$mid_table = ceil($parts / 2);
$s_mid_table = padNumber($mid_table, 2);