home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2005 June / PCpro_2005_06.ISO / files / opensource / xamp / xampp-win32.exe / xampp / test-xmlschema.php < prev    next >
Encoding:
PHP Script  |  2004-09-28  |  1.3 KB  |  53 lines

  1. <?PHP
  2.  
  3. // V4.50 6 July 2004
  4.  
  5. error_reporting(E_ALL);
  6. include_once( "../adodb.inc.php" );
  7. include_once( "../adodb-xmlschema.inc.php" );
  8.  
  9. // To build the schema, start by creating a normal ADOdb connection:
  10. $db = ADONewConnection( 'mysql' );
  11. $db->Connect( 'localhost', 'root', '', 'schematest' );
  12.  
  13. // To create a schema object and build the query array.
  14. $schema = new adoSchema( $db );
  15.  
  16. // To upgrade an existing schema object, use the following 
  17. // To upgrade an existing database to the provided schema,
  18. // uncomment the following line:
  19. #$schema->upgradeSchema();
  20.  
  21. print "<b>SQL to build xmlschema.xml</b>:\n<pre>";
  22. // Build the SQL array
  23. $sql = $schema->ParseSchema( "xmlschema.xml" );
  24.  
  25. print_r( $sql );
  26. print "</pre>\n";
  27.  
  28. // Execute the SQL on the database
  29. //$result = $schema->ExecuteSchema( $sql );
  30.  
  31. // Finally, clean up after the XML parser
  32. // (PHP won't do this for you!)
  33. //$schema->Destroy();
  34.  
  35.  
  36. $db2 = ADONewConnection('mssql');
  37. $db2->Connect('localhost','sa','natsoft','northwind') || die("Fail 2");
  38.  
  39. $db2->Execute("drop table simple_table");
  40.  
  41.  
  42. print "<b>SQL to build xmlschema-mssql.xml</b>:\n<pre>";
  43.  
  44. $schema = new adoSchema( $db2 );
  45. $sql = $schema->ParseSchema( "xmlschema-mssql.xml" );
  46.  
  47. print_r( $sql );
  48. print "</pre>\n";
  49.  
  50. $db2->debug=1;
  51.  
  52. $db2->Execute($sql[0]);
  53. ?>