Re: [Phplib-users] Test whether db table exists using DB_SQL
Brought to you by:
nhruby,
richardarcher
From: Peter T. <pte...@te...> - 2001-08-16 20:15:45
|
Peter, Why not create a small 'meta' table that contains a flag that you set on the creation of the target table? If the flag doesn't exist you have to create your table, otherwise the table already exists. Maybe this approach is too simplistic, but at least it will work in every DB environment. Cheers, Peter At 10:14 16-08-2001, Peter Bowyer wrote: >At 05:48 PM 8/16/01 +1000, you wrote: >> >I thought that this SQL was specific to MySQL :-( >> >>You're right... at least it won't work on MSSql/ODBC: >> >>Warning: SQL error: [Microsoft][ODBC SQL Server Driver][SQL Server] >>Could not find stored procedure 'show'., SQL state 37000 in >>SQLExecDirect in D:\www\test\html\test.php on line 24 >> >>Bummer! >> >>I guess you just have to perform the query and see if you encounter >>an error. > >I tried that, but I couldn't suppress an error message :-( >Actually I found that changing var $Halt_On_Error in db_mysql.inc to "no" >cured the problem - however, this variable isn't implemented in the other >database drivers, and I only have access to MySQL so cannot test it on the >other databases at the present time :-( > >Can you confirm how the other drivers react if there is no table present? > >Thanks, >Peter. > >-- >In the beginning was the word, >and the word was Content-type: text/plain. > > >_______________________________________________ >Phplib-users mailing list >Php...@li... >http://lists.sourceforge.net/lists/listinfo/phplib-users ------------------------------------------------------------------ TERIS Information Services BV Peter Termaten Phone: +31 20 494 2503 Rode Kruisstraat 22E Fax: +31 20 494 2504 1025 KN Amsterdam Mobile: +31 653 65 8686 www.teris.nl ------------------------------------------------------------------ |