gobrien | dd79db8 | 2008-04-26 00:09:51 +0000 | [diff] [blame] | 1 | <?php |
| 2 | /******************************************************************************* |
| 3 | * Copyright (c) 2007 Eclipse Foundation and others. |
| 4 | * All rights reserved. This program and the accompanying materials |
| 5 | * are made available under the terms of the Eclipse Public License v1.0 |
| 6 | * which accompanies this distribution, and is available at |
| 7 | * http://www.eclipse.org/legal/epl-v10.html |
| 8 | * |
| 9 | * Contributors: |
| 10 | * Eclipse Foundation |
| 11 | *******************************************************************************/ |
| 12 | |
| 13 | include("check-database-schema.class.php"); |
| 14 | include("abstractschemachecker.class.php"); |
| 15 | |
| 16 | |
| 17 | global $spent_quries; |
| 18 | $spent_quries = array(); |
| 19 | |
| 20 | function mysql_remember_query($sql,$dbh){ |
| 21 | global $spent_quries; |
| 22 | $spent_quries[] = $sql; |
| 23 | return mysql_query($sql,$dbh); |
| 24 | } |
| 25 | |
| 26 | function dirs($path){ |
| 27 | $dirs = array(); |
| 28 | $list = scandir($path); |
| 29 | foreach($list as $dir){ |
| 30 | if($dir == "." || $dir == "..") |
| 31 | continue; |
| 32 | if(is_dir($path.$dir)){ |
| 33 | $dirs[] = $dir; |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | return $dirs; |
| 38 | } |
| 39 | |
| 40 | class context{ |
| 41 | function get($get){ |
| 42 | return $this->$get; |
| 43 | } |
| 44 | function database($dbname){ |
| 45 | return $this->dbhs[$dbname]; |
| 46 | } |
| 47 | } |
| 48 | $context = new context(); |
| 49 | $context->components_directory = "tables/"; |
| 50 | $context->dbhs['refactor_test'] = mysql_connect("localhost","root","","refactor_test"); |
| 51 | |
| 52 | $check = new CheckAndModifyDatabaseSchema(); |
| 53 | $worked = $check->check_and_modify( $context ); |
| 54 | |
| 55 | print "\n"; |
| 56 | |
| 57 | print_r($spent_quries); |
| 58 | |
| 59 | ?> |