ODBC test cases

From: Date: Wed, 07 Mar 2001 17:24:28 +0000
Subject: ODBC test cases
Groups: php.db 
Request: Send a blank email to php-db+get-7161@lists.php.net to get a copy of this message
Hi, I've been working on some of the bugs for ODBC in the bugs db, mainly those dealing with Windows and ODBC. One of the common bugs seems to be using odbc_prepare() and odbc_execute() in conjuction with each other. I was hoping someone might be able to do an ODBC test case for me, on something other than Microsoft Access (which is all I have MS wise). Two tables should be created, odbcetest1 and odbctest2. Any writes in this script to odbctest1 should fail, but I believe odbctest2 should work fine. If anyone can send me some results confirming or denying my theory, they would be appriciated. :) <? // // this is just a quick and dirty proof of concept script // // // please setup this script to connect to your database // $conn = odbc_connect("phptest","",""); if (!$conn) { print "Error in connecting<BR>\n"; exit; } odbc_exec($conn,"DROP TABLE odbctest1"); odbc_exec($conn,"CREATE TABLE odbctest1 (id INT, firstname CHAR(24), lastname CHAR(24))"); odbc_exec($conn,"DROP TABLE odbctest2"); odbc_exec($conn,"CREATE TABLE odbctest2 (id CHAR(2), firstname CHAR(24), lastname CHAR(24))"); odbc_exec($conn,"INSERT INTO odbctest1 (id,firstname,lastname) VALUES (0,'Zend','PHP')"); odbc_exec($conn,"INSERT INTO odbctest2 (id,firstname,lastname) VALUES ('99','Apache','Origami')"); $stmt1 = odbc_prepare($conn,"INSERT INTO odbctest1 (id,firstname,lastname) VALUES (?,?,?)"); if ($stmt1) { print "Trying execute stat1<br>"; $stmt1 = odbc_execute($stmt1,array(1,"This","Fails")); } $stmt2 = odbc_prepare($conn,"INSERT INTO odbctest2 (id,firstname,lastname) VALUES (?,?,?)"); if ($stmt2) { print "Trying execute stat2<br>"; $stmt1 = odbc_execute($stmt1,array("1","This","Works")); } ?> -- Dan Kalowsky "Tonight I think I'll walk alone, Worldgate Communications I'll find my soul as I go home." Software Engineer - TICS Group - Temptation kalowsky@php.net

« previous php.db (#7161) next »