From:             [EMAIL PROTECTED]
Operating system: NT4
PHP version:      4.1.2
PHP Bug Type:     MSSQL related
Bug description:  Multiple statement in a query cause subsequent queries to fail

I am creating tables and indexes in a few places.  To make life a little
easier I want to create a table and it's indexes in one go.

The following code fails:
----
$queries[0]["query_string"]="CREATE TABLE objects (
        [id] integer IDENTITY (1,1) PRIMARY KEY,
        [type] varchar(16) DEFAULT '' NOT NULL,
        [object] text,
        [vtype] varchar(16) DEFAULT '' NOT NULL,
        [lastchanged] TIMESTAMP);
CREATE INDEX objects_lastchanged ON objects (lastchanged);";

$queries[1]["query_string"]="CREATE TABLE nodes (
        path varchar(127) DEFAULT '' NOT NULL PRIMARY KEY,
        parent varchar(127) DEFAULT '' NOT NULL,
        object numeric(11) DEFAULT '0' NOT NULL,
        priority numeric(11) DEFAULT '0' NOT NULL
);";

while ((list($key, $query)=each($queries)) && (!$error)) {
        echo $query["query_string"];
        $exec=mssql_query($query["query_string"]);
}

----

But if I separate out the create index into a separate query it works
fine.
-- 
Edit bug report at http://bugs.php.net/?id=16277&edit=1
-- 
Fixed in CVS:        http://bugs.php.net/fix.php?id=16277&r=fixedcvs
Fixed in release:    http://bugs.php.net/fix.php?id=16277&r=alreadyfixed
Need backtrace:      http://bugs.php.net/fix.php?id=16277&r=needtrace
Try newer version:   http://bugs.php.net/fix.php?id=16277&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=16277&r=support
Expected behavior:   http://bugs.php.net/fix.php?id=16277&r=notwrong
Not enough info:     http://bugs.php.net/fix.php?id=16277&r=notenoughinfo
Submitted twice:     http://bugs.php.net/fix.php?id=16277&r=submittedtwice

Reply via email to