Documentation TYPO3 par Ameos |
00001 <?PHP 00002 00003 // V4.50 6 July 2004 00004 00005 error_reporting(E_ALL); 00006 include_once( "../adodb.inc.php" ); 00007 include_once( "../adodb-xmlschema03.inc.php" ); 00008 00009 // To build the schema, start by creating a normal ADOdb connection: 00010 $db = ADONewConnection( 'mysql' ); 00011 $db->Connect( 'localhost', 'root', '', 'test' ) || die('fail connect1'); 00012 00013 // To create a schema object and build the query array. 00014 $schema = new adoSchema( $db ); 00015 00016 // To upgrade an existing schema object, use the following 00017 // To upgrade an existing database to the provided schema, 00018 // uncomment the following line: 00019 #$schema->upgradeSchema(); 00020 00021 print "<b>SQL to build xmlschema.xml</b>:\n<pre>"; 00022 // Build the SQL array 00023 $sql = $schema->ParseSchema( "xmlschema.xml" ); 00024 00025 var_dump( $sql ); 00026 print "</pre>\n"; 00027 00028 // Execute the SQL on the database 00029 //$result = $schema->ExecuteSchema( $sql ); 00030 00031 // Finally, clean up after the XML parser 00032 // (PHP won't do this for you!) 00033 //$schema->Destroy(); 00034 00035 00036 00037 print "<b>SQL to build xmlschema-mssql.xml</b>:\n<pre>"; 00038 00039 $db2 = ADONewConnection('mssql'); 00040 $db2->Connect('','adodb','natsoft','northwind') || die("Fail 2"); 00041 00042 $db2->Execute("drop table simple_table"); 00043 00044 $schema = new adoSchema( $db2 ); 00045 $sql = $schema->ParseSchema( "xmlschema-mssql.xml" ); 00046 00047 print_r( $sql ); 00048 print "</pre>\n"; 00049 00050 $db2->debug=1; 00051 00052 foreach ($sql as $s) 00053 $db2->Execute($s); 00054 ?>