note 77080 added to function.px-get-schema

From: Date: Tue, 14 Aug 2007 08:14:03 +0000
Subject: note 77080 added to function.px-get-schema
Groups: php.notes 
Request: Send a blank email to php-notes+get-129466@lists.php.net to get a copy of this message
It's not especially pretty and there isn't any error trapping, so please don't use this on any sort of production data. This will display the schema of a paradox data source.... <? /* Paradox database schema display Tim Burt 27/07/07 */ //we're expecting a filename in the post vars if ($_POST['database_name'] != "") { //Set up anything we are likely to need $database_filename = "<path to your data file>".$_POST['database_name']; echo "<p><b>Schema for ".$_POST['database_name']."</b></p>\n"; if(!$pxdoc = px_new()) { DIE("Problem !"); } $fp = fopen($database_filename, "r"); if(!px_open_fp($pxdoc, $fp)) { DIE("Couldn't open database file"); } else { //output the database schema... $stock_schema = px_get_schema($pxdoc); if (is_array($stock_schema)) { foreach ($stock_schema as $key=>$value) { echo "<br><b>".$key."</b> - Type ".$value['type']; } } } px_close($pxdoc); px_delete($pxdoc); fclose($fp); } else { //show the form to get the filename echo "<form action=\"show_schema.php\" method=\"post\">\n"; echo "<p>Data Source Name (include extension) : <input type=\"text\" size=\"10\" name=\"database_name\"></p>\n"; echo "<p><input type=\"submit\" value=\"Show Schema !\">\n"; echo "</form>\n"; } ?> ---- Server IP: 217.160.250.20 Probable Submitter: 62.56.101.147 ---- Manual Page -- http://www.php.net/manual/en/function.px-get-schema.php Edit -- https://master.php.net/note/edit/77080 Del: integrated -- https://master.php.net/note/delete/77080/integrated Del: useless -- https://master.php.net/note/delete/77080/useless Del: bad code -- https://master.php.net/note/delete/77080/bad+code Del: spam -- https://master.php.net/note/delete/77080/spam Del: non-english -- https://master.php.net/note/delete/77080/non-english Del: in docs -- https://master.php.net/note/delete/77080/in+docs Del: other reasons-- https://master.php.net/note/delete/77080 Reject -- https://master.php.net/note/reject/77080 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#129466) next »