Completed
Push — remove_deprecates ( 636195...857ec6 )
by Fabio
12:38 queued 05:17
created
framework/Data/ActiveRecord/Relations/TActiveRecordRelation.php 3 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -92,6 +92,7 @@  discard block
 block discarded – undo
92 92
 
93 93
 	/**
94 94
 	 * Fetch results for current relationship.
95
+	 * @param TActiveRecord $obj
95 96
 	 * @return boolean always true.
96 97
 	 */
97 98
 	public function fetchResultsInto($obj)
@@ -104,7 +105,6 @@  discard block
 block discarded – undo
104 105
 	 * Returns foreign keys in $fromRecord with source column names as key
105 106
 	 * and foreign column names in the corresponding $matchesRecord as value.
106 107
 	 * The method returns the first matching foreign key between these 2 records.
107
-	 * @param TActiveRecord $fromRecord
108 108
 	 * @param TActiveRecord $matchesRecord
109 109
 	 * @return array foreign keys with source column names as key and foreign column names as value.
110 110
 	 */
@@ -212,6 +212,7 @@  discard block
 block discarded – undo
212 212
 	 * @param array source property names
213 213
 	 * @param array foreign objects
214 214
 	 * @param array foreign object field names.
215
+	 * @param TActiveRecord[] $fkObjects
215 216
 	 */
216 217
 	protected function populateResult(&$results,$properties,&$fkObjects,$fields)
217 218
 	{
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
 
34 34
 	public function __construct(TActiveRecordRelationContext $context, $criteria)
35 35
 	{
36
-		$this->_context = $context;
37
-		$this->_criteria = $criteria;
36
+		$this->_context=$context;
37
+		$this->_criteria=$criteria;
38 38
 	}
39 39
 
40 40
 	/**
@@ -74,22 +74,22 @@  discard block
 block discarded – undo
74 74
 	 * @param array method arguments
75 75
 	 * @return mixed TActiveRecord or array of TActiveRecord results depending on the method called.
76 76
 	 */
77
-	public function __call($method,$args)
77
+	public function __call($method, $args)
78 78
 	{
79 79
 		static $stack=array();
80 80
 
81
-		$results = call_user_func_array(array($this->getSourceRecord(),$method),$args);
82
-		$validArray = is_array($results) && count($results) > 0;
81
+		$results=call_user_func_array(array($this->getSourceRecord(), $method), $args);
82
+		$validArray=is_array($results) && count($results) > 0;
83 83
 		if($validArray || $results instanceof \ArrayAccess || $results instanceof TActiveRecord)
84 84
 		{
85 85
 			$this->collectForeignObjects($results);
86
-			while($obj = array_pop($stack))
86
+			while($obj=array_pop($stack))
87 87
 				$obj->collectForeignObjects($results);
88 88
 		}
89 89
 		else if($results instanceof TActiveRecordRelation)
90
-			$stack[] = $this; //call it later
91
-		else if($results === null || !$validArray)
92
-			$stack = array();
90
+			$stack[]=$this; //call it later
91
+		else if($results===null || !$validArray)
92
+			$stack=array();
93 93
 		return $results;
94 94
 	}
95 95
 
@@ -113,28 +113,28 @@  discard block
 block discarded – undo
113 113
 	 */
114 114
 	protected function findForeignKeys($from, $matchesRecord, $loose=false)
115 115
 	{
116
-		$gateway = $matchesRecord->getRecordGateway();
117
-		$recordTableInfo = $gateway->getRecordTableInfo($matchesRecord);
118
-		$matchingTableName = strtolower($recordTableInfo->getTableName());
119
-		$matchingFullTableName = strtolower($recordTableInfo->getTableFullName());
116
+		$gateway=$matchesRecord->getRecordGateway();
117
+		$recordTableInfo=$gateway->getRecordTableInfo($matchesRecord);
118
+		$matchingTableName=strtolower($recordTableInfo->getTableName());
119
+		$matchingFullTableName=strtolower($recordTableInfo->getTableFullName());
120 120
 		$tableInfo=$from;
121 121
 		if($from instanceof TActiveRecord)
122
-			$tableInfo = $gateway->getRecordTableInfo($from);
122
+			$tableInfo=$gateway->getRecordTableInfo($from);
123 123
 		//find first non-empty FK
124 124
 		foreach($tableInfo->getForeignKeys() as $fkeys)
125 125
 		{
126
-			$fkTable = strtolower($fkeys['table']);
126
+			$fkTable=strtolower($fkeys['table']);
127 127
 			if($fkTable===$matchingTableName || $fkTable===$matchingFullTableName)
128 128
 			{
129
-				$hasFkField = !$loose && $this->getContext()->hasFkField();
130
-				$key = $hasFkField ? $this->getFkFields($fkeys['keys']) : $fkeys['keys'];
129
+				$hasFkField=!$loose && $this->getContext()->hasFkField();
130
+				$key=$hasFkField ? $this->getFkFields($fkeys['keys']) : $fkeys['keys'];
131 131
 				if(!empty($key))
132 132
 					return $key;
133 133
 			}
134 134
 		}
135 135
 
136 136
 		//none found
137
-		$matching = $gateway->getRecordTableInfo($matchesRecord)->getTableFullName();
137
+		$matching=$gateway->getRecordTableInfo($matchesRecord)->getTableFullName();
138 138
 		throw new TActiveRecordException('ar_relations_missing_fk',
139 139
 			$tableInfo->getTableFullName(), $matching);
140 140
 	}
@@ -152,13 +152,13 @@  discard block
 block discarded – undo
152 152
 	 */
153 153
 	private function getFkFields($fkeys)
154 154
 	{
155
-		$matching = array();
155
+		$matching=array();
156 156
 		preg_match_all('/\s*(\S+\.)?([\w-]+)\s*/', $this->getContext()->getFkField(), $matching);
157
-		$fields = array();
157
+		$fields=array();
158 158
 		foreach($fkeys as $fkName => $field)
159 159
 		{
160 160
 			if(in_array($fkName, $matching[2]))
161
-				$fields[$fkName] = $field;
161
+				$fields[$fkName]=$field;
162 162
 		}
163 163
 		return $fields;
164 164
 	}
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 	{
173 173
 		$ids=array();
174 174
 		foreach($properties as $property)
175
-			$ids[] = is_object($obj) ? (string)$obj->getColumnValue($property) : (string)$obj[$property];
175
+			$ids[]=is_object($obj) ? (string) $obj->getColumnValue($property) : (string) $obj[$property];
176 176
 		return serialize($ids);
177 177
 	}
178 178
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 	 */
185 185
 	protected function findForeignObjects($fields, $indexValues)
186 186
 	{
187
-		$finder = $this->getContext()->getForeignRecordFinder();
187
+		$finder=$this->getContext()->getForeignRecordFinder();
188 188
 		return $finder->findAllByIndex($this->_criteria, $fields, $indexValues);
189 189
 	}
190 190
 
@@ -197,14 +197,14 @@  discard block
 block discarded – undo
197 197
 	protected function getIndexValues($keys, $results)
198 198
 	{
199 199
 		if(!is_array($results) && !$results instanceof \ArrayAccess)
200
-			$results = array($results);
200
+			$results=array($results);
201 201
 		$values=array();
202 202
 		foreach($results as $result)
203 203
 		{
204
-			$value = array();
204
+			$value=array();
205 205
 			foreach($keys as $name)
206
-				$value[] = $result->getColumnValue($name);
207
-			$values[] = $value;
206
+				$value[]=$result->getColumnValue($name);
207
+			$values[]=$value;
208 208
 		}
209 209
 		return $values;
210 210
 	}
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 	 * @param array foreign objects
217 217
 	 * @param array foreign object field names.
218 218
 	 */
219
-	protected function populateResult(&$results,$properties,&$fkObjects,$fields)
219
+	protected function populateResult(&$results, $properties, &$fkObjects, $fields)
220 220
 	{
221 221
 		$collections=array();
222 222
 		foreach($fkObjects as $fkObject)
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 	{
235 235
 		if(is_array($results) || $results instanceof \ArrayAccess)
236 236
 		{
237
-			for($i=0,$k=count($results);$i<$k;$i++)
237
+			for($i=0, $k=count($results); $i < $k; $i++)
238 238
 				$this->setObjectProperty($results[$i], $properties, $collections);
239 239
 		}
240 240
 		else
@@ -249,8 +249,8 @@  discard block
 block discarded – undo
249 249
 	 */
250 250
 	protected function setObjectProperty($source, $properties, &$collections)
251 251
 	{
252
-		$hash = $this->getObjectHash($source, $properties);
253
-		$prop = $this->getContext()->getProperty();
252
+		$hash=$this->getObjectHash($source, $properties);
253
+		$prop=$this->getContext()->getProperty();
254 254
 		$source->$prop=isset($collections[$hash]) ? $collections[$hash] : array();
255 255
 	}
256 256
 }
Please login to merge, or discard this patch.
Braces   +5 added lines, -6 removed lines patch added patch discarded remove patch
@@ -83,10 +83,10 @@  discard block
 block discarded – undo
83 83
 		if($validArray || $results instanceof \ArrayAccess || $results instanceof TActiveRecord)
84 84
 		{
85 85
 			$this->collectForeignObjects($results);
86
-			while($obj = array_pop($stack))
87
-				$obj->collectForeignObjects($results);
88
-		}
89
-		else if($results instanceof TActiveRecordRelation)
86
+			while($obj = array_pop($stack)) {
87
+							$obj->collectForeignObjects($results);
88
+			}
89
+		} else if($results instanceof TActiveRecordRelation)
90 90
 			$stack[] = $this; //call it later
91 91
 		else if($results === null || !$validArray)
92 92
 			$stack = array();
@@ -236,8 +236,7 @@  discard block
 block discarded – undo
236 236
 		{
237 237
 			for($i=0,$k=count($results);$i<$k;$i++)
238 238
 				$this->setObjectProperty($results[$i], $properties, $collections);
239
-		}
240
-		else
239
+		} else
241 240
 			$this->setObjectProperty($results, $properties, $collections);
242 241
 	}
243 242
 
Please login to merge, or discard this patch.
framework/Data/ActiveRecord/Scaffold/InputBuilder/TScaffoldInputCommon.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -47,6 +47,9 @@
 block discarded – undo
47 47
 		return $control;
48 48
 	}
49 49
 
50
+	/**
51
+	 * @return string
52
+	 */
50 53
 	protected function getDefaultControlValue($container,$column, $record)
