Page 1 of 1

Oracle and ADOdb

Posted: Fri Oct 14, 2005 5:01 am
by thomas777neo
Hi All

It was such a flippin mission to get oracle setup and working with ADOdb. Well, now that I get a connection to the database I have another problem. I have a function that returns the fields of a table:

Code: Select all

/*
		* Name: getTableFields
		* Type: function
		* Purpose: get the fields of a table.
		* Parameters: getTableFields(string $table))
		* Return: return (Array $fields);
		* Usage:
			$fields = $this-> getTableFields($table);
		* Output Example: Array
	*/		
	public function getTableFields($table)
	{
		$db = $this-> connection(); // connect to database		

                                // $table = "tablenamespace.table";

		$fields = $db-> MetaColumns($table); // get columns
		$columns = sizeof($fields);

		$this-> closeConnection($db); // close connection
		
		return($fields); // return fields
	} //public function getTableFields($table)
If I vardump the $db connection, it is valid. And my oracle user that I created has dba, resource and connects rights. The namespace that I use does exist, and it is default to the user. The $field variable returns an empty Array.
So I cannot get the friggin fields for the table.

Is there anything else that I can check? Thanks, much appreciated.

Posted: Fri Oct 21, 2005 3:09 pm
by thomas777neo
Any Ideas?

Posted: Fri Oct 21, 2005 3:46 pm
by sweatje
Seems to work for me:

Code: Select all

sweatje@prdweb sweatje $ php -r 'require_once "dblogin.php";
$c = amp_adodb_connection("prdcrm");
$rs = $c->execute("select * from tabs");
var_dump(array_keys($rs->fields));'

array(44) {
  [0]=>
  string(10) "TABLE_NAME"
  [1]=>
  string(15) "TABLESPACE_NAME"
  [2]=>
  string(12) "CLUSTER_NAME"
  [3]=>
  string(8) "IOT_NAME"
  [4]=>
  string(8) "PCT_FREE"
  [5]=>
  string(8) "PCT_USED"
  [6]=>
  string(9) "INI_TRANS"
  [7]=>
  string(9) "MAX_TRANS"
  [8]=>
  string(14) "INITIAL_EXTENT"
  [9]=>
  string(11) "NEXT_EXTENT"
  [10]=>
  string(11) "MIN_EXTENTS"
  [11]=>
  string(11) "MAX_EXTENTS"
  [12]=>
  string(12) "PCT_INCREASE"
  [13]=>
  string(9) "FREELISTS"
  [14]=>
  string(15) "FREELIST_GROUPS"
  [15]=>
  string(7) "LOGGING"
  [16]=>
  string(9) "BACKED_UP"
  [17]=>
  string(8) "NUM_ROWS"
  [18]=>
  string(6) "BLOCKS"
  [19]=>
  string(12) "EMPTY_BLOCKS"
  [20]=>
  string(9) "AVG_SPACE"
  [21]=>
  string(9) "CHAIN_CNT"
  [22]=>
  string(11) "AVG_ROW_LEN"
  [23]=>
  string(25) "AVG_SPACE_FREELIST_BLOCKS"
  [24]=>
  string(19) "NUM_FREELIST_BLOCKS"
  [25]=>
  string(6) "DEGREE"
  [26]=>
  string(9) "INSTANCES"
  [27]=>
  string(5) "CACHE"
  [28]=>
  string(10) "TABLE_LOCK"
  [29]=>
  string(11) "SAMPLE_SIZE"
  [30]=>
  string(13) "LAST_ANALYZED"
  [31]=>
  string(11) "PARTITIONED"
  [32]=>
  string(8) "IOT_TYPE"
  [33]=>
  string(9) "TEMPORARY"
  [34]=>
  string(9) "SECONDARY"
  [35]=>
  string(6) "NESTED"
  [36]=>
  string(11) "BUFFER_POOL"
  [37]=>
  string(12) "ROW_MOVEMENT"
  [38]=>
  string(12) "GLOBAL_STATS"
  [39]=>
  string(10) "USER_STATS"
  [40]=>
  string(8) "DURATION"
  [41]=>
  string(12) "SKIP_CORRUPT"
  [42]=>
  string(10) "MONITORING"
  [43]=>
  string(13) "CLUSTER_OWNER"
}
or were you looking for something else?

Posted: Fri Oct 21, 2005 3:49 pm
by thomas777neo
Thanks, I will give it a go