Is it not possible to run the "show create table __" via PDO? I swear I was able to do this in the past, and for some reason this is not working. Am I doing something wrong, is this a bug, or is this planned?

Pasted below is the mysql command and result expected, test code, and its result.

-ralph




#### PROOF THE COMMAND WORKS

[EMAIL PROTECTED] ~/development/code/php5.1-200604220230 $ echo "show create table blog_comments" | mysql -u root --password=xxxxxx test
Table   Create Table
blog_comments CREATE TABLE `blog_comments` (\n `id` int(11) NOT NULL auto_increment,\n `blog_entry_id` int(11) NOT NULL,\n `comment` text NOT NULL,\n `comment_datetime` datetime NOT NULL,\n PRIMARY KEY (`id`),\n KEY `FK_blog_comments_1` (`blog_entry_id`),\n CONSTRAINT `FK_blog_comments_1` FOREIGN KEY (`blog_entry_id`) REFERENCES `blog_entries` (`id`) ON DELETE CASCADE ON UPDATE CASCADE\n) ENGINE=InnoDB DEFAULT CHARSET=utf8


#### THE TEST SCRIPT

[EMAIL PROTECTED] ~/development/code/php5.1-200604220230 $ cat /home/ralph/development/vhosts/ralphschindler.com/development/test_show.php
<?

$db = new PDO("mysql:dbname=test", "root", "xxxxxx");

echo "\nTEST PREPARED-------\n";

try {
    $stmt = $db->prepare("SHOW CREATE TABLE blog_comments");
    $stmt->execute();
    print_r($stmt); echo "\n";
    $result = $stmt->fetchAll(PDO::FETCH_ASSOC);
    print_r($result);
    echo "no exceptions\n";
} catch (Exception $e) {
    echo $e->getMessage();
    echo "exception";
}

echo "\n\nTEST QUERY--------\n";

try {
    $thing = $db->query("SHOW CREATE TABLE blog_comments");
    print_r($thing); echo "\n";
    echo "no exception\n";
} catch (Exception $e) {
    echo $e->getMessage();
    echo "exception";
}


#### TEST SCRIPT OUTPUT


[EMAIL PROTECTED] ~/development/code/php5.1-200604220230 $ ./sapi/cli/php /home/ralph/development/vhosts/ralphschindler.com/development/test_show.php

TEST PREPARED-------
PDOStatement Object
(
    [queryString] => SHOW CREATE TABLE blog_comments
)

Array
(
)
no exceptions


TEST QUERY--------

no exception

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to