View Issue Details

IDProjectCategoryView StatusLast Update
352PHPOF2Defaultpublic14 Sep 2010 12:38
Reporterwcrouch Assigned Totimj  
PrioritynormalSeverityfeatureReproducibilityalways
Status closedResolutionfixed 
Target Version0.12.2Fixed in Version0.12.2 
Summary352: Add the ability to refresh the schema details for an instance of PHPOF2 DB Table
DescriptionWhen making changes to a database from code, the results from discoverSchema can become out of date. Eg with an upgrade management app, you may have loaded the table, then made changes to the structure, if you then use the table again, the schema will be out of date, and insert/update operations will fail.
TagsNo tags attached.
Attached Files
refresh_schema.diff (763 bytes)   
Index: DBTable.php
===================================================================
--- DBTable.php	(revision 32940)
+++ DBTable.php	(working copy)
@@ -442,6 +442,23 @@
 		// Now create _list properties
 		$this->_createSchemaCachedLists();
 	}
+
+	/**
+     * Clear internal cached lists and rediscover the schema
+	 *
+	 * @return void
+     */
+	public function refreshSchema() {
+		$this->fields_normal = array();
+		$this->pri_keys = array();
+		$this->fgn_keys = array();
+		$this->fieldlist = array();
+		$this->pri_key_list = array();
+		$this->key_auto_increment = false;
+		$this->field_defs = array();
+		$this->fields_lob = array();
+		$this->discoverSchema();
+	}
 	
 	/**
 	 * Create cached properties containing lists of *pre-quoted* fields and
refresh_schema.diff (763 bytes)   

Activities

wcrouch

30 Jul 2010 09:03

reporter   ~372

Last edited: 30 Jul 2010 09:04

I have attached a patch that adds a method refreshSchema()

timj

14 Sep 2010 12:29

manager   ~379

Last edited: 14 Sep 2010 12:31

Fixed in SVN r2197 - see reloadSchema()

Issue History

Date Modified Username Field Change
28 May 2010 14:12 wcrouch New Issue
30 Jul 2010 09:03 wcrouch Note Added: 372
30 Jul 2010 09:03 wcrouch File Added: refresh_schema.diff
30 Jul 2010 09:04 wcrouch Note Edited: 372
14 Sep 2010 12:14 timj Assigned To => timj
14 Sep 2010 12:14 timj Status new => assigned
14 Sep 2010 12:14 timj Target Version => 0.12.2
14 Sep 2010 12:29 timj Note Added: 379
14 Sep 2010 12:29 timj Status assigned => resolved
14 Sep 2010 12:29 timj Resolution open => fixed
14 Sep 2010 12:29 timj Fixed in Version => 0.12.2
14 Sep 2010 12:29 timj Note Edited: 379
14 Sep 2010 12:31 timj Note Edited: 379
14 Sep 2010 12:38 timj Status resolved => closed