0003-Use-query-cache-for-introspection.patch

MSSQL, untested. (against trunk) - Chris Bandy, 04/21/2009 03:58 am

Download (1.3 kB)

 
system/libraries/drivers/Database/Mssql.php
285 285

  
286 286
	public function list_fields($table)
287 287
	{
288
		static $tables;
288
		$result = array();
289 289

  
290
		if (empty($tables[$table]))
290
		foreach ($this->field_data($table) as $row)
291 291
		{
292
			foreach ($this->field_data($table) as $row)
293
			{
294
				// Make an associative array
295
				$tables[$table][$row->Field] = $this->sql_type($row->Type);
296
			}
292
			// Make an associative array
293
			$result[$row->Field] = $this->sql_type($row->Type);
297 294
		}
298 295

  
299
		return $tables[$table];
296
		return $result;
300 297
	}
301 298

  
302 299
	public function field_data($table)
303 300
	{
304
		$columns = array();
305

  
306
		if ($query = MSSQL_query('SHOW COLUMNS FROM '.$this->escape_table($table), $this->link))
307
		{
308
			if (MSSQL_num_rows($query) > 0)
309
			{
310
				while ($row = MSSQL_fetch_object($query))
311
				{
312
					$columns[] = $row;
313
				}
314
			}
315
		}
301
		$query = $this->query('SHOW COLUMNS FROM '.$this->escape_table($table), $this->link);
316 302

  
317
		return $columns;
303
		return $query->result_array(TRUE);
318 304
	}
319 305
}
320 306