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); $dbmain = $newconn(); $dbmain->execute("create table {$table} (id int unsigned not null primary key) engine=innodb"); $conn1 = $newconn(); $conn2 = $newconn(); Tap::ok($conn1 !== $conn2, 'created two db objects'); $rs = $conn1->execute('SELECT CONNECTION_ID() as id'); $row = $rs->fetch(); $id1 = $row['id'];