File: db_informix.php

package info (click to toggle)
phpreports 0.3.6-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 620 kB
  • ctags: 1,149
  • sloc: php: 2,668; xml: 157; makefile: 29; python: 10; sh: 2
file content (56 lines) | stat: -rwxr-xr-x 1,241 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php

/*	$oArray contains this:
	$oArray[0]=>user name:Informix install directory:Config File
	$oArray[1]=>password
	$oArray[2]=>server (from 'sqlhosts')
	$oArray[3]=>database name
*/
	function db_connect($oArray) {
		$db = $oArray[3] . '@' . $oArray[2];
		list ($sUser, $sHome, $sConfig) = split (':', $oArray[0]);
		putenv("INFORMIXDIR=$sHome");
		putenv("INFORMIXSERVER=$oArray[2]");
		putenv("ONCONFIG=$sConfig");
		$oCon = @ifx_connect ($db, $sUser, $oArray[1]);
		if(!$oCon) { die("could not connect"); }
		return $oCon;
	}

	function db_select_db($sDatabase) {
		return;
	}

	function db_query($oCon,$sSQL) {
		return @ifx_query($sSQL, $oCon, IFX_SCROLL);
	}

	function db_colnum($oStmt) {
        	return @ifx_num_fields($oStmt);
	}

	function db_columnName($oStmt,$iPos) {
		$types = @ifx_fieldtypes ($oStmt);
		$keys = array_keys ($types);
		return $keys[$iPos-1];
	}
	
	function db_columnType($oStmt,$iPos) {
		$types = @ifx_fieldtypes ($oStmt);
		$keys = array_keys ($types);
		$key = $keys[$iPos-1];
		return $types[$key];
	}

	function db_fetch($oStmt) {
		return @ifx_fetch_row($oStmt);
	}

	function db_free($oStmt) {
		return @ifx_free_result($oStmt);
	}

	function db_disconnect($oCon) {
		return @ifx_close($oCon);
	}
?>