Tap::is($rs->fetch(), array('test' => '1112.122445543333333333'), 'query execute works injecting big float in');
$rs = $db->execute('SELECT %f as test', 'dummy');
Tap::is($rs->fetch(), array('test' => '0'), 'query execute sanitizes non float');
$query = $db->prep('%s', array('dummy', 'rummy'));
Tap::is($query, "'dummy', 'rummy'", 'format query handles arrays of strings');
$query = $db->prep('%i', array(1, 2, 3));
Tap::is($query, '1, 2, 3', 'format query handles arrays of integers');
$query = $db->prep('%f', array(1.545, 2.2, 3));
Tap::is($query, '1.545, 2.2, 3', 'format query handles arrays of floats');
$query = $db->prep('test %%s ?, (?,?)', array(1, 2), 3, 4);
Tap::is($query, "test %s '1', '2', ('3','4')", 'format query question mark as string');
$rs = $db->execute('err');
Tap::cmp_ok($rs, '===', FALSE, 'db returns false on query error');
Tap::like($db->error(), '/you have an error in your sql syntax/i', '$db->error() returns error message');
Tap::is($db->errorcode(), 1064, 'returns expected mysql error code');
$db = new DB\Except(DB\Connection::instance('test'));
$err = NULL;
try {
    $db->execute('err');
} catch (Exception $e) {
    $err = (string) $e;
}
Tap::like($err, '/database error/i', 'When a bad query is run using execute() the except wrapper tosses an exception');
Tap::is($db->isa(get_class($original)), TRUE, 'isa returns true for original object');
Tap::is($db->isa('gaia\\db'), TRUE, 'isa returns true for gaia\\db');
$rs = $db->execute("SELECT 'test' as r1");
Tap::is($rs->affected(), 1, 'selected a row, affected rows is one');
$newconn = function () use($instance) {
    return new DB($instance());
};
$table = 'test_' . time() . '_' . mt_rand(10000, 99999);
#!/usr/bin/env php
<?php 
include __DIR__ . '/../common.php';
use Gaia\Test\Tap;
use Gaia\Store;
use Gaia\DB;
$db = new DB\Except(new Gaia\DB(new MySQLi('127.0.0.1', NULL, NULL, 'test', '3306')));
DB\Connection::load(array('test' => function () use($db) {
    return $db;
}));
$table = 'mysql_loadtest';
$store = new Store\Prefix(new Store\MySQL('test', $table), mt_rand(1, 100000000) . '/');
$schema = $store->schema();
$db->execute($schema);
include __DIR__ . '/.load_test.php';