51 54
 	{
52 55
 		$control = $container->findControl(self::DEFAULT_ID);
Please login to merge, or discard this patch.
Spacing   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 	{
16 16
 		$control->setID(self::DEFAULT_ID);
17 17
 		$control->setEnabled($this->getIsEnabled($column, $record));
18
-		$container->Controls[] = $control;
18
+		$container->Controls[]=$control;
19 19
 	}
20 20
 
21 21
 	protected function setNotNullProperty($container, $control, $column, $record)
@@ -27,8 +27,8 @@  discard block
 block discarded – undo
27 27
 
28 28
 	protected function createBooleanControl($container, $column, $record)
29 29
 	{
30
-		$value = $this->getRecordPropertyValue($column, $record);
31
-		$control = new TCheckBox();
30
+		$value=$this->getRecordPropertyValue($column, $record);
31
+		$control=new TCheckBox();
32 32
 		$control->setChecked(TPropertyValue::ensureBoolean($value));
33 33
 		$control->setCssClass('boolean-checkbox');
34 34
 		$this->setDefaultProperty($container, $control, $column, $record);
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
 
38 38
 	protected function createDefaultControl($container, $column, $record)
39 39
 	{
40
-		$value = $this->getRecordPropertyValue($column, $record);
41
-		$control = new TTextBox();
40
+		$value=$this->getRecordPropertyValue($column, $record);
41
+		$control=new TTextBox();
42 42
 		$control->setText($value);
43 43
 		$control->setCssClass('default-textbox scaffold_input');
44 44
 		if(($len=$column->getColumnSize())!==null)
@@ -47,9 +47,9 @@  discard block
 block discarded – undo
47 47
 		return $control;
48 48
 	}
49 49
 
50
-	protected function getDefaultControlValue($container,$column, $record)
50
+	protected function getDefaultControlValue($container, $column, $record)
51 51
 	{
52
-		$control = $container->findControl(self::DEFAULT_ID);
52
+		$control=$container->findControl(self::DEFAULT_ID);
53 53
 		if($control instanceof TCheckBox)
54 54
 			return $control->getChecked();
55 55
 		else if($control instanceof TControl)
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
 
59 59
 	protected function createMultiLineControl($container, $column, $record)
60 60
 	{
61
-		$value = $this->getRecordPropertyValue($column, $record);
62
-		$control = new TTextBox();
61
+		$value=$this->getRecordPropertyValue($column, $record);
62
+		$control=new TTextBox();
63 63
 		$control->setText($value);
64 64
 		$control->setTextMode(TTextBoxMode::MultiLine);
65 65
 		$control->setCssClass('multiline-textbox scaffold_input');
@@ -69,13 +69,13 @@  discard block
 block discarded – undo
69 69
 
70 70
 	protected function createYearControl($container, $column, $record)
71 71
 	{
72
-		$value = $this->getRecordPropertyValue($column, $record);
73
-		$control = new TDropDownList();
74
-		$years = array();
75
-		$current = intval(@date('Y'));
76
-		$from = $current-10; $to=$current+10;
77
-		for($i = $from; $i <= $to; $i++)
78
-			$years[$i] = $i;
72
+		$value=$this->getRecordPropertyValue($column, $record);
73
+		$control=new TDropDownList();
74
+		$years=array();
75
+		$current=intval(@date('Y'));
76
+		$from=$current - 10; $to=$current + 10;
77
+		for($i=$from; $i <= $to; $i++)
78
+			$years[$i]=$i;
79 79
 		$control->setDataSource($years);
80 80
 		$control->setSelectedValue(empty($value) ? $current : $value);
81 81
 		$control->setCssClass('year-dropdown');
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
 
86 86
 	protected function createIntegerControl($container, $column, $record)
87 87
 	{
88
-		$control = $this->createDefaultControl($container, $column, $record);
89
-		$val = $this->createTypeValidator($container, $column, $record);
88
+		$control=$this->createDefaultControl($container, $column, $record);
89
+		$val=$this->createTypeValidator($container, $column, $record);
90 90
 		$val->setDataType(TValidationDataType::Integer);
91 91
 		$val->setErrorMessage('Please entery an integer.');
92 92
 		return $control;
@@ -94,13 +94,13 @@  discard block
 block discarded – undo
94 94
 
95 95
 	protected function createFloatControl($container, $column, $record)
96 96
 	{
97
-		$control = $this->createDefaultControl($container, $column, $record);
98
-		$val = $this->createTypeValidator($container, $column, $record);
97
+		$control=$this->createDefaultControl($container, $column, $record);
98
+		$val=$this->createTypeValidator($container, $column, $record);
99 99
 		$val->setDataType(TValidationDataType::Float);
100 100
 		$val->setErrorMessage('Please entery a decimal number.');
101
-		if(($max= $column->getMaxiumNumericConstraint())!==null)
101
+		if(($max=$column->getMaxiumNumericConstraint())!==null)
102 102
 		{
103
-			$val = $this->createRangeValidator($container,$column,$record);
103
+			$val=$this->createRangeValidator($container, $column, $record);
104 104
 			$val->setDataType(TValidationDataType::Float);
105 105
 			$val->setMaxValue($max);
106 106
 			$val->setStrictComparison(true);
@@ -111,99 +111,99 @@  discard block
 block discarded – undo
111 111
 
112 112
 	protected function createRequiredValidator($container, $column, $record)
113 113
 	{
114
-		$val = new TRequiredFieldValidator();
114
+		$val=new TRequiredFieldValidator();
115 115
 		$val->setErrorMessage('*');
116 116
 		$val->setControlCssClass('required-input');
117 117
 		$val->setCssClass('required');
118 118
 		$val->setControlToValidate(self::DEFAULT_ID);
119 119
 		$val->setValidationGroup($this->getParent()->getValidationGroup());
120 120
 		$val->setDisplay(TValidatorDisplayStyle::Dynamic);
121
-		$container->Controls[] = $val;
121
+		$container->Controls[]=$val;
122 122
 		return $val;
123 123
 	}
124 124
 
125 125
 	protected function createTypeValidator($container, $column, $record)
126 126
 	{
127
-		$val = new TDataTypeValidator();
127
+		$val=new TDataTypeValidator();
128 128
 		$val->setControlCssClass('required-input2');
129 129
 		$val->setCssClass('required');
130 130
 		$val->setControlToValidate(self::DEFAULT_ID);
131 131
 		$val->setValidationGroup($this->getParent()->getValidationGroup());
132 132
 		$val->setDisplay(TValidatorDisplayStyle::Dynamic);
133
-		$container->Controls[] = $val;
133
+		$container->Controls[]=$val;
134 134
 		return $val;
135 135
 	}
136 136
 
137 137
 	protected function createRangeValidator($container, $column, $record)
138 138
 	{
139
-		$val = new TRangeValidator();
139
+		$val=new TRangeValidator();
140 140
 		$val->setControlCssClass('required-input3');
141 141
 		$val->setCssClass('required');
142 142
 		$val->setControlToValidate(self::DEFAULT_ID);
143 143
 		$val->setValidationGroup($this->getParent()->getValidationGroup());
144 144
 		$val->setDisplay(TValidatorDisplayStyle::Dynamic);
145
-		$container->Controls[] = $val;
145
+		$container->Controls[]=$val;
146 146
 		return $val;
147 147
 	}
148 148
 
149 149
 	protected function createTimeControl($container, $column, $record)
150 150
 	{
151
-		$value = $this->getRecordPropertyValue($column, $record);
151
+		$value=$this->getRecordPropertyValue($column, $record);
152 152
 		$hours=array();
153
-		for($i=0;$i<24;$i++) $hours[] = str_pad($i,2,'0',STR_PAD_LEFT);
153
+		for($i=0; $i < 24; $i++) $hours[]=str_pad($i, 2, '0', STR_PAD_LEFT);
154 154
 		$mins=array();
155
-		for($i=0;$i<60;$i++) $mins[] = str_pad($i,2,'0',STR_PAD_LEFT);
156
-		$hour = intval(@date('H'));
157
-		$min = intval(@date('i'));
158
-		$sec = intval(@date('s'));
155
+		for($i=0; $i < 60; $i++) $mins[]=str_pad($i, 2, '0', STR_PAD_LEFT);
156
+		$hour=intval(@date('H'));
157
+		$min=intval(@date('i'));
158
+		$sec=intval(@date('s'));
159 159
 		if(!empty($value))
160 160
 		{
161 161
 			$match=array();
162 162
 			if(preg_match('/(\d+):(\d+):?(\d+)?/', $value, $match))
163 163
 			{
164
-				$hour = $match[1];
165
-				$min = $match[2];
164
+				$hour=$match[1];
165
+				$min=$match[2];
166 166
 				if(isset($match[3]))
167 167
 					$sec=$match[3];
168 168
 			}
169 169
 		}
170 170
 
171
-		$hcontrol = new TDropDownList();
171
+		$hcontrol=new TDropDownList();
172 172
 		$hcontrol->setDataSource($hours);
173 173
 		$hcontrol->setID(self::DEFAULT_ID);
174 174
 		$hcontrol->dataBind();
175 175
 		$hcontrol->setSelectedValue(intval($hour));
176
-		$container->Controls[] = $hcontrol;
177
-		$container->Controls[] = ' : ';
176
+		$container->Controls[]=$hcontrol;
177
+		$container->Controls[]=' : ';
178 178
 
179
-		$mcontrol = new TDropDownList();
179
+		$mcontrol=new TDropDownList();
180 180
 		$mcontrol->setDataSource($mins);
181 181
 		$mcontrol->dataBind();
182 182
 		$mcontrol->setID('scaffold_time_min');
183 183
 		$mcontrol->setSelectedValue(intval($min));
184
-		$container->Controls[] = $mcontrol;
185
-		$container->Controls[] = ' : ';
184
+		$container->Controls[]=$mcontrol;
185
+		$container->Controls[]=' : ';
186 186
 
187
-		$scontrol = new TDropDownList();
187
+		$scontrol=new TDropDownList();
188 188
 		$scontrol->setDataSource($mins);
189 189
 		$scontrol->dataBind();
190 190
 		$scontrol->setID('scaffold_time_sec');
191 191
 		$scontrol->setSelectedValue(intval($sec));
192
-		$container->Controls[] = $scontrol;
192
+		$container->Controls[]=$scontrol;
193 193
 
194
-		return array($hcontrol,$mcontrol,$scontrol);
194
+		return array($hcontrol, $mcontrol, $scontrol);
195 195
 	}
196 196
 
197 197
 
198 198
 	protected function createDateControl($container, $column, $record)
199 199
 	{
200
-		$value = $this->getRecordPropertyValue($column, $record);
201
-		$control = new TDatePicker();
200
+		$value=$this->getRecordPropertyValue($column, $record);
201
+		$control=new TDatePicker();
202 202
 		$control->setFromYear(1900);
203 203
 		$control->setInputMode(TDatePickerInputMode::DropDownList);
204 204
 		$control->setDateFormat('yyyy-MM-dd');
205 205
 		if(!empty($value))
206
-			$control->setDate(substr($value,0,10));
206
+			$control->setDate(substr($value, 0, 10));
207 207
 		$control->setCssClass('date-dropdown');
208 208
 		$this->setNotNullProperty($container, $control, $column, $record);
209 209
 		return $control;
@@ -211,10 +211,10 @@  discard block
 block discarded – undo
211 211
 
212 212
 	protected function createDateTimeControl($container, $column, $record)
213 213
 	{
214
-		$value = $this->getRecordPropertyValue($column, $record);
215
-		$control = $this->createDateControl($container, $column, $record);
216
-		$container->Controls[] = ' @ ';
217
-		$time = $this->createTimeControl($container, $column, $record);
214
+		$value=$this->getRecordPropertyValue($column, $record);
215
+		$control=$this->createDateControl($container, $column, $record);
216
+		$container->Controls[]=' @ ';
217
+		$time=$this->createTimeControl($container, $column, $record);
218 218
 		if(!empty($value))
219 219
 		{
220 220
 			$match=array();
@@ -232,30 +232,30 @@  discard block
 block discarded – undo
232 232
 
233 233
 	protected function getDateTimeValue($container, $column, $record)
234 234
 	{
235
-		$date = $container->findControl(self::DEFAULT_ID)->getDate();
236
-		$hour = $container->findControl('scaffold_time_hour')->getSelectedValue();
237
-		$mins = $container->findControl('scaffold_time_min')->getSelectedValue();
238
-		$secs = $container->findControl('scaffold_time_sec')->getSelectedValue();
235
+		$date=$container->findControl(self::DEFAULT_ID)->getDate();
236
+		$hour=$container->findControl('scaffold_time_hour')->getSelectedValue();
237
+		$mins=$container->findControl('scaffold_time_min')->getSelectedValue();
238
+		$secs=$container->findControl('scaffold_time_sec')->getSelectedValue();
239 239
 		return "{$date} {$hour}:{$mins}:{$secs}";
240 240
 	}
241 241
 
242 242
 	protected function getTimeValue($container, $column, $record)
243 243
 	{
244
-		$hour = $container->findControl(self::DEFAULT_ID)->getSelectedValue();
245
-		$mins = $container->findControl('scaffold_time_min')->getSelectedValue();
246
-		$secs = $container->findControl('scaffold_time_sec')->getSelectedValue();
244
+		$hour=$container->findControl(self::DEFAULT_ID)->getSelectedValue();
245
+		$mins=$container->findControl('scaffold_time_min')->getSelectedValue();
246
+		$secs=$container->findControl('scaffold_time_sec')->getSelectedValue();
247 247
 		return "{$hour}:{$mins}:{$secs}";
248 248
 	}
249 249
 
250 250
 	protected function createSetControl($container, $column, $record)
251 251
 	{
252
-		$value = $this->getRecordPropertyValue($column, $record);
253
-		$selectedValues = preg_split('/\s*,\s*/', $value);
254
-		$control = new TCheckBoxList();
255
-		$values = $column->getDbTypeValues();
252
+		$value=$this->getRecordPropertyValue($column, $record);
253
+		$selectedValues=preg_split('/\s*,\s*/', $value);
254
+		$control=new TCheckBoxList();
255
+		$values=$column->getDbTypeValues();
256 256
 		$control->setDataSource($values);
257 257
 		$control->dataBind();
258
-		$control->setSelectedIndices($this->getMatchingIndices($values,$selectedValues));
258
+		$control->setSelectedIndices($this->getMatchingIndices($values, $selectedValues));
259 259
 		$control->setID(self::DEFAULT_ID);
260 260
 		$control->setCssClass('set-checkboxes');
261 261
 		$this->setNotNullProperty($container, $control, $column, $record);
@@ -265,23 +265,23 @@  discard block
 block discarded – undo
265 265
 	protected function getMatchingIndices($checks, $values)
266 266
 	{
267 267
 		$index=array();
268
-		for($i=0, $k=count($checks); $i<$k; $i++)
268
+		for($i=0, $k=count($checks); $i < $k; $i++)
269 269
 		{
270 270
 			if(in_array($checks[$i], $values))
271
-				$index[] = $i;
271
+				$index[]=$i;
272 272
 		}
273 273
 		return $index;
274 274
 	}
275 275
 
276 276
 	protected function createEnumControl($container, $column, $record)
277 277
 	{
278
-		$value = $this->getRecordPropertyValue($column, $record);
279
-		$selectedValues = preg_split('/\s*,\s*/', $value);
280
-		$control = new TRadioButtonList();
281
-		$values = $column->getDbTypeValues();
278
+		$value=$this->getRecordPropertyValue($column, $record);
279
+		$selectedValues=preg_split('/\s*,\s*/', $value);
280
+		$control=new TRadioButtonList();
281
+		$values=$column->getDbTypeValues();
282 282
 		$control->setDataSource($values);
283 283
 		$control->dataBind();
284
-		$index = $this->getMatchingIndices($values,$selectedValues);
284
+		$index=$this->getMatchingIndices($values, $selectedValues);
285 285
 		if(count($index) > 0)
286 286
 			$control->setSelectedIndex($index[0]);
287 287
 		$control->setID(self::DEFAULT_ID);
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 		foreach($container->findControl(self::DEFAULT_ID)->getItems() as $item)
297 297
 		{
298 298
 			if($item->getSelected())
299
-				$value[] = $item->getText();
299
+				$value[]=$item->getText();
300 300
 		}
301 301
 		return implode(',', $value);
302 302
 	}
Please login to merge, or discard this patch.
framework/Data/Common/Mssql/TMssqlMetaData.php 3 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -123,6 +123,7 @@
 block discarded – undo
123 123
 	/**
124 124
 	 * @param TMssqlTableInfo table information.
125 125
 	 * @param array column information.
126
+	 * @param TMssqlTableInfo $tableInfo
126 127
 	 */
127 128
 	protected function processColumn($tableInfo, $col)
128 129
 	{
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -259,15 +259,15 @@
 block discarded – undo
259 259
 		return false;
260 260
 	}
261 261
 
262
-        /**
263
-	 * Returns all table names in the database.
264
-	 * @param string $schema the schema of the tables. Defaults to empty string, meaning the current or default schema.
265
-	 * If not empty, the returned table names will be prefixed with the schema name.
266
-	 * @return array all table names in the database.
267
-	 */
262
+		/**
263
+		 * Returns all table names in the database.
264
+		 * @param string $schema the schema of the tables. Defaults to empty string, meaning the current or default schema.
265
+		 * If not empty, the returned table names will be prefixed with the schema name.
266
+		 * @return array all table names in the database.
267
+		 */
268 268
 	public function findTableNames($schema='dbo')
269 269
 	{
270
-                $condition="TABLE_TYPE='BASE TABLE'";
270
+				$condition="TABLE_TYPE='BASE TABLE'";
271 271
 		$sql=<<<EOD
272 272
 SELECT TABLE_NAME, TABLE_SCHEMA FROM [INFORMATION_SCHEMA].[TABLES]
273 273
 WHERE TABLE_SCHEMA=:schema AND $condition
Please login to merge, or discard this patch.
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -69,9 +69,9 @@  discard block
 block discarded – undo
69 69
 	 */
70 70
 	protected function createTableInfo($table)
71 71
 	{
72
-		list($catalogName,$schemaName,$tableName) = $this->getCatalogSchemaTableName($table);
72
+		list($catalogName, $schemaName, $tableName)=$this->getCatalogSchemaTableName($table);
73 73
 		$this->getDbConnection()->setActive(true);
74
-		$sql = <<<EOD
74
+		$sql=<<<EOD
75 75
 				SELECT t.*,
76 76
 												c.*,
77 77
 					columnproperty(object_id(c.table_schema + '.' + c.table_name), c.column_name,'IsIdentity') as IsIdentity
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
 										AND t.table_name = :table
82 82
 EOD;
83 83
 		if($schemaName!==null)
84
-			$sql .= ' AND t.table_schema = :schema';
84
+			$sql.=' AND t.table_schema = :schema';
85 85
 		if($catalogName!==null)
86
-			$sql .= ' AND t.table_catalog = :catalog';
86
+			$sql.=' AND t.table_catalog = :catalog';
87 87
 
88
-		$command = $this->getDbConnection()->createCommand($sql);
88
+		$command=$this->getDbConnection()->createCommand($sql);
89 89
 		$command->bindValue(':table', $tableName);
90 90
 		if($schemaName!==null)
91 91
 			$command->bindValue(':schema', $schemaName);
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
 		foreach($command->query() as $col)
97 97
 		{
98 98
 			if($tableInfo===null)
99
-				$tableInfo = $this->createNewTableInfo($col);
100
-			$this->processColumn($tableInfo,$col);
99
+				$tableInfo=$this->createNewTableInfo($col);
100
+			$this->processColumn($tableInfo, $col);
101 101
 		}
102 102
 		if($tableInfo===null)
103 103
 			throw new TDbException('dbmetadata_invalid_table_view', $table);
@@ -111,13 +111,13 @@  discard block
 block discarded – undo
111 111
 	protected function getCatalogSchemaTableName($table)
112 112
 	{
113 113
 		//remove possible delimiters
114
-		$result = explode('.', preg_replace('/\[|\]|"/', '', $table));
114
+		$result=explode('.', preg_replace('/\[|\]|"/', '', $table));
115 115
 		if(count($result)===1)
116
-			return array(null,null,$result[0]);
116
+			return array(null, null, $result[0]);
117 117
 		if(count($result)===2)
118
-			return array(null,$result[0],$result[1]);
119
-		if(count($result)>2)
120
-			return array($result[0],$result[1],$result[2]);
118
+			return array(null, $result[0], $result[1]);
119
+		if(count($result) > 2)
120
+			return array($result[0], $result[1], $result[2]);
121 121
 	}
122 122
 
123 123
 	/**
@@ -126,31 +126,31 @@  discard block
 block discarded – undo
126 126
 	 */
127 127
 	protected function processColumn($tableInfo, $col)
128 128
 	{
129
-		$columnId = $col['COLUMN_NAME'];
129
+		$columnId=$col['COLUMN_NAME'];
130 130
 
131
-		$info['ColumnName'] = "[$columnId]"; //quote the column names!
132
-		$info['ColumnId'] = $columnId;
133
-		$info['ColumnIndex'] = intval($col['ORDINAL_POSITION'])-1; //zero-based index
131
+		$info['ColumnName']="[$columnId]"; //quote the column names!
132
+		$info['ColumnId']=$columnId;
133
+		$info['ColumnIndex']=intval($col['ORDINAL_POSITION']) - 1; //zero-based index
134 134
 		if($col['IS_NULLABLE']!=='NO')
135
-			$info['AllowNull'] = true;
135
+			$info['AllowNull']=true;
136 136
 		if($col['COLUMN_DEFAULT']!==null)
137
-			$info['DefaultValue'] = $col['COLUMN_DEFAULT'];
137
+			$info['DefaultValue']=$col['COLUMN_DEFAULT'];
138 138
 
139 139
 		if(in_array($columnId, $tableInfo->getPrimaryKeys()))
140
-			$info['IsPrimaryKey'] = true;
140
+			$info['IsPrimaryKey']=true;
141 141
 		if($this->isForeignKeyColumn($columnId, $tableInfo))
142
-			$info['IsForeignKey'] = true;
142
+			$info['IsForeignKey']=true;
143 143
 
144 144
 		if($col['IsIdentity']==='1')
145
-			$info['AutoIncrement'] = true;
146
-		$info['DbType'] = $col['DATA_TYPE'];
145
+			$info['AutoIncrement']=true;
146
+		$info['DbType']=$col['DATA_TYPE'];
147 147
 		if($col['CHARACTER_MAXIMUM_LENGTH']!==null)
148
-			$info['ColumnSize'] = intval($col['CHARACTER_MAXIMUM_LENGTH']);
149
-		if($col['NUMERIC_PRECISION'] !== null)
150
-			$info['NumericPrecision'] = intval($col['NUMERIC_PRECISION']);
148
+			$info['ColumnSize']=intval($col['CHARACTER_MAXIMUM_LENGTH']);
149
+		if($col['NUMERIC_PRECISION']!==null)
150
+			$info['NumericPrecision']=intval($col['NUMERIC_PRECISION']);
151 151
 		if($col['NUMERIC_SCALE']!==null)
152
-			$info['NumericScale'] = intval($col['NUMERIC_SCALE']);
153
-		$tableInfo->Columns[$columnId] = new TMssqlTableColumn($info);
152
+			$info['NumericScale']=intval($col['NUMERIC_SCALE']);
153
+		$tableInfo->Columns[$columnId]=new TMssqlTableColumn($info);
154 154
 	}
155 155
 
156 156
 	/**
@@ -160,14 +160,14 @@  discard block
 block discarded – undo
160 160
 	 */
161 161
 	protected function createNewTableInfo($col)
162 162
 	{
163
-		$info['CatalogName'] = $col['TABLE_CATALOG'];
164
-		$info['SchemaName'] = $col['TABLE_SCHEMA'];
165
-		$info['TableName'] = $col['TABLE_NAME'];
163
+		$info['CatalogName']=$col['TABLE_CATALOG'];
164
+		$info['SchemaName']=$col['TABLE_SCHEMA'];
165
+		$info['TableName']=$col['TABLE_NAME'];
166 166
 		if($col['TABLE_TYPE']==='VIEW')
167
-			$info['IsView'] = true;
168
-		list($primary, $foreign) = $this->getConstraintKeys($col);
169
-		$class = $this->getTableInfoClass();
170
-		return new $class($info,$primary,$foreign);
167
+			$info['IsView']=true;
168
+		list($primary, $foreign)=$this->getConstraintKeys($col);
169
+		$class=$this->getTableInfoClass();
170
+		return new $class($info, $primary, $foreign);
171 171
 	}
172 172
 
173 173
 	/**
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 	 */
179 179
 	protected function getConstraintKeys($col)
180 180
 	{
181
-		$sql = <<<EOD
181
+		$sql=<<<EOD
182 182
 		SELECT k.column_name field_name
183 183
 				FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE k
184 184
 				LEFT JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS c
@@ -189,13 +189,13 @@  discard block
 block discarded – undo
189 189
 			c.constraint_type ='PRIMARY KEY'
190 190
 				AND k.table_name = :table
191 191
 EOD;
192
-		$command = $this->getDbConnection()->createCommand($sql);
192
+		$command=$this->getDbConnection()->createCommand($sql);
193 193
 		$command->bindValue(':table', $col['TABLE_NAME']);
194
-		$primary = array();
194
+		$primary=array();
195 195
 		foreach($command->query()->readAll() as $field)
196
-			$primary[] = $field['field_name'];
197
-		$foreign = $this->getForeignConstraints($col);
198
-		return array($primary,$foreign);
196
+			$primary[]=$field['field_name'];
197
+		$foreign=$this->getForeignConstraints($col);
198
+		return array($primary, $foreign);
199 199
 	}
200 200
 
201 201
 	/**
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 	protected function getForeignConstraints($col)
208 208
 	{
209 209
 		//From http://msdn2.microsoft.com/en-us/library/aa175805(SQL.80).aspx
210
-		$sql = <<<EOD
210
+		$sql=<<<EOD
211 211
 		SELECT
212 212
 				KCU1.CONSTRAINT_NAME AS 'FK_CONSTRAINT_NAME'
213 213
 			, KCU1.TABLE_NAME AS 'FK_TABLE_NAME'
@@ -232,14 +232,14 @@  discard block
 block discarded – undo
232 232
 			AND KCU2.ORDINAL_POSITION = KCU1.ORDINAL_POSITION
233 233
 		WHERE KCU1.TABLE_NAME = :table
234 234
 EOD;
235
-		$command = $this->getDbConnection()->createCommand($sql);
235
+		$command=$this->getDbConnection()->createCommand($sql);
236 236
 		$command->bindValue(':table', $col['TABLE_NAME']);
237 237
 		$fkeys=array();
238
-		$catalogSchema = "[{$col['TABLE_CATALOG']}].[{$col['TABLE_SCHEMA']}]";
238
+		$catalogSchema="[{$col['TABLE_CATALOG']}].[{$col['TABLE_SCHEMA']}]";
239 239
 		foreach($command->query() as $info)
240 240
 		{
241
-			$fkeys[$info['FK_CONSTRAINT_NAME']]['keys'][$info['FK_COLUMN_NAME']] = $info['UQ_COLUMN_NAME'];
242
-			$fkeys[$info['FK_CONSTRAINT_NAME']]['table'] = $info['UQ_TABLE_NAME'];
241
+			$fkeys[$info['FK_CONSTRAINT_NAME']]['keys'][$info['FK_COLUMN_NAME']]=$info['UQ_COLUMN_NAME'];
242
+			$fkeys[$info['FK_CONSTRAINT_NAME']]['table']=$info['UQ_TABLE_NAME'];
243 243
 		}
244 244
 		return count($fkeys) > 0 ? array_values($fkeys) : $fkeys;
245 245
 	}
@@ -276,9 +276,9 @@  discard block
 block discarded – undo
276 276
 		$command->bindParam(":schema", $schema);
277 277
 		$rows=$command->queryAll();
278 278
 		$names=array();
279
-		foreach ($rows as $row)
279
+		foreach($rows as $row)
280 280
 		{
281
-			if ($schema == self::DEFAULT_SCHEMA)
281
+			if($schema==self::DEFAULT_SCHEMA)
282 282
 				$names[]=$row['TABLE_NAME'];
283 283
 			else
284 284
 				$names[]=$schema.'.'.$row['TABLE_SCHEMA'].'.'.$row['TABLE_NAME'];
Please login to merge, or discard this patch.
framework/Data/Common/Mssql/TMssqlTableColumn.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
 
28 28
 	/**
29 29
 	 * Overrides parent implementation, returns PHP type from the db type.
30
-	 * @return boolean derived PHP primitive type from the column db type.
30
+	 * @return string derived PHP primitive type from the column db type.
31 31
 	 */
32 32
 	public function getPHPType()
33 33
 	{
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  */
24 24
 class TMssqlTableColumn extends TDbTableColumn
25 25
 {
26
-	private static $types = array();
26
+	private static $types=array();
27 27
 
28 28
 	/**
29 29
 	 * Overrides parent implementation, returns PHP type from the db type.
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	 */
41 41
 	public function getAutoIncrement()
42 42
 	{
43
-		return $this->getInfo('AutoIncrement',false);
43
+		return $this->getInfo('AutoIncrement', false);
44 44
 	}
45 45
 
46 46
 	/**
Please login to merge, or discard this patch.
framework/Data/Common/Mysql/TMysqlMetaData.php 4 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -114,6 +114,7 @@
 block discarded – undo
114 114
 	/**
115 115
 	 * @param TMysqlTableInfo table information.
116 116
 	 * @param array column information.
117
+	 * @param TMysqlTableInfo $tableInfo
117 118
 	 */
118 119
 	protected function processColumn($tableInfo, $col)
119 120
 	{
Please login to merge, or discard this patch.
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -74,24 +74,24 @@  discard block
 block discarded – undo
74 74
 	 */
75 75
 	protected function createTableInfo($table)
76 76
 	{
77
-		list($schemaName,$tableName) = $this->getSchemaTableName($table);
78
-		$find = $schemaName===null ? "`{$tableName}`" : "`{$schemaName}`.`{$tableName}`";
79
-		$colCase = $this->getDbConnection()->getColumnCase();
80
-		if($colCase != TDbColumnCaseMode::Preserved)
77
+		list($schemaName, $tableName)=$this->getSchemaTableName($table);
78
+		$find=$schemaName===null ? "`{$tableName}`" : "`{$schemaName}`.`{$tableName}`";
79
+		$colCase=$this->getDbConnection()->getColumnCase();
80
+		if($colCase!=TDbColumnCaseMode::Preserved)
81 81
 			$this->getDbConnection()->setColumnCase('Preserved');
82 82
 		$this->getDbConnection()->setActive(true);
83
-		$sql = "SHOW FULL FIELDS FROM {$find}";
84
-		$command = $this->getDbConnection()->createCommand($sql);
85
-		$tableInfo = $this->createNewTableInfo($table);
83
+		$sql="SHOW FULL FIELDS FROM {$find}";
84
+		$command=$this->getDbConnection()->createCommand($sql);
85
+		$tableInfo=$this->createNewTableInfo($table);
86 86
 		$index=0;
87 87
 		foreach($command->query() as $col)
88 88
 		{
89
-			$col['index'] = $index++;
90
-			$this->processColumn($tableInfo,$col);
89
+			$col['index']=$index++;
90
+			$this->processColumn($tableInfo, $col);
91 91
 		}
92 92
 		if($index===0)
93 93
 			throw new TDbException('dbmetadata_invalid_table_view', $table);
94
-		if($colCase != TDbColumnCaseMode::Preserved)
94
+		if($colCase!=TDbColumnCaseMode::Preserved)
95 95
 			$this->getDbConnection()->setColumnCase($colCase);
96 96
 		return $tableInfo;
97 97
 	}
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	{
104 104
 		if(!$this->_serverVersion)
105 105
 		{
106
-			$version = $this->getDbConnection()->getAttribute(PDO::ATTR_SERVER_VERSION);
106
+			$version=$this->getDbConnection()->getAttribute(PDO::ATTR_SERVER_VERSION);
107 107
 			$digits=array();
108 108
 			preg_match('/(\d+)\.(\d+)\.(\d+)/', $version, $digits);
109 109
 			$this->_serverVersion=floatval($digits[1].'.'.$digits[2].$digits[3]);
@@ -117,50 +117,50 @@  discard block
 block discarded – undo
117 117
 	 */
118 118
 	protected function processColumn($tableInfo, $col)
119 119
 	{
120
-		$columnId = $col['Field'];
120
+		$columnId=$col['Field'];
121 121
 
122
-		$info['ColumnName'] = "`$columnId`"; //quote the column names!
123
-		$info['ColumnId'] = $columnId;
124
-		$info['ColumnIndex'] = $col['index'];
122
+		$info['ColumnName']="`$columnId`"; //quote the column names!
123
+		$info['ColumnId']=$columnId;
124
+		$info['ColumnIndex']=$col['index'];
125 125
 		if($col['Null']==='YES')
126
-			$info['AllowNull'] = true;
126
+			$info['AllowNull']=true;
127 127
 		if(is_int(strpos(strtolower($col['Extra']), 'auto_increment')))
128 128
 			$info['AutoIncrement']=true;
129 129
 		if($col['Default']!=="")
130
-			$info['DefaultValue'] = $col['Default'];
130
+			$info['DefaultValue']=$col['Default'];
131 131
 
132 132
 		if($col['Key']==='PRI' || in_array($columnId, $tableInfo->getPrimaryKeys()))
133
-			$info['IsPrimaryKey'] = true;
133
+			$info['IsPrimaryKey']=true;
134 134
 		if($this->isForeignKeyColumn($columnId, $tableInfo))
135
-			$info['IsForeignKey'] = true;
135
+			$info['IsForeignKey']=true;
136 136
 
137
-		$info['DbType'] = $col['Type'];
137
+		$info['DbType']=$col['Type'];
138 138
 		$match=array();
139 139
 		//find SET/ENUM values, column size, precision, and scale
140 140
 		if(preg_match('/\((.*)\)/', $col['Type'], $match))
141 141
 		{
142
-			$info['DbType']= preg_replace('/\(.*\)/', '', $col['Type']);
142
+			$info['DbType']=preg_replace('/\(.*\)/', '', $col['Type']);
143 143
 
144 144
 			//find SET/ENUM values
145 145
 			if($this->isEnumSetType($info['DbType']))
146
-				$info['DbTypeValues'] = preg_split("/[',]/S", $match[1], -1, PREG_SPLIT_NO_EMPTY);
146
+				$info['DbTypeValues']=preg_split("/[',]/S", $match[1], -1, PREG_SPLIT_NO_EMPTY);
147 147
 
148 148
 			//find column size, precision and scale
149
-			$pscale = array();
149
+			$pscale=array();
150 150
 			if(preg_match('/(\d+)(?:,(\d+))?+/', $match[1], $pscale))
151 151
 			{
152 152
 				if($this->isPrecisionType($info['DbType']))
153 153
 				{
154
-					$info['NumericPrecision'] = intval($pscale[1]);
154
+					$info['NumericPrecision']=intval($pscale[1]);
155 155
 					if(count($pscale) > 2)
156
-						$info['NumericScale'] = intval($pscale[2]);
156
+						$info['NumericScale']=intval($pscale[2]);
157 157
 				}
158 158
 				else
159
-					$info['ColumnSize'] = intval($pscale[1]);
159
+					$info['ColumnSize']=intval($pscale[1]);
160 160
 			}
161 161
 		}
162 162
 
163
-		$tableInfo->Columns[$columnId] = new TMysqlTableColumn($info);
163
+		$tableInfo->Columns[$columnId]=new TMysqlTableColumn($info);
164 164
 	}
165 165
 
166 166
 	/**
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 	 */
169 169
 	protected function isPrecisionType($type)
170 170
 	{
171
-		$type = strtolower(trim($type));
171
+		$type=strtolower(trim($type));
172 172
 		return $type==='decimal' || $type==='dec'
173 173
 				|| $type==='float' || $type==='double'
174 174
 				|| $type==='double precision' || $type==='real';
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 	 */
180 180
 	protected function isEnumSetType($type)
181 181
 	{
182
-		$type = strtolower(trim($type));
182
+		$type=strtolower(trim($type));
183 183
 		return $type==='set' || $type==='enum';
184 184
 	}
185 185
 
@@ -191,12 +191,12 @@  discard block
 block discarded – undo
191 191
 	protected function getSchemaTableName($table)
192 192
 	{
193 193
 		//remove the back ticks and separate out the "database.table"
194
-		$result = explode('.', str_replace('`', '', $table));
194
+		$result=explode('.', str_replace('`', '', $table));
195 195
 		foreach($result as $name)
196 196
 		{
197 197
 			if(!$this->isValidIdentifier($name))
198 198
 			{
199
-				$ref = 'http://dev.mysql.com/doc/refman/5.0/en/identifiers.html';
199
+				$ref='http://dev.mysql.com/doc/refman/5.0/en/identifiers.html';
200 200
 				throw new TDbException('dbcommon_invalid_identifier_name', $table, $ref);
201 201
 			}
202 202
 		}
@@ -220,14 +220,14 @@  discard block
 block discarded – undo
220 220
 	 */
221 221
 	protected function createNewTableInfo($table)
222 222
 	{
223
-		list($schemaName,$tableName) = $this->getSchemaTableName($table);
224
-		$info['SchemaName'] = $schemaName;
225
-		$info['TableName'] = $tableName;
226
-		if($this->getIsView($schemaName,$tableName))
227
-			$info['IsView'] = true;
228
-		list($primary, $foreign) = $this->getConstraintKeys($schemaName, $tableName);
229
-		$class = $this->getTableInfoClass();
230
-		return new $class($info,$primary,$foreign);
223
+		list($schemaName, $tableName)=$this->getSchemaTableName($table);
224
+		$info['SchemaName']=$schemaName;
225
+		$info['TableName']=$tableName;
226
+		if($this->getIsView($schemaName, $tableName))
227
+			$info['IsView']=true;
228
+		list($primary, $foreign)=$this->getConstraintKeys($schemaName, $tableName);
229
+		$class=$this->getTableInfoClass();
230
+		return new $class($info, $primary, $foreign);
231 231
 	}
232 232
 
233 233
 	/**
@@ -240,25 +240,25 @@  discard block
 block discarded – undo
240 240
 	 * @return boolean true if is view, false otherwise.
241 241
 	 * @throws TDbException if table or view does not exist.
242 242
 	 */
243
-	protected function getIsView($schemaName,$tableName)
243
+	protected function getIsView($schemaName, $tableName)
244 244
 	{
245
-		if($this->getServerVersion()<5.01)
245
+		if($this->getServerVersion() < 5.01)
246 246
 			return false;
247 247
 		if($schemaName!==null)
248
-			$sql = "SHOW FULL TABLES FROM `{$schemaName}` LIKE :table";
248
+			$sql="SHOW FULL TABLES FROM `{$schemaName}` LIKE :table";
249 249
 		else
250
-			$sql = "SHOW FULL TABLES LIKE :table";
250
+			$sql="SHOW FULL TABLES LIKE :table";
251 251
 
252
-		$command = $this->getDbConnection()->createCommand($sql);
252
+		$command=$this->getDbConnection()->createCommand($sql);
253 253
 		$command->bindValue(':table', $tableName);
254 254
 		try
255 255
 		{
256
-			return count($result = $command->queryRow()) > 0 && $result['Table_type']==='VIEW';
256
+			return count($result=$command->queryRow()) > 0 && $result['Table_type']==='VIEW';
257 257
 		}
258 258
 		catch(TDbException $e)
259 259
 		{
260
-			$table = $schemaName===null?$tableName:$schemaName.'.'.$tableName;
261
-			throw new TDbException('dbcommon_invalid_table_name',$table,$e->getMessage());
260
+			$table=$schemaName===null ? $tableName : $schemaName.'.'.$tableName;
261
+			throw new TDbException('dbcommon_invalid_table_name', $table, $e->getMessage());
262 262
 		}
263 263
 	}
264 264
 
@@ -270,22 +270,22 @@  discard block
 block discarded – undo
270 270
 	 */
271 271
 	protected function getConstraintKeys($schemaName, $tableName)
272 272
 	{
273
-		$table = $schemaName===null ? "`{$tableName}`" : "`{$schemaName}`.`{$tableName}`";
274
-		$sql = "SHOW INDEX FROM {$table}";
275
-		$command = $this->getDbConnection()->createCommand($sql);
276
-		$primary = array();
273
+		$table=$schemaName===null ? "`{$tableName}`" : "`{$schemaName}`.`{$tableName}`";
274
+		$sql="SHOW INDEX FROM {$table}";
275
+		$command=$this->getDbConnection()->createCommand($sql);
276
+		$primary=array();
277 277
 		foreach($command->query() as $row)
278 278
 		{
279 279
 			if($row['Key_name']==='PRIMARY')
280
-				$primary[] = $row['Column_name'];
280
+				$primary[]=$row['Column_name'];
281 281
 		}
282 282
 				// MySQL version was increased to >=5.1.21 instead of 5.x
283 283
 				// due to a MySQL bug (http://bugs.mysql.com/bug.php?id=19588)
284 284
 		if($this->getServerVersion() >= 5.121)
285
-			$foreign = $this->getForeignConstraints($schemaName,$tableName);
285
+			$foreign=$this->getForeignConstraints($schemaName, $tableName);
286 286
 		else
287
-			$foreign = $this->findForeignConstraints($schemaName,$tableName);
288
-		return array($primary,$foreign);
287
+			$foreign=$this->findForeignConstraints($schemaName, $tableName);
288
+		return array($primary, $foreign);
289 289
 	}
290 290
 
291 291
 	/**
@@ -296,8 +296,8 @@  discard block
 block discarded – undo
296 296
 	 */
297 297
 	protected function getForeignConstraints($schemaName, $tableName)
298 298
 	{
299
-		$andSchema = $schemaName !== null ? 'AND TABLE_SCHEMA LIKE :schema' : 'AND TABLE_SCHEMA LIKE DATABASE()';
300
-		$sql = <<<EOD
299
+		$andSchema=$schemaName!==null ? 'AND TABLE_SCHEMA LIKE :schema' : 'AND TABLE_SCHEMA LIKE DATABASE()';
300
+		$sql=<<<EOD
301 301
 			SELECT
302 302
 				CONSTRAINT_NAME as con,
303 303
 				COLUMN_NAME as col,
@@ -311,15 +311,15 @@  discard block
 block discarded – undo
311 311
 				AND TABLE_NAME LIKE :table
312 312
 				$andSchema
313 313
 EOD;
314
-		$command = $this->getDbConnection()->createCommand($sql);
314
+		$command=$this->getDbConnection()->createCommand($sql);
315 315
 		$command->bindValue(':table', $tableName);
316 316
 		if($schemaName!==null)
317 317
 			$command->bindValue(':schema', $schemaName);
318 318
 		$fkeys=array();
319 319
 		foreach($command->query() as $col)
320 320
 		{
321
-			$fkeys[$col['con']]['keys'][$col['col']] = $col['fkcol'];
322
-			$fkeys[$col['con']]['table'] = $col['fktable'];
321
+			$fkeys[$col['con']]['keys'][$col['col']]=$col['fkcol'];
322
+			$fkeys[$col['con']]['table']=$col['fktable'];
323 323
 		}
324 324
 		return count($fkeys) > 0 ? array_values($fkeys) : $fkeys;
325 325
 	}
@@ -332,17 +332,17 @@  discard block
 block discarded – undo
332 332
 	 */
333 333
 	protected function getShowCreateTable($schemaName, $tableName)
334 334
 	{
335
-		if(version_compare(PHP_VERSION,'5.1.3','<'))
335
+		if(version_compare(PHP_VERSION, '5.1.3', '<'))
336 336
 			throw new TDbException('dbmetadata_requires_php_version', 'Mysql 4.1.x', '5.1.3');
337 337
 
338 338
 		//See http://netevil.org/node.php?nid=795&SC=1
339 339
 		$this->getDbConnection()->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
340 340
 		if($schemaName!==null)
341
-			$sql = "SHOW CREATE TABLE `{$schemaName}`.`{$tableName}`";
341
+			$sql="SHOW CREATE TABLE `{$schemaName}`.`{$tableName}`";
342 342
 		else
343
-			$sql = "SHOW CREATE TABLE `{$tableName}`";
344
-		$command = $this->getDbConnection()->createCommand($sql);
345
-		$result = $command->queryRow();
343
+			$sql="SHOW CREATE TABLE `{$tableName}`";
344
+		$command=$this->getDbConnection()->createCommand($sql);
345
+		$result=$command->queryRow();
346 346
 		return isset($result['Create Table']) ? $result['Create Table'] : (isset($result['Create View']) ? $result['Create View'] : '');
347 347
 	}
348 348
 
@@ -354,19 +354,19 @@  discard block
 block discarded – undo
354 354
 	 */
355 355
 	protected function findForeignConstraints($schemaName, $tableName)
356 356
 	{
357
-		$sql = $this->getShowCreateTable($schemaName, $tableName);
358
-		$matches =array();
359
-		$regexp = '/FOREIGN KEY\s+\(([^\)]+)\)\s+REFERENCES\s+`?([^`]+)`?\s\(([^\)]+)\)/mi';
360
-		preg_match_all($regexp,$sql,$matches,PREG_SET_ORDER);
361
-		$foreign = array();
357
+		$sql=$this->getShowCreateTable($schemaName, $tableName);
358
+		$matches=array();
359
+		$regexp='/FOREIGN KEY\s+\(([^\)]+)\)\s+REFERENCES\s+`?([^`]+)`?\s\(([^\)]+)\)/mi';
360
+		preg_match_all($regexp, $sql, $matches, PREG_SET_ORDER);
361
+		$foreign=array();
362 362
 		foreach($matches as $match)
363 363
 		{
364
-			$fields = array_map('trim',explode(',',str_replace('`','',$match[1])));
365
-			$fk_fields = array_map('trim',explode(',',str_replace('`','',$match[3])));
364
+			$fields=array_map('trim', explode(',', str_replace('`', '', $match[1])));
365
+			$fk_fields=array_map('trim', explode(',', str_replace('`', '', $match[3])));
366 366
 			$keys=array();
367 367
 			foreach($fields as $k=>$v)
368
-				$keys[$v] = $fk_fields[$k];
369
-			$foreign[] = array('keys' => $keys, 'table' => trim($match[2]));
368
+				$keys[$v]=$fk_fields[$k];
369
+			$foreign[]=array('keys' => $keys, 'table' => trim($match[2]));
370 370
 		}
371 371
 		return $foreign;
372 372
 	}
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -154,8 +154,7 @@  discard block
 block discarded – undo
154 154
 					$info['NumericPrecision'] = intval($pscale[1]);
155 155
 					if(count($pscale) > 2)
156 156
 						$info['NumericScale'] = intval($pscale[2]);
157
-				}
158
-				else
157
+				} else
159 158
 					$info['ColumnSize'] = intval($pscale[1]);
160 159
 			}
161 160
 		}
@@ -254,8 +253,7 @@  discard block
 block discarded – undo
254 253
 		try
255 254
 		{
256 255
 			return count($result = $command->queryRow()) > 0 && $result['Table_type']==='VIEW';
257
-		}
258
-		catch(TDbException $e)
256
+		} catch(TDbException $e)
259 257
 		{
260 258
 			$table = $schemaName===null?$tableName:$schemaName.'.'.$tableName;
261 259
 			throw new TDbException('dbcommon_invalid_table_name',$table,$e->getMessage());
Please login to merge, or discard this patch.
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -335,12 +335,12 @@
 block discarded – undo
335 335
 		return false;
336 336
 	}
337 337
 
338
-        /**
339
-	 * Returns all table names in the database.
340
-	 * @param string $schema the schema of the tables. Defaults to empty string, meaning the current or default schema.
341
-	 * If not empty, the returned table names will be prefixed with the schema name.
342
-	 * @return array all table names in the database.
343
-	 */
338
+		/**
339
+		 * Returns all table names in the database.
340
+		 * @param string $schema the schema of the tables. Defaults to empty string, meaning the current or default schema.
341
+		 * If not empty, the returned table names will be prefixed with the schema name.
342
+		 * @return array all table names in the database.
343
+		 */
344 344
 	public function findTableNames($schema='')
345 345
 	{
346 346
 		if($schema==='')
Please login to merge, or discard this patch.
framework/Data/Common/Oracle/TOracleMetaData.php 4 patches
Doc Comments   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	/**
146 146
 	 * @param string table schema name
147 147
 	 * @param string table name.
148
-	 * @return boolean true if the table is a view.
148
+	 * @return integer true if the table is a view.
149 149
 	 */
150 150
 	protected function getIsView($schemaName,$tableName)
151 151
 	{
@@ -167,6 +167,7 @@  discard block
 block discarded – undo
167 167
 	/**
168 168
 	 * @param TOracleTableInfo table information.
169 169
 	 * @param array column information.
170
+	 * @param TOracleTableInfo $tableInfo
170 171
 	 */
171 172
 	protected function processColumn($tableInfo, $col)
172 173
 	{
@@ -322,6 +323,7 @@  discard block
 block discarded – undo
322 323
 	/**
323 324
 	 * @param string column name.
324 325
 	 * @param TOracleTableInfo table information.
326
+	 * @param string $columnId
325 327
 	 * @return boolean true if column is a foreign key.
326 328
 	 */
327 329
 	protected function isForeignKeyColumn($columnId, $tableInfo)
Please login to merge, or discard this patch.
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -335,12 +335,12 @@
 block discarded – undo
335 335
 		return false;
336 336
 	}
337 337
 
338
-        /**
339
-	 * Returns all table names in the database.
340
-	 * @param string $schema the schema of the tables. Defaults to empty string, meaning the current or default schema.
341
-	 * If not empty, the returned table names will be prefixed with the schema name.
342
-	 * @return array all table names in the database.
343
-	 */
338
+		/**
339
+		 * Returns all table names in the database.
340
+		 * @param string $schema the schema of the tables. Defaults to empty string, meaning the current or default schema.
341
+		 * If not empty, the returned table names will be prefixed with the schema name.
342
+		 * @return array all table names in the database.
343
+		 */
344 344
 	public function findTableNames($schema='')
345 345
 	{
346 346
 		if($schema==='')
Please login to merge, or discard this patch.
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  */
26 26
 class TOracleMetaData extends TDbMetaData
27 27
 {
28
-	private $_defaultSchema = 'system';
28
+	private $_defaultSchema='system';
29 29
 
30 30
 
31 31
 	/**
@@ -58,10 +58,10 @@  discard block
 block discarded – undo
58 58
 	 */
59 59
 	protected function getSchemaTableName($table)
60 60
 	{
61
-		if(count($parts= explode('.', str_replace('"','',$table))) > 1)
61
+		if(count($parts=explode('.', str_replace('"', '', $table))) > 1)
62 62
 			return array($parts[0], $parts[1]);
63 63
 		else
64
-			return array($this->getDefaultSchema(),$parts[0]);
64
+			return array($this->getDefaultSchema(), $parts[0]);
65 65
 	}
66 66
 
67 67
 	/**
@@ -71,12 +71,12 @@  discard block
 block discarded – undo
71 71
 	 */
72 72
 	protected function createTableInfo($table)
73 73
 	{
74
-		list($schemaName,$tableName) = $this->getSchemaTableName($table);
74
+		list($schemaName, $tableName)=$this->getSchemaTableName($table);
75 75
 
76 76
 		// This query is made much more complex by the addition of the 'attisserial' field.
77 77
 		// The subquery to get that field checks to see if there is an internally dependent
78 78
 		// sequence on the field.
79
-		$sql =
79
+		$sql=
80 80
 <<<EOD
81 81
 		SELECT
82 82
 			a.COLUMN_ID,
@@ -96,14 +96,14 @@  discard block
 block discarded – undo
96 96
 EOD;
97 97
 		$this->getDbConnection()->setActive(true);
98 98
 		$this->getDbConnection()->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER);
99
-		$command = $this->getDbConnection()->createCommand($sql);
99
+		$command=$this->getDbConnection()->createCommand($sql);
100 100
 		//$command->bindValue(':table', $tableName);
101 101
 		//$command->bindValue(':schema', $schemaName);
102
-		$tableInfo = $this->createNewTableInfo($schemaName, $tableName);
102
+		$tableInfo=$this->createNewTableInfo($schemaName, $tableName);
103 103
 		$index=0;
104 104
 		foreach($command->query() as $col)
105 105
 		{
106
-			$col['index'] = $index++;
106
+			$col['index']=$index++;
107 107
 			$this->processColumn($tableInfo, $col);
108 108
 		}
109 109
 		if($index===0)
@@ -116,15 +116,15 @@  discard block
 block discarded – undo
116 116
 	 * @param string table name.
117 117
 	 * @return TOracleTableInfo
118 118
 	 */
119
-	protected function createNewTableInfo($schemaName,$tableName)
119
+	protected function createNewTableInfo($schemaName, $tableName)
120 120
 	{
121
-		$info['SchemaName'] = $this->assertIdentifier($schemaName);
122
-		$info['TableName']	= $this->assertIdentifier($tableName);
123
-		$info['IsView'] 	= false;
124
-		if($this->getIsView($schemaName,$tableName)) $info['IsView'] = true;
125
-		list($primary, $foreign) = $this->getConstraintKeys($schemaName, $tableName);
126
-		$class = $this->getTableInfoClass();
127
-		return new $class($info,$primary,$foreign);
121
+		$info['SchemaName']=$this->assertIdentifier($schemaName);
122
+		$info['TableName']=$this->assertIdentifier($tableName);
123
+		$info['IsView']=false;
124
+		if($this->getIsView($schemaName, $tableName)) $info['IsView']=true;
125
+		list($primary, $foreign)=$this->getConstraintKeys($schemaName, $tableName);
126
+		$class=$this->getTableInfoClass();
127
+		return new $class($info, $primary, $foreign);
128 128
 	}
129 129
 
130 130
 	/**
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 	{
137 137
 		if(strpos($name, '"')!==false)
138 138
 		{
139
-			$ref = 'http://www.oracle.com';
139
+			$ref='http://www.oracle.com';
140 140
 			throw new TDbException('dbcommon_invalid_identifier_name', $name, $ref);
141 141
 		}
142 142
 		return $name;
@@ -147,10 +147,10 @@  discard block
 block discarded – undo
147 147
 	 * @param string table name.
148 148
 	 * @return boolean true if the table is a view.
149 149
 	 */
150
-	protected function getIsView($schemaName,$tableName)
150
+	protected function getIsView($schemaName, $tableName)
151 151
 	{
152 152
 		$this->getDbConnection()->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER);
153
-		$sql =
153
+		$sql=
154 154
 <<<EOD
155 155
 		select	OBJECT_TYPE
156 156
 		from 	ALL_OBJECTS
@@ -158,10 +158,10 @@  discard block
 block discarded – undo
158 158
 		and 	OWNER = '{$schemaName}'
159 159
 EOD;
160 160
 		$this->getDbConnection()->setActive(true);
161
-		$command = $this->getDbConnection()->createCommand($sql);
161
+		$command=$this->getDbConnection()->createCommand($sql);
162 162
 		//$command->bindValue(':schema',$schemaName);
163 163
 		//$command->bindValue(':table', $tableName);
164
-		return intval($command->queryScalar() === 'VIEW');
164
+		return intval($command->queryScalar()==='VIEW');
165 165
 	}
166 166
 
167 167
 	/**
@@ -170,17 +170,17 @@  discard block
 block discarded – undo
170 170
 	 */
171 171
 	protected function processColumn($tableInfo, $col)
172 172
 	{
173
-		$columnId = strtolower($col['attname']); //use column name as column Id
173
+		$columnId=strtolower($col['attname']); //use column name as column Id
174 174
 
175 175
 		//$info['ColumnName'] 	= '"'.$columnId.'"'; //quote the column names!
176
-		$info['ColumnName'] 	= $columnId; //NOT quote the column names!
177
-		$info['ColumnId'] 		= $columnId;
178
-		$info['ColumnIndex'] 	= $col['index'];
179
-		if(! (bool)$col['attnotnull'] ) $info['AllowNull'] = true;
180
-		if(in_array($columnId, $tableInfo->getPrimaryKeys())) $info['IsPrimaryKey'] = true;
181
-		if($this->isForeignKeyColumn($columnId, $tableInfo)) $info['IsForeignKey'] = true;
182
-		if( (int)$col['atttypmod'] > 0 ) $info['ColumnSize'] =  $col['atttypmod']; // - 4;
183
-		if( (bool)$col['atthasdef'] ) $info['DefaultValue'] = $col['adsrc'];
176
+		$info['ColumnName']=$columnId; //NOT quote the column names!
177
+		$info['ColumnId']=$columnId;
178
+		$info['ColumnIndex']=$col['index'];
179
+		if(!(bool) $col['attnotnull']) $info['AllowNull']=true;
180
+		if(in_array($columnId, $tableInfo->getPrimaryKeys())) $info['IsPrimaryKey']=true;
181
+		if($this->isForeignKeyColumn($columnId, $tableInfo)) $info['IsForeignKey']=true;
182
+		if((int) $col['atttypmod'] > 0) $info['ColumnSize']=$col['atttypmod']; // - 4;
183
+		if((bool) $col['atthasdef']) $info['DefaultValue']=$col['adsrc'];
184 184
 		//
185 185
 		// For a while Oracle Tables has no  associated AutoIncrement Triggers
186 186
 		//
@@ -194,31 +194,31 @@  discard block
 block discarded – undo
194 194
 			}
195 195
 		}
196 196
 		*/
197
-		$matches = array();
197
+		$matches=array();
198 198
 		if(preg_match('/\((\d+)(?:,(\d+))?+\)/', $col['type'], $matches))
199 199
 		{
200
-			$info['DbType'] = preg_replace('/\(\d+(?:,\d+)?\)/','',$col['type']);
200
+			$info['DbType']=preg_replace('/\(\d+(?:,\d+)?\)/', '', $col['type']);
201 201
 			if($this->isPrecisionType($info['DbType']))
202 202
 			{
203
-				$info['NumericPrecision'] = intval($matches[1]);
203
+				$info['NumericPrecision']=intval($matches[1]);
204 204
 				if(count($matches) > 2)
205
-					$info['NumericScale'] = intval($matches[2]);
205
+					$info['NumericScale']=intval($matches[2]);
206 206
 			}
207 207
 			else
208
-				$info['ColumnSize'] = intval($matches[1]);
208
+				$info['ColumnSize']=intval($matches[1]);
209 209
 		}
210 210
 		else
211
-			$info['DbType'] = $col['type'];
212
-		$tableInfo->Columns[$columnId] = new TOracleTableColumn($info);
211
+			$info['DbType']=$col['type'];
212
+		$tableInfo->Columns[$columnId]=new TOracleTableColumn($info);
213 213
 	}
214 214
 
215 215
 	/**
216 216
 	 * @return string serial name if found, null otherwise.
217 217
 	 */
218
-	protected function getSequenceName($tableInfo,$src)
218
+	protected function getSequenceName($tableInfo, $src)
219 219
 	{
220
-		$matches = array();
221
-		if(preg_match('/nextval\([^\']*\'([^\']+)\'[^\)]*\)/i',$src,$matches))
220
+		$matches=array();
221
+		if(preg_match('/nextval\([^\']*\'([^\']+)\'[^\)]*\)/i', $src, $matches))
222 222
 		{
223 223
 			if(is_int(strpos($matches[1], '.')))
224 224
 				return $matches[1];
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 	 */
233 233
 	protected function isPrecisionType($type)
234 234
 	{
235
-		$type = strtolower(trim($type));
235
+		$type=strtolower(trim($type));
236 236
 		return $type==='number'; // || $type==='interval' || strpos($type, 'time')===0;
237 237
 	}
238 238
 
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 	{
247 247
 		$this->getDbConnection()->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER);
248 248
 //		select decode( a.CONSTRAINT_TYPE, 'P', 'PRIMARY KEY (', 'FOREIGN KEY (' )||b.COLUMN_NAME||')' as consrc,
249
-		$sql =
249
+		$sql=
250 250
 <<<EOD
251 251
 		select b.COLUMN_NAME as consrc,
252 252
 			   a.CONSTRAINT_TYPE as contype
@@ -257,24 +257,24 @@  discard block
 block discarded – undo
257 257
 		and   a.CONSTRAINT_TYPE in ('P','R')
258 258
 EOD;
259 259
 		$this->getDbConnection()->setActive(true);
260
-		$command = $this->getDbConnection()->createCommand($sql);
260
+		$command=$this->getDbConnection()->createCommand($sql);
261 261
 		//$command->bindValue(':table', $tableName);
262 262
 		//$command->bindValue(':schema', $schemaName);
263
-		$primary = array();
264
-		$foreign = array();
263
+		$primary=array();
264
+		$foreign=array();
265 265
 		foreach($command->query() as $row)
266 266
 		{
267
-			switch( strtolower( $row['contype'] ) )
267
+			switch(strtolower($row['contype']))
268 268
 			{
269 269
 				case 'p':
270
-					$primary = array_merge( $primary, array(strtolower( $row['consrc'] )) );
270
+					$primary=array_merge($primary, array(strtolower($row['consrc'])));
271 271
 					/*
272 272
 					$arr = $this->getPrimaryKeys($row['consrc']);
273 273
 					$primary = array_merge( $primary, array(strtolower( $arr[0] )) );
274 274
 					*/
275 275
 					break;
276 276
 				case 'r':
277
-					$foreign = array_merge( $foreign, array(strtolower( $row['consrc'] )) );
277
+					$foreign=array_merge($foreign, array(strtolower($row['consrc'])));
278 278
 					/*
279 279
 					// if(($fkey = $this->getForeignKeys($row['consrc']))!==null)
280 280
 					$fkey = $this->getForeignKeys( $row['consrc'] );
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 					break;
284 284
 			}
285 285
 		}
286
-		return array($primary,$foreign);
286
+		return array($primary, $foreign);
287 287
 	}
288 288
 
289 289
 	/**
@@ -293,9 +293,9 @@  discard block
 block discarded – undo
293 293
 	 */
294 294
 	protected function getPrimaryKeys($src)
295 295
 	{
296
-		$matches = array();
296
+		$matches=array();
297 297
 		if(preg_match('/PRIMARY\s+KEY\s+\(([^\)]+)\)/i', $src, $matches))
298
-			return preg_split('/,\s+/',$matches[1]);
298
+			return preg_split('/,\s+/', $matches[1]);
299 299
 		return array();
300 300
 	}
301 301
 
@@ -306,16 +306,16 @@  discard block
 block discarded – undo
306 306
 	 */
307 307
 	protected function getForeignKeys($src)
308 308
 	{
309
-		$matches = array();
310
-		$brackets = '\(([^\)]+)\)';
311
-		$find = "/FOREIGN\s+KEY\s+{$brackets}\s+REFERENCES\s+([^\(]+){$brackets}/i";
309
+		$matches=array();
310
+		$brackets='\(([^\)]+)\)';
311
+		$find="/FOREIGN\s+KEY\s+{$brackets}\s+REFERENCES\s+([^\(]+){$brackets}/i";
312 312
 		if(preg_match($find, $src, $matches))
313 313
 		{
314
-			$keys = preg_split('/,\s+/', $matches[1]);
315
-			$fkeys = array();
314
+			$keys=preg_split('/,\s+/', $matches[1]);
315
+			$fkeys=array();
316 316
 			foreach(preg_split('/,\s+/', $matches[3]) as $i => $fkey)
317
-				$fkeys[$keys[$i]] = $fkey;
318
-			return array('table' => str_replace('"','',$matches[2]), 'keys' => $fkeys);
317
+				$fkeys[$keys[$i]]=$fkey;
318
+			return array('table' => str_replace('"', '', $matches[2]), 'keys' => $fkeys);
319 319
 		}
320 320
 	}
321 321
 
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 	{
329 329
 		foreach($tableInfo->getForeignKeys() as $fk)
330 330
 		{
331
-			if( $fk==$columnId )
331
+			if($fk==$columnId)
332 332
 			//if(in_array($columnId, array_keys($fk['keys'])))
333 333
 				return true;
334 334
 		}
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
 WHERE object_type = 'TABLE' AND owner=:schema
358 358
 EOD;
359 359
 			$command=$this->getDbConnection()->createCommand($sql);
360
-			$command->bindParam(':schema',$schema);
360
+			$command->bindParam(':schema', $schema);
361 361
 		}
362 362
 
363 363
 		$rows=$command->queryAll();
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -203,11 +203,9 @@  discard block
 block discarded – undo
203 203
 				$info['NumericPrecision'] = intval($matches[1]);
204 204
 				if(count($matches) > 2)
205 205
 					$info['NumericScale'] = intval($matches[2]);
206
-			}
207
-			else
206
+			} else
208 207
 				$info['ColumnSize'] = intval($matches[1]);
209
-		}
210
-		else
208
+		} else
211 209
 			$info['DbType'] = $col['type'];
212 210
 		$tableInfo->Columns[$columnId] = new TOracleTableColumn($info);
213 211
 	}
@@ -349,8 +347,7 @@  discard block
 block discarded – undo
349 347
 SELECT table_name, '{$schema}' as table_schema FROM user_tables
350 348
 EOD;
351 349
 			$command=$this->getDbConnection()->createCommand($sql);
352
-		}
353
-		else
350
+		} else
354 351
 		{
355 352
 			$sql=<<<EOD
356 353
 SELECT object_name as table_name, owner as table_schema FROM all_objects
Please login to merge, or discard this patch.
framework/Data/Common/Pgsql/TPgsqlMetaData.php 4 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -204,6 +204,7 @@
 block discarded – undo
204 204
 	/**
205 205
 	 * @param TPgsqlTableInfo table information.
206 206
 	 * @param array column information.
207
+	 * @param TPgsqlTableInfo $tableInfo
207 208
 	 */
208 209
 	protected function processColumn($tableInfo, $col)
209 210
 	{
Please login to merge, or discard this patch.
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -417,12 +417,12 @@
 block discarded – undo
417 417
 		return false;
418 418
 	}
419 419
 
420
-        /**
421
-	 * Returns all table names in the database.
422
-	 * @param string $schema the schema of the tables. Defaults to empty string, meaning the current or default schema.
423
-	 * If not empty, the returned table names will be prefixed with the schema name.
424
-	 * @return array all table names in the database.
425
-	 */
420
+		/**
421
+		 * Returns all table names in the database.
422
+		 * @param string $schema the schema of the tables. Defaults to empty string, meaning the current or default schema.
423
+		 * If not empty, the returned table names will be prefixed with the schema name.
424
+		 * @return array all table names in the database.
425
+		 */
426 426
 	public function findTableNames($schema='public')
427 427
 	{
428 428
 		if($schema==='')
Please login to merge, or discard this patch.
Spacing   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
  */
25 25
 class TPgsqlMetaData extends TDbMetaData
26 26
 {
27
-	private $_defaultSchema = 'public';
27
+	private $_defaultSchema='public';
28 28
 
29 29
 	/**
30 30
 	 * @return string TDbTableInfo class name.
@@ -86,10 +86,10 @@  discard block
 block discarded – undo
86 86
 	 */
87 87
 	protected function getSchemaTableName($table)
88 88
 	{
89
-		if(count($parts= explode('.', str_replace('"','',$table))) > 1)
89
+		if(count($parts=explode('.', str_replace('"', '', $table))) > 1)
90 90
 			return array($parts[0], $parts[1]);
91 91
 		else
92
-			return array($this->getDefaultSchema(),$parts[0]);
92
+			return array($this->getDefaultSchema(), $parts[0]);
93 93
 	}
94 94
 
95 95
 	/**
@@ -99,12 +99,12 @@  discard block
 block discarded – undo
99 99
 	 */
100 100
 	protected function createTableInfo($table)
101 101
 	{
102
-		list($schemaName,$tableName) = $this->getSchemaTableName($table);
102
+		list($schemaName, $tableName)=$this->getSchemaTableName($table);
103 103
 
104 104
 		// This query is made much more complex by the addition of the 'attisserial' field.
105 105
 		// The subquery to get that field checks to see if there is an internally dependent
106 106
 		// sequence on the field.
107
-		$sql =
107
+		$sql=
108 108
 <<<EOD
109 109
 		SELECT
110 110
 			a.attname,
@@ -135,14 +135,14 @@  discard block
 block discarded – undo
135 135
 		ORDER BY a.attnum
136 136
 EOD;
137 137
 		$this->getDbConnection()->setActive(true);
138
-		$command = $this->getDbConnection()->createCommand($sql);
138
+		$command=$this->getDbConnection()->createCommand($sql);
139 139
 		$command->bindValue(':table', $tableName);
140 140
 		$command->bindValue(':schema', $schemaName);
141
-		$tableInfo = $this->createNewTableInfo($schemaName, $tableName);
141
+		$tableInfo=$this->createNewTableInfo($schemaName, $tableName);
142 142
 		$index=0;
143 143
 		foreach($command->query() as $col)
144 144
 		{
145
-			$col['index'] = $index++;
145
+			$col['index']=$index++;
146 146
 			$this->processColumn($tableInfo, $col);
147 147
 		}
148 148
 		if($index===0)
@@ -155,15 +155,15 @@  discard block
 block discarded – undo
155 155
 	 * @param string table name.
156 156
 	 * @return TPgsqlTableInfo
157 157
 	 */
158
-	protected function createNewTableInfo($schemaName,$tableName)
158
+	protected function createNewTableInfo($schemaName, $tableName)
159 159
 	{
160
-		$info['SchemaName'] = $this->assertIdentifier($schemaName);
161
-		$info['TableName'] = $this->assertIdentifier($tableName);
162
-		if($this->getIsView($schemaName,$tableName))
163
-			$info['IsView'] = true;
164
-		list($primary, $foreign) = $this->getConstraintKeys($schemaName, $tableName);
165
-		$class = $this->getTableInfoClass();
166
-		return new $class($info,$primary,$foreign);
160
+		$info['SchemaName']=$this->assertIdentifier($schemaName);
161
+		$info['TableName']=$this->assertIdentifier($tableName);
162
+		if($this->getIsView($schemaName, $tableName))
163
+			$info['IsView']=true;
164
+		list($primary, $foreign)=$this->getConstraintKeys($schemaName, $tableName);
165
+		$class=$this->getTableInfoClass();
166
+		return new $class($info, $primary, $foreign);
167 167
 	}
168 168
 
169 169
 	/**
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 	{
176 176
 		if(strpos($name, '"')!==false)
177 177
 		{
178
-			$ref = 'http://www.postgresql.org/docs/7.4/static/sql-syntax.html#SQL-SYNTAX-IDENTIFIERS';
178
+			$ref='http://www.postgresql.org/docs/7.4/static/sql-syntax.html#SQL-SYNTAX-IDENTIFIERS';
179 179
 			throw new TDbException('dbcommon_invalid_identifier_name', $name, $ref);
180 180
 		}
181 181
 		return $name;
@@ -186,19 +186,19 @@  discard block
 block discarded – undo
186 186
 	 * @param string table name.
187 187
 	 * @return boolean true if the table is a view.
188 188
 	 */
189
-	protected function getIsView($schemaName,$tableName)
189
+	protected function getIsView($schemaName, $tableName)
190 190
 	{
191
-		$sql =
191
+		$sql=
192 192
 <<<EOD
193 193
 		SELECT count(c.relname) FROM pg_catalog.pg_class c
194 194
 		LEFT JOIN pg_catalog.pg_namespace n ON (n.oid = c.relnamespace)
195 195
 		WHERE (n.nspname=:schema) AND (c.relkind = 'v'::"char") AND c.relname = :table
196 196
 EOD;
197 197
 		$this->getDbConnection()->setActive(true);
198
-		$command = $this->getDbConnection()->createCommand($sql);
199
-		$command->bindValue(':schema',$schemaName);
198
+		$command=$this->getDbConnection()->createCommand($sql);
199
+		$command->bindValue(':schema', $schemaName);
200 200
 		$command->bindValue(':table', $tableName);
201
-		return intval($command->queryScalar()) === 1;
201
+		return intval($command->queryScalar())===1;
202 202
 	}
203 203
 
204 204
 	/**
@@ -207,56 +207,56 @@  discard block
 block discarded – undo
207 207
 	 */
208 208
 	protected function processColumn($tableInfo, $col)
209 209
 	{
210
-		$columnId = $col['attname']; //use column name as column Id
210
+		$columnId=$col['attname']; //use column name as column Id
211 211
 
212
-		$info['ColumnName'] = '"'.$columnId.'"'; //quote the column names!
213
-		$info['ColumnId'] = $columnId;
214
-		$info['ColumnIndex'] = $col['index'];
212
+		$info['ColumnName']='"'.$columnId.'"'; //quote the column names!
213
+		$info['ColumnId']=$columnId;
214
+		$info['ColumnIndex']=$col['index'];
215 215
 		if(!$col['attnotnull'])
216
-			$info['AllowNull'] = true;
216
+			$info['AllowNull']=true;
217 217
 		if(in_array($columnId, $tableInfo->getPrimaryKeys()))
218
-			$info['IsPrimaryKey'] = true;
218
+			$info['IsPrimaryKey']=true;
219 219
 		if($this->isForeignKeyColumn($columnId, $tableInfo))
220
-			$info['IsForeignKey'] = true;
220
+			$info['IsForeignKey']=true;
221 221
 
222 222
 		if($col['atttypmod'] > 0)
223
-			$info['ColumnSize'] =  $col['atttypmod'] - 4;
223
+			$info['ColumnSize']=$col['atttypmod'] - 4;
224 224
 		if($col['atthasdef'])
225
-			$info['DefaultValue'] = $col['adsrc'];
226
-		if($col['attisserial'] || substr($col['adsrc'],0,8) === 'nextval(')
225
+			$info['DefaultValue']=$col['adsrc'];
226
+		if($col['attisserial'] || substr($col['adsrc'], 0, 8)==='nextval(')
227 227
 		{
228
-			if(($sequence = $this->getSequenceName($tableInfo, $col['adsrc']))!==null)
228
+			if(($sequence=$this->getSequenceName($tableInfo, $col['adsrc']))!==null)
229 229
 			{
230
-				$info['SequenceName'] = $sequence;
230
+				$info['SequenceName']=$sequence;
231 231
 				unset($info['DefaultValue']);
232 232
 			}
233 233
 		}
234
-		$matches = array();
234
+		$matches=array();
235 235
 		if(preg_match('/\((\d+)(?:,(\d+))?+\)/', $col['type'], $matches))
236 236
 		{
237
-			$info['DbType'] = preg_replace('/\(\d+(?:,\d+)?\)/','',$col['type']);
237
+			$info['DbType']=preg_replace('/\(\d+(?:,\d+)?\)/', '', $col['type']);
238 238
 			if($this->isPrecisionType($info['DbType']))
239 239
 			{
240
-				$info['NumericPrecision'] = intval($matches[1]);
240
+				$info['NumericPrecision']=intval($matches[1]);
241 241
 				if(count($matches) > 2)
242
-					$info['NumericScale'] = intval($matches[2]);
242
+					$info['NumericScale']=intval($matches[2]);
243 243
 			}
244 244
 			else
245
-				$info['ColumnSize'] = intval($matches[1]);
245
+				$info['ColumnSize']=intval($matches[1]);
246 246
 		}
247 247
 		else
248
-			$info['DbType'] = $col['type'];
248
+			$info['DbType']=$col['type'];
249 249
 
250
-		$tableInfo->Columns[$columnId] = new TPgsqlTableColumn($info);
250
+		$tableInfo->Columns[$columnId]=new TPgsqlTableColumn($info);
251 251
 	}
252 252
 
253 253
 	/**
254 254
 	 * @return string serial name if found, null otherwise.
255 255
 	 */
256
-	protected function getSequenceName($tableInfo,$src)
256
+	protected function getSequenceName($tableInfo, $src)
257 257
 	{
258
-		$matches = array();
259
-		if(preg_match('/nextval\([^\']*\'([^\']+)\'[^\)]*\)/i',$src,$matches))
258
+		$matches=array();
259
+		if(preg_match('/nextval\([^\']*\'([^\']+)\'[^\)]*\)/i', $src, $matches))
260 260
 		{
261 261
 			if(is_int(strpos($matches[1], '.')))
262 262
 				return $matches[1];
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 	 */
271 271
 	protected function isPrecisionType($type)
272 272
 	{
273
-		$type = strtolower(trim($type));
273
+		$type=strtolower(trim($type));
274 274
 		return $type==='numeric' || $type==='interval' || strpos($type, 'time')===0;
275 275
 	}
276 276
 
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 	 */
283 283
 	protected function getConstraintKeys($schemaName, $tableName)
284 284
 	{
285
-		$sql =
285
+		$sql=
286 286
 <<<EOD
287 287
 	SELECT conname, consrc, contype, indkey, indisclustered FROM (
288 288
 			SELECT
@@ -330,25 +330,25 @@  discard block
 block discarded – undo
330 330
 			1
331 331
 EOD;
332 332
 		$this->getDbConnection()->setActive(true);
333
-		$command = $this->getDbConnection()->createCommand($sql);
333
+		$command=$this->getDbConnection()->createCommand($sql);
334 334
 		$command->bindValue(':table', $tableName);
335 335
 		$command->bindValue(':schema', $schemaName);
336
-		$primary = array();
337
-		$foreign = array();
336
+		$primary=array();
337
+		$foreign=array();
338 338
 		foreach($command->query() as $row)
339 339
 		{
340 340
 			switch($row['contype'])
341 341
 			{
342 342
 				case 'p':
343
-					$primary = $this->getPrimaryKeys($tableName, $schemaName, $row['indkey']);
343
+					$primary=$this->getPrimaryKeys($tableName, $schemaName, $row['indkey']);
344 344
 					break;
345 345
 				case 'f':
346
-					if(($fkey = $this->getForeignKeys($row['consrc']))!==null)
347
-						$foreign[] = $fkey;
346
+					if(($fkey=$this->getForeignKeys($row['consrc']))!==null)
347
+						$foreign[]=$fkey;
348 348
 					break;
349 349
 			}
350 350
 		}
351
-		return array($primary,$foreign);
351
+		return array($primary, $foreign);
352 352
 	}
353 353
 
354 354
 	/**
@@ -358,8 +358,8 @@  discard block
 block discarded – undo
358 358
 	 */
359 359
 	protected function getPrimaryKeys($tableName, $schemaName, $columnIndex)
360 360
 	{
361
-		$index = join(', ', explode(' ', $columnIndex));
362
-		$sql =
361
+		$index=join(', ', explode(' ', $columnIndex));
362
+		$sql=
363 363
 <<<EOD
364 364
 		SELECT attnum, attname FROM pg_catalog.pg_attribute WHERE
365 365
 		attrelid=(
@@ -369,14 +369,14 @@  discard block
 block discarded – undo
369 369
 		)
370 370
 				AND attnum IN ({$index})
371 371
 EOD;
372
-		$command = $this->getDbConnection()->createCommand($sql);
372
+		$command=$this->getDbConnection()->createCommand($sql);
373 373
 		$command->bindValue(':table', $tableName);
374 374
 		$command->bindValue(':schema', $schemaName);
375 375
 //		$command->bindValue(':columnIndex', join(', ', explode(' ', $columnIndex)));
376
-		$primary = array();
376
+		$primary=array();
377 377
 		foreach($command->query() as $row)
378 378
 		{
379
-						$primary[] = $row['attname'];
379
+						$primary[]=$row['attname'];
380 380
 		}
381 381
 
382 382
 		return $primary;
@@ -389,16 +389,16 @@  discard block
 block discarded – undo
389 389
 	 */
390 390
 	protected function getForeignKeys($src)
391 391
 	{
392
-		$matches = array();
393
-		$brackets = '\(([^\)]+)\)';
394
-		$find = "/FOREIGN\s+KEY\s+{$brackets}\s+REFERENCES\s+([^\(]+){$brackets}/i";
392
+		$matches=array();
393
+		$brackets='\(([^\)]+)\)';
394
+		$find="/FOREIGN\s+KEY\s+{$brackets}\s+REFERENCES\s+([^\(]+){$brackets}/i";
395 395
 		if(preg_match($find, $src, $matches))
396 396
 		{
397
-			$keys = preg_split('/,\s+/', $matches[1]);
398
-			$fkeys = array();
397
+			$keys=preg_split('/,\s+/', $matches[1]);
398
+			$fkeys=array();
399 399
 			foreach(preg_split('/,\s+/', $matches[3]) as $i => $fkey)
400
-				$fkeys[$keys[$i]] = $fkey;
401
-			return array('table' => str_replace('"','',$matches[2]), 'keys' => $fkeys);
400
+				$fkeys[$keys[$i]]=$fkey;
401
+			return array('table' => str_replace('"', '', $matches[2]), 'keys' => $fkeys);
402 402
 		}
403 403
 	}
404 404
 
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 WHERE table_schema=:schema AND table_type='BASE TABLE'
433 433
 EOD;
434 434
 		$command=$this->getDbConnection()->createCommand($sql);
435
-		$command->bindParam(':schema',$schema);
435
+		$command->bindParam(':schema', $schema);
436 436
 		$rows=$command->queryAll();
437 437
 		$names=array();
438 438
 		foreach($rows as $row)
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -244,11 +244,9 @@
 block discarded – undo
244 244
 				$info['NumericPrecision'] = intval($matches[1]);
245 245
 				if(count($matches) > 2)
246 246
 					$info['NumericScale'] = intval($matches[2]);
247
-			}
248
-			else
247
+			} else
249 248
 				$info['ColumnSize'] = intval($matches[1]);
250
-		}
251
-		else
249
+		} else
252 250
 			$info['DbType'] = $col['type'];
253 251
 
254 252
 		$tableInfo->Columns[$columnId] = new TPgsqlTableColumn($info);
Please login to merge, or discard this patch.
framework/Data/Common/TDbMetaData.php 3 patches
Doc Comments   -6 removed lines patch added patch discarded remove patch
@@ -127,8 +127,6 @@  discard block
 block discarded – undo
127 127
 	/**
128 128
 	 * Quotes a table name for use in a query.
129 129
 	 * @param string $name table name
130
-	 * @param string $lft left delimiter
131
-	 * @param string $rgt right delimiter
132 130
 	 * @return string the properly quoted table name
133 131
 	 */
134 132
 	public function quoteTableName($name)
@@ -150,8 +148,6 @@  discard block
 block discarded – undo
150 148
 	/**
151 149
 	 * Quotes a column name for use in a query.
152 150
 	 * @param string $name column name
153
-	 * @param string $lft left delimiter
154
-	 * @param string $rgt right delimiter
155 151
 	 * @return string the properly quoted column name
156 152
 	 */
157 153
 	public function quoteColumnName($name)
@@ -166,8 +162,6 @@  discard block
 block discarded – undo
166 162
 	/**
167 163
 	 * Quotes a column alias for use in a query.
168 164
 	 * @param string $name column alias
169
-	 * @param string $lft left delimiter
170
-	 * @param string $rgt right delimiter
171 165
 	 * @return string the properly quoted column alias
172 166
 	 */
173 167
 	public function quoteColumnAlias($name)
Please login to merge, or discard this patch.
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -179,14 +179,14 @@
 block discarded – undo
179 179
 		return $lft . str_replace(self::$delimiterIdentifier, '', $name) . $rgt;
180 180
 	}
181 181
 
182
-        /**
183
-	 * Returns all table names in the database.
184
-	 * This method should be overridden by child classes in order to support this feature
185
-	 * because the default implementation simply throws an exception.
186
-	 * @param string $schema the schema of the tables. Defaults to empty string, meaning the current or default schema.
187
-	 * If not empty, the returned table names will be prefixed with the schema name.
188
-	 * @return array all table names in the database.
189
-	 */
182
+		/**
183
+		 * Returns all table names in the database.
184
+		 * This method should be overridden by child classes in order to support this feature
185
+		 * because the default implementation simply throws an exception.
186
+		 * @param string $schema the schema of the tables. Defaults to empty string, meaning the current or default schema.
187
+		 * If not empty, the returned table names will be prefixed with the schema name.
188
+		 * @return array all table names in the database.
189
+		 */
190 190
 	abstract public function findTableNames($schema='');
191 191
 }
192 192
 
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	/**
37 37
 	 * @var array
38 38
 	 */
39
-	protected static $delimiterIdentifier = array('[', ']', '"', '`', "'");
39
+	protected static $delimiterIdentifier=array('[', ']', '"', '`', "'");
40 40
 
41 41
 	/**
42 42
 	 * @param TDbConnection database connection.
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	public static function getInstance($conn)
63 63
 	{
64 64
 		$conn->setActive(true); //must be connected before retrieving driver name
65
-		$driver = $conn->getDriverName();
65
+		$driver=$conn->getDriverName();
66 66
 		switch(strtolower($driver))
67 67
 		{
68 68
 			case 'pgsql':
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 //			case 'ibm':
83 83
 //				return new TIbmDb2MetaData($conn);
84 84
 			default:
85
-				throw new TDbException('ar_invalid_database_driver',$driver);
85
+				throw new TDbException('ar_invalid_database_driver', $driver);
86 86
 		}
87 87
 	}
88 88
 
@@ -93,12 +93,12 @@  discard block
 block discarded – undo
93 93
 	 */
94 94
 	public function getTableInfo($tableName=null)
95 95
 	{
96
-		$key = $tableName===null?$this->getDbConnection()->getConnectionString():$tableName;
96
+		$key=$tableName===null ? $this->getDbConnection()->getConnectionString() : $tableName;
97 97
 		if(!isset($this->_tableInfoCache[$key]))
98 98
 		{
99
-			$class = $this->getTableInfoClass();
100
-			$tableInfo = $tableName===null ? new $class : $this->createTableInfo($tableName);
101
-			$this->_tableInfoCache[$key] = $tableInfo;
99
+			$class=$this->getTableInfoClass();
100
+			$tableInfo=$tableName===null ? new $class : $this->createTableInfo($tableName);
101
+			$this->_tableInfoCache[$key]=$tableInfo;
102 102
 		}
103 103
 		return $this->_tableInfoCache[$key];
104 104
 	}
@@ -136,17 +136,17 @@  discard block
 block discarded – undo
136 136
 	 */
137 137
 	public function quoteTableName($name)
138 138
 	{
139
-		$name = str_replace(self::$delimiterIdentifier, '', $name);
139
+		$name=str_replace(self::$delimiterIdentifier, '', $name);
140 140
 
141
-		$args = func_get_args();
142
-		$rgt = $lft = isset($args[1]) ? $args[1] : '';
143
-		$rgt = isset($args[2]) ? $args[2] : $rgt;
141
+		$args=func_get_args();
142
+		$rgt=$lft=isset($args[1]) ? $args[1] : '';
143
+		$rgt=isset($args[2]) ? $args[2] : $rgt;
144 144
 
145 145
 		if(strpos($name, '.')===false)
146
-			return $lft . $name . $rgt;
146
+			return $lft.$name.$rgt;
147 147
 		$names=explode('.', $name);
148 148
 		foreach($names as &$n)
149
-			$n = $lft . $n . $rgt;
149
+			$n=$lft.$n.$rgt;
150 150
 		return implode('.', $names);
151 151
 	}
152 152
 
@@ -159,11 +159,11 @@  discard block
 block discarded – undo
159 159
 	 */
160 160
 	public function quoteColumnName($name)
161 161
 	{
162
-		$args = func_get_args();
163
-		$rgt = $lft = isset($args[1]) ? $args[1] : '';
164
-		$rgt = isset($args[2]) ? $args[2] : $rgt;
162
+		$args=func_get_args();
163
+		$rgt=$lft=isset($args[1]) ? $args[1] : '';
164
+		$rgt=isset($args[2]) ? $args[2] : $rgt;
165 165
 
166
-		return $lft . str_replace(self::$delimiterIdentifier, '', $name) . $rgt;
166
+		return $lft.str_replace(self::$delimiterIdentifier, '', $name).$rgt;
167 167
 	}
168 168
 
169 169
 	/**
@@ -175,11 +175,11 @@  discard block
 block discarded – undo
175 175
 	 */
176 176
 	public function quoteColumnAlias($name)
177 177
 	{
178
-		$args = func_get_args();
179
-		$rgt = $lft = isset($args[1]) ? $args[1] : '';
180
-		$rgt = isset($args[2]) ? $args[2] : $rgt;
178
+		$args=func_get_args();
179
+		$rgt=$lft=isset($args[1]) ? $args[1] : '';
180
+		$rgt=isset($args[2]) ? $args[2] : $rgt;
181 181
 
182
-		return $lft . str_replace(self::$delimiterIdentifier, '', $name) . $rgt;
182
+		return $lft.str_replace(self::$delimiterIdentifier, '', $name).$rgt;
183 183
 	}
184 184
 
185 185
         /**
Please login to merge, or discard this patch.
framework/Data/Common/TDbTableColumn.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -34,6 +34,7 @@
 block discarded – undo
34 34
 	/**
35 35
 	 * @param string information array key name
36 36
 	 * @param mixed default value if information array value is null
37
+	 * @param string $name
37 38
 	 * @return mixed information array value.
38 39
 	 */
39 40
 	protected function getInfo($name,$default=null)
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  */
22 22
 class TDbTableColumn extends \Prado\TComponent
23 23
 {
24
-	const UNDEFINED_VALUE= INF; //use infinity for undefined value
24
+	const UNDEFINED_VALUE=INF; //use infinity for undefined value
25 25
 
26 26
 	private $_info=array();
27 27
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	 * @param mixed default value if information array value is null
40 40
 	 * @return mixed information array value.
41 41
 	 */
42
-	protected function getInfo($name,$default=null)
42
+	protected function getInfo($name, $default=null)
43 43
 	{
44 44
 		return isset($this->_info[$name]) ? $this->_info[$name] : $default;
45 45
 	}
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	 * @param string information array key name
49 49
 	 * @param mixed new information array value.
50 50
 	 */
51
-	protected function setInfo($name,$value)
51
+	protected function setInfo($name, $value)
52 52
 	{
53 53
 		$this->_info[$name]=$value;
54 54
 	}
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 */
122 122
 	public function getAllowNull()
123 123
 	{
124
-		return $this->getInfo('AllowNull',false);
124
+		return $this->getInfo('AllowNull', false);
125 125
 	}
126 126
 
127 127
 	/**
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 		if(($precision=$this->getNumericPrecision())!==null)
154 154
 		{
155 155
 			$scale=$this->getNumericScale();
156
-			return $scale===null ? pow(10,$precision) : pow(10,$precision-$scale);
156
+			return $scale===null ? pow(10, $precision) : pow(10, $precision - $scale);
157 157
 		}
158 158
 	}
159 159
 
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 	 */
163 163
 	public function getIsPrimaryKey()
164 164
 	{
165
-		return $this->getInfo('IsPrimaryKey',false);
165
+		return $this->getInfo('IsPrimaryKey', false);
166 166
 	}
167 167
 
168 168
 	/**
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 */
171 171
 	public function getIsForeignKey()
172 172
 	{
173
-		return $this->getInfo('IsForeignKey',false);
173
+		return $this->getInfo('IsForeignKey', false);
174 174
 	}
175 175
 
176 176
 	/**
Please login to merge, or discard this patch.