"TYPO3 4.0.1: typo3_src-4.0.1/typo3/sysext/adodb/adodb/tests/test-xmlschema.php Source File", "datetime" => "Sat Dec 2 19:22:26 2006", "date" => "2 Dec 2006", "doxygenversion" => "1.4.6", "projectname" => "TYPO3 4.0.1", "projectnumber" => "4.0.1" ); get_header($doxygen_vars); ?>

test-xmlschema.php

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', '', 'schematest' );
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 print_r( $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 ?>