source: trunk/phpgwapi/inc/adodb/tests/test-xmlschema.php @ 34

Revision 34, 1.3 KB checked in by niltonneto, 17 years ago (diff)

Versão nova do ADODB (4.5 para 4.95)

  • Property svn:eol-style set to native
  • Property svn:executable set to *
RevLine 
[2]1<?PHP
2
3// V4.50 6 July 2004
4
5error_reporting(E_ALL);
[34]6include_once( "../adodb.inc.php" );
7include_once( "../adodb-xmlschema03.inc.php" );
[2]8
9// To build the schema, start by creating a normal ADOdb connection:
10$db = ADONewConnection( 'mysql' );
[34]11$db->Connect( 'localhost', 'root', '', 'test' ) || die('fail connect1');
[2]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
21print "<b>SQL to build xmlschema.xml</b>:\n<pre>";
22// Build the SQL array
23$sql = $schema->ParseSchema( "xmlschema.xml" );
24
[34]25var_dump( $sql );
[2]26print "</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
[34]36
37print "<b>SQL to build xmlschema-mssql.xml</b>:\n<pre>";
38
[2]39$db2 = ADONewConnection('mssql');
[34]40$db2->Connect('','adodb','natsoft','northwind') || die("Fail 2");
[2]41
42$db2->Execute("drop table simple_table");
43
44$schema = new adoSchema( $db2 );
45$sql = $schema->ParseSchema( "xmlschema-mssql.xml" );
46
47print_r( $sql );
48print "</pre>\n";
49
50$db2->debug=1;
51
[34]52foreach ($sql as $s)
53$db2->Execute($s);
[2]54?>
Note: See TracBrowser for help on using the repository browser.