Bug #4406: ODBC updates to dBase4 files aren't reflected in index file so changes are gone

From: Date: Thu, 11 May 2000 18:58:13 +0000
Subject: Bug #4406: ODBC updates to dBase4 files aren't reflected in index file so changes are gone
Groups: php.dev 
Request: Send a blank email to php-dev+get-18620@lists.php.net to get a copy of this message
From: robert.wadsworth@cache.k12.ut.us Operating system: WinNT4.0 server,IIS4,SP6 PHP version: 3.0.16 PHP Bug Type: ODBC related Bug description: ODBC updates to dBase4 files aren't reflected in index file so changes are gone The problem I have found occurs when using ODBC for insertions/deletions into a dBase4 table. (I am using MS ODBC DBase driver version 3.51.102900 ODBCJT32.DLL). I do not know if the problem is occurring from PHP or from the Microsoft ODBC driver. (I am using ODBC for the multi-thread support, don't really want to use non-threaded PHP DBase functions) The sample code below was run on an empty table (as well as a populated table) in both cases the new records were in the dbase4 DBF file, but not accessable until the MDX file was manually rebuilt. Since the new record is in the DBF file and PHP isn't retrieving it until the index file is rebuilt, I think that PHP is correctly using the index file to access the dbase4 DBF file, but I don't know why the MDX file is not being updated. Both PHP and MS ODBC information say that with Dbase4/5 files the MDX files are automatically linked and updated. I believe they are being linked for reading, but the MDX is not being updated after delete or write. ANY help would be greatly appreciated! Robert ----sample code <? function Error_Handler( $msg, $cnx ) { echo "<font color=\"#FF0000\">$msg </font>\n"; odbc_close( $cnx); exit(); } function Get_SQLDateformat( $date ) { $y=substr($date,0,4); $m=substr($date,4,2); $d=substr($date,6,2); $newdate="$y-$m-$d"; return($newdate); } function addrecord_table() { $cnx = odbc_connect( "sasiDB" , '', ''); if( ! $cnx ) { Error_handler( "Error in odbc_connect" , $cnx ); } //INSERT INTO ANTIQUES (BUYERID, SELLERID, ITEM) VALUES (01, 21, 'Ottoman'); //echo "INSERT INTO $table (STULINK,STARTDT,ENDDT,MEMBERSHIP) VALUES ($stulink,'$startdt','$enddt','$membership')"; //$cur= odbc_exec( $cnx, "INSERT INTO $table (STULINK,STARTDT,ENDDT,MEMBERSHIP) VALUES ('$stulink',$startdt,$enddt,'$membership')" ); // $sd=Get_SQLDateformat($startdt); // $ed=Get_SQLDateformat($enddt); $stulink="1510"; $sd="2000-06-01"; $ed="2000-06-02"; $membership=2; $table="USMB9320"; echo "<BR>Insert Query: INSERT INTO $table (STULINK,STARTDT,ENDDT,MEMBERSHIP) VALUES ($stulink,$sd,$ed,$membership)<BR>"; $cur= odbc_exec( $cnx, "INSERT INTO $table (STULINK,STARTDT,ENDDT,MEMBERSHIP) VALUES ($stulink,$sd,$ed,$membership)" ); if( ! $cur ) { Error_handler( "Error in odbc_exec( no cursor returned ) " , $cnx ); } echo "Inserted $cur fields to $table - Done<BR>\n"; odbc_commit( $cnx); odbc_close( $cnx); } function dump_table() { echo "<BR><BR>"; $cnx = odbc_connect( "sasiDB" , '', ''); if( ! $cnx ) { Error_handler( "Error in odbc_connect" , $cnx ); } $cur= odbc_exec( $cnx, "SELECT * FROM USMB9325" ); echo "Dumping Table<BR>"; echo "SELECT * FROM $table CUR:$cur <BR>"; if( ! $cur ) { Error_handler( "Error in odbc_exec( no cursor returned ) " , $cnx ); } $nf=odbc_num_fields($cur); echo "NF: $nf <BR>"; for($i=1;$i<=$nf;$i++) { $f[$i]= odbc_field_name( $cur, $i ); // get the field echo "$f[$i] "; } echo "<BR>\n"; while( odbc_fetch_row( $cur ) ) { for($i=1;$i<=$nf;$i++) { $rec[$i]= odbc_result( $cur, $i ); // get the field echo "$rec[$i] "; } echo "<BR>"; } odbc_close( $cnx); } dump_table(); addrecord_table(); dump_table(); ?> ------from php3.ini------ ;;;;;;;;;;;;;;;;;;;;;; ; Dynamic Extensions ; ;;;;;;;;;;;;;;;;;;;;;; ; if you wish to have an extension loaded automaticly, use the ; following syntax: extension=modulename.extension ; for example, on windows, ; extension=msql.dll ; or under UNIX, ; extension=msql.so ; Note that it should be the name of the module only, no directory information ; needs to go here. Specify the location of the extension with the extension_dir directive above. ;Windows Extensions ;extension=php3_mysql.dll ;extension=php3_calendar.dll extension=php3_dbase.dll ;extension=php3_gd.dll ;extension=php3_dbm.dll ;extension=php3_mssql.dll ;extension=php3_zlib.dll ;extension=php3_filepro.dll ;extension=php3_imap4r1.dll ;extension=php3_ldap.dll ;extension=php3_crypt.dll ;extension=php3_msql2.dll extension=php3_odbc.dll

« previous php.dev (#18620) next »