Subversion Repositories ALCASAR

Rev

Rev 790 | Rev 1831 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 790 Rev 1805
Line 14... Line 14...
14
	}
14
	}
15
}
15
}
16
 
16
 
17
function da_sql_host_connect($server,$config)
17
function da_sql_host_connect($server,$config)
18
{
18
{
19
	if ($config[sql_use_http_credentials] == 'yes'){
19
	if ($config['sql_use_http_credentials'] == 'yes'){
20
		global $HTTP_SERVER_VARS;
20
		global $HTTP_SERVER_VARS;
21
		$SQL_user = $HTTP_SERVER_VARS["PHP_AUTH_USER"];
21
		$SQL_user = $HTTP_SERVER_VARS["PHP_AUTH_USER"];
22
		$SQL_passwd = $HTTP_SERVER_VARS["PHP_AUTH_PW"];
22
		$SQL_passwd = $HTTP_SERVER_VARS["PHP_AUTH_PW"];
23
	}
23
	}
24
	else{
24
	else{
25
		$SQL_user = $config[sql_username];
25
		$SQL_user = $config['sql_username'];
26
		$SQL_passwd = $config[sql_password];
26
		$SQL_passwd = $config['sql_password'];
27
	}
27
	}
28
 
28
 
29
	if ($config[sql_connect_timeout] != 0)
29
	if ($config['sql_connect_timeout'] != 0)
30
		@ini_set('mysql.connect_timeout',$config[sql_connect_timeout]);
30
		ini_set('mysql.connect_timeout',$config['sql_connect_timeout']);
31
	if ($config[sql_debug] == 'true')
31
	if ($config['sql_debug'] == 'true')
32
		print "<b>DEBUG(SQL,MYSQL DRIVER): Connect: User=$SQL_user,Password=$SQL_passwd </b><br>\n";
32
		print "<b>DEBUG(SQL,MYSQL DRIVER): Connect: User=$SQL_user,Password=$SQL_passwd </b><br>\n";
33
	return @mysql_connect("$server:$config[sql_port]",$SQL_user,$SQL_passwd);
33
	return mysqli_connect("$server:$config[sql_port]",$SQL_user,$SQL_passwd,$config['sql_database']);
34
}
34
}
35
 
35
 
36
function da_sql_connect($config)
36
function da_sql_connect($config)
37
{
37
{
38
	if ($config[sql_use_http_credentials] == 'yes'){
38
	if (isset($config['sql_use_http_credentials']) && $config['sql_use_http_credentials'] == 'yes'){
39
		global $HTTP_SERVER_VARS;
39
		global $HTTP_SERVER_VARS;
40
		$SQL_user = $HTTP_SERVER_VARS["PHP_AUTH_USER"];
40
		$SQL_user = $HTTP_SERVER_VARS["PHP_AUTH_USER"];
41
		$SQL_passwd = $HTTP_SERVER_VARS["PHP_AUTH_PW"];
41
		$SQL_passwd = $HTTP_SERVER_VARS["PHP_AUTH_PW"];
42
	}
42
	}
43
	else{
43
	else{
44
		$SQL_user = $config[sql_username];
44
		$SQL_user = $config['sql_username'];
45
		$SQL_passwd = $config[sql_password];
45
		$SQL_passwd = $config['sql_password'];
46
	}
46
	}
47
 
47
 
48
	if ($config[sql_connect_timeout] != 0)
48
	if ($config['sql_connect_timeout'] != 0)
49
		@ini_set('mysql.connect_timeout',$config[sql_connect_timeout]);
49
		ini_set('mysql.connect_timeout',$config['sql_connect_timeout']);
50
	if ($config[sql_debug] == 'true')
50
	if ($config['sql_debug'] == 'true')
51
		print "<b>DEBUG(SQL,MYSQL DRIVER): Connect: User=$SQL_user,Password=$SQL_passwd </b><br>\n";
51
		print "<b>DEBUG(SQL,MYSQL DRIVER): Connect: User=$SQL_user,Password=$SQL_passwd </b><br>\n";
52
	return @mysql_connect("$config[sql_server]:$config[sql_port]",$SQL_user,$SQL_passwd);
52
	return mysqli_connect("$config[sql_server]:$config[sql_port]",$SQL_user,$SQL_passwd,$config['sql_database']);
53
}
53
}
54
 
54
 
55
function da_sql_pconnect($config)
55
function da_sql_pconnect($config)
56
{
56
{
57
	if ($config[sql_use_http_credentials] == 'yes'){
57
	if (isset($config['sql_use_http_credentials']) && $config['sql_use_http_credentials'] == 'yes'){
58
		global $HTTP_SERVER_VARS;
58
		global $HTTP_SERVER_VARS;
59
		$SQL_user = $HTTP_SERVER_VARS["PHP_AUTH_USER"];
59
		$SQL_user = $HTTP_SERVER_VARS["PHP_AUTH_USER"];
60
		$SQL_passwd = $HTTP_SERVER_VARS["PHP_AUTH_PW"];
60
		$SQL_passwd = $HTTP_SERVER_VARS["PHP_AUTH_PW"];
61
	}
61
	}
62
	else{
62
	else{
63
		$SQL_user = $config[sql_username];
63
		$SQL_user = $config['sql_username'];
64
		$SQL_passwd = $config[sql_password];
64
		$SQL_passwd = $config['sql_password'];
65
	}
65
	}
66
 
-
 
67
	if ($config[sql_connect_timeout] != 0)
66
	if ($config['sql_connect_timeout'] != 0)
68
		@ini_set('mysql.connect_timeout',$config[sql_connect_timeout]);
67
		ini_set('mysql.connect_timeout',$config['sql_connect_timeout']);
69
	if ($config[sql_debug] == 'true')
68
	if ($config['sql_debug'] == 'true')
70
		print "<b>DEBUG(SQL,MYSQL DRIVER): Connect: User=$SQL_user,Password=$SQL_passwd </b><br>\n";
69
		print "<b>DEBUG(SQL,MYSQL DRIVER): Connect: User=$SQL_user,Password=$SQL_passwd </b><br>\n";
71
	return @mysql_pconnect("$config[sql_server]:$config[sql_port]",$SQL_user,$SQL_passwd);
70
	return mysqli_connect($config['sql_server'],$SQL_user,$SQL_passwd,$config['sql_database'],$config['sql_port']);
72
}
71
}
73
 
72
 
74
function da_sql_close($link,$config)
73
function da_sql_close($link,$config)
75
{
74
{
76
	return @mysql_close($link);
75
	return mysqli_close($link);
77
}
76
}
78
 
77
 
79
function da_sql_escape_string($string)
78
function da_sql_escape_string($link, $string)
80
{
79
{
81
	return @mysql_real_escape_string($string);
80
	return mysqli_real_escape_string($link, $string);
82
}
81
}
83
 
82
 
84
function da_sql_query($link,$config,$query)
83
function da_sql_query($link,$config,$query)
85
{
84
{
86
	if ($config[sql_debug] == 'true')
85
	if ($config['sql_debug'] == 'true')
87
		print "<b>DEBUG(SQL,MYSQL DRIVER): Query: <i>$query</i></b><br>\n";
86
		print "<b>DEBUG(SQL,MYSQL DRIVER): Query: <i>$query</i></b><br>\n";
88
	return @mysql_db_query($config[sql_database],$query,$link);
87
	return mysqli_query($link,$query);
89
}
88
}
90
 
89
 
91
function da_sql_num_rows($result,$config)
90
function da_sql_num_rows($result,$config)
92
{
91
{
93
	if ($config[sql_debug] == 'true')
92
	if ($config['sql_debug'] == 'true')
94
		print "<b>DEBUG(SQL,MYSQL DRIVER): Query Result: Num rows:: " . @mysql_num_rows($result) . "</b><br>\n";
93
		print "<b>DEBUG(SQL,MYSQL DRIVER): Query Result: Num rows:: " . mysqli_num_rows($result) . "</b><br>\n";
95
	return @mysql_num_rows($result);
94
	return mysqli_num_rows($result);
96
}
95
}
97
 
96
 
98
function da_sql_fetch_array($result,$config)
97
function da_sql_fetch_array($result,$config)
99
{
98
{
100
	$row = array_change_key_case(@mysql_fetch_array($result,
99
	$row = @array_change_key_case(mysqli_fetch_array($result,
101
		MYSQL_ASSOC),CASE_LOWER);
100
		MYSQLI_ASSOC),CASE_LOWER);
102
	if ($config[sql_debug] == 'true'){
101
	if ($config['sql_debug'] == 'true'){
103
		print "<b>DEBUG(SQL,MYSQL DRIVER): Query Result: <pre>";
102
		print "<b>DEBUG(SQL,MYSQL DRIVER): Query Result: <pre>";
104
		print_r($row);
103
		print_r($row);
105
		print "</b></pre>\n";
104
		print "</b></pre>\n";
106
	}
105
	}
107
	return $row;
106
	return $row;
108
}
107
}
109
 
108
 
110
function da_sql_affected_rows($link,$result,$config)
109
function da_sql_affected_rows($link,$result,$config)
111
{
110
{
112
	if ($config[sql_debug] == 'true')
111
	if ($config['sql_debug'] == 'true')
113
		print "<b>DEBUG(SQL,MYSQL DRIVER): Query Result: Affected rows:: " . @mysql_affected_rows($result) . "</b><br>\n";
112
		print "<b>DEBUG(SQL,MYSQL DRIVER): Query Result: Affected rows:: " . mysqli_affected_rows($result) . "</b><br>\n";
114
	return @mysql_affected_rows($link);
113
	return mysqli_affected_rows($link);
115
}
114
}
116
 
115
 
117
function da_sql_list_fields($table,$link,$config)
116
function da_sql_list_fields($table,$link,$config)
118
{
117
{
119
	return @mysql_list_fields($config[sql_database],$table);
118
	return da_sql_query($link, $config, "SHOW COLUMNS FROM $table");
120
}
119
}
121
 
120
 
122
function da_sql_num_fields($fields,$config)
121
function da_sql_num_fields($fields,$config)
123
{
122
{
124
	return @mysql_num_fields($fields);
123
	return mysqli_num_fields($fields);
125
}
124
}
126
 
125
 
127
function da_sql_field_name($fields,$num,$config)
126
function da_sql_field_name($fields,$num,$config)
128
{
127
{
129
	return @mysql_field_name($fields,$num);
128
	return mysqli_fetch_field_direct($fields,$num);
130
}
129
}
131
 
130
 
132
function da_sql_error($link,$config)
131
function da_sql_error($link,$config)
133
{
132
{
134
	return @mysql_error($link);
133
	return mysqli_error($link);
135
}
134
}
136
?>
135
?>