pdo_mysql_stmt_bindparam_types($db, 34, 'DATE', '2008-04-23');
    pdo_mysql_stmt_bindparam_types($db, 35, 'TIME', '16:43:12');
    pdo_mysql_stmt_bindparam_types($db, 36, 'TIMESTAMP', '2008-04-23 16:44:53');
    pdo_mysql_stmt_bindparam_types($db, 37, 'DATETIME', '2008-04-23 16:44:53');
    pdo_mysql_stmt_bindparam_types($db, 38, 'YEAR', '2008');
    pdo_mysql_stmt_bindparam_types($db, 39, 'CHAR(1)', 'a');
    pdo_mysql_stmt_bindparam_types($db, 40, 'CHAR(255)', 'abc');
    pdo_mysql_stmt_bindparam_types($db, 41, 'VARCHAR(255)', str_repeat('a', 255));
    pdo_mysql_stmt_bindparam_types($db, 42, 'BINARY(255)', str_repeat('a', 255));
    pdo_mysql_stmt_bindparam_types($db, 43, 'VARBINARY(255)', str_repeat('a', 255));
    pdo_mysql_stmt_bindparam_types($db, 44, 'TINYBLOB', str_repeat('a', 255));
    pdo_mysql_stmt_bindparam_types($db, 45, 'BLOB', str_repeat('b', 300));
    pdo_mysql_stmt_bindparam_types($db, 46, 'MEDIUMBLOB', str_repeat('b', 300));
    pdo_mysql_stmt_bindparam_types($db, 47, 'LONGBLOB', str_repeat('b', 300));
    pdo_mysql_stmt_bindparam_types($db, 48, 'TINYTEXT', str_repeat('c', 255));
    pdo_mysql_stmt_bindparam_types($db, 49, 'TINYTEXT BINARY', str_repeat('c', 255));
    pdo_mysql_stmt_bindparam_types($db, 50, 'TEXT', str_repeat('d', 300));
    pdo_mysql_stmt_bindparam_types($db, 51, 'TEXT BINARY', str_repeat('d', 300));
    pdo_mysql_stmt_bindparam_types($db, 52, 'MEDIUMTEXT', str_repeat('d', 300));
    pdo_mysql_stmt_bindparam_types($db, 53, 'MEDIUMTEXT BINARY', str_repeat('d', 300));
    pdo_mysql_stmt_bindparam_types($db, 54, 'LONGTEXT', str_repeat('d', 300));
    pdo_mysql_stmt_bindparam_types($db, 55, 'LONGTEXT BINARY', str_repeat('d', 300));
    pdo_mysql_stmt_bindparam_types($db, 56, "ENUM('yes', 'no') DEFAULT 'yes'", "no");
    pdo_mysql_stmt_bindparam_types($db, 57, "SET('yes', 'no') DEFAULT 'yes'", "no");
} catch (PDOException $e) {
    printf("[001] %s [%s] %s\n", $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
}
print "done!";
require dirname(__FILE__) . '/mysql_pdo_test.inc';
MySQLPDOTest::dropTestTable();
Esempio n. 2
0
    if (!isset($rows[0]['label']) || $rows[0]['label'] != 'z') {
        printf("[006] Record data is strange, dumping rows\n");
        var_dump($rows);
    }
    // Ok, lets check MyISAM resp. any other non-transactional engine
    // pdo_mysql_begin_transaction has more on this, quick check only
    $db = MySQLPDOTest::factory();
    MySQLPDOTest::createTestTable($db, 'MyISAM');
    if (true !== ($tmp = $db->beginTransaction())) {
        printf("[007] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
    }
    $db->exec("INSERT INTO test(id, label) VALUES (100, 'z')");
    if (true !== ($tmp = $db->commit())) {
        printf("[008] No commit allowed? [%s] %s\n", $db->errorCode(), implode(' ', $db->errorInfo()));
    }
    // a weak test without unicode etc. - lets leave that to dedicated tests
    $stmt = $db->query('SELECT id, label FROM test WHERE id = 100');
    $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
    if (!isset($rows[0]['label']) || $rows[0]['label'] != 'z') {
        printf("[009] Record data is strange, dumping rows\n");
        var_dump($rows);
    }
} catch (PDOException $e) {
    printf("[002] %s, [%s] %s\n", $e->getMessage(), $db->errorCode(), implode(' ', $db->errorInfo()));
}
print "done!";
require dirname(__FILE__) . '/mysql_pdo_test.inc';
$db = MySQLPDOTest::factory();
$db->exec('DROP TABLE IF EXISTS test_commit');
MySQLPDOTest::dropTestTable($db);