Subversion Repositories prepend

Rev

Rev 2 | Rev 5 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2 Rev 4
Line 36... Line 36...
36
// Öffnet eine Verbindung zu einem MySQL-Server
36
// Öffnet eine Verbindung zu einem MySQL-Server
37
function mysql_connect($server=null, $username=null, $password=null, $new_link=false, $client_flags=0) {
37
function mysql_connect($server=null, $username=null, $password=null, $new_link=false, $client_flags=0) {
38
        global $vts_mysqli;
38
        global $vts_mysqli;
39
        $ary = explode(':', $server);
39
        $ary = explode(':', $server);
40
        $host = $ary[0];
40
        $host = $ary[0];
-
 
41
        $ini_port = ini_get("mysqli.default_port");
41
        $port = isset($ary[1]) ? $ary[1] : ini_get("mysqli.default_port");
42
        $port = isset($ary[1]) ? (int)$ary[1] : ($ini_port ? (int)$ini_port : 3306);
42
        if (is_null($server)) $port = ini_get("mysqli.default_host");
43
        if (is_null($server)) $port = ini_get("mysqli.default_host");
43
        if (is_null($username)) $port = ini_get("mysqli.default_user");
44
        if (is_null($username)) $port = ini_get("mysqli.default_user");
44
        if (is_null($password)) $port = ini_get("mysqli.default_password");
45
        if (is_null($password)) $port = ini_get("mysqli.default_password");
45
        $vts_mysqli = new mysqli($host, $username, $password, /*dbname*/'', $port, ini_get("mysqli.default_socket"));
46
        $vts_mysqli = new mysqli($host, $username, $password, /*dbname*/'', $port, ini_get("mysqli.default_socket"));
46
        return (empty($vts_mysqli->connect_error) && ($vts_mysqli->connect_errno == 0)) ? $vts_mysqli : false;
47
        return (empty($vts_mysqli->connect_error) && ($vts_mysqli->connect_errno == 0)) ? $vts_mysqli : false;
Line 59... Line 60...
59
function mysql_data_seek($result, $row_number) {
60
function mysql_data_seek($result, $row_number) {
60
        if (!$result) {
61
        if (!$result) {
61
                $err = mysql_error();
62
                $err = mysql_error();
62
                throw new Exception("Called mysql_data_seek() with an erroneous argument.".($err == '' ? '' : " Possible cause: $err"));
63
                throw new Exception("Called mysql_data_seek() with an erroneous argument.".($err == '' ? '' : " Possible cause: $err"));
63
        }
64
        }
64
        return $result->data_seek($offset) !== false;
65
        return $result->data_seek($row_number) !== false;
65
}
66
}
66
 
67
 
67
// Liefert Schema Namen vom Aufruf von mysql_list_dbs
68
// Liefert Schema Namen vom Aufruf von mysql_list_dbs
68
function mysql_db_name($result, $row, $field=NULL) {
69
function mysql_db_name($result, $row, $field=NULL) {
69
        if (!$result) {
70
        if (!$result) {
Line 183... Line 184...
183
function mysql_field_flags($result, $field_offset) {
184
function mysql_field_flags($result, $field_offset) {
184
        if (!$result) {
185
        if (!$result) {
185
                $err = mysql_error();
186
                $err = mysql_error();
186
                throw new Exception("Called mysql_field_flags() with an erroneous argument.".($err == '' ? '' : " Possible cause: $err"));
187
                throw new Exception("Called mysql_field_flags() with an erroneous argument.".($err == '' ? '' : " Possible cause: $err"));
187
        }
188
        }
188
        return $result->fetch_field_direct($fieldnr)->flags;
189
        return $result->fetch_field_direct($field_offset)->flags;
189
}
190
}
190
 
191
 
191
// Liefert die Länge des angegebenen Feldes
192
// Liefert die Länge des angegebenen Feldes
192
function mysql_field_len($result, $field_offset) {
193
function mysql_field_len($result, $field_offset) {
193
        if (!$result) {
194
        if (!$result) {
194
                $err = mysql_error();
195
                $err = mysql_error();
195
                throw new Exception("Called mysql_field_len() with an erroneous argument.".($err == '' ? '' : " Possible cause: $err"));
196
                throw new Exception("Called mysql_field_len() with an erroneous argument.".($err == '' ? '' : " Possible cause: $err"));
196
        }
197
        }
197
        return $result->fetch_field_direct($fieldnr)->length;
198
        return $result->fetch_field_direct($field_offset)->length;
198
}
199
}
199
 
200
 
200
// Liefert den Namen eines Feldes in einem Ergebnis
201
// Liefert den Namen eines Feldes in einem Ergebnis
201
function mysql_field_name($result, $field_offset) {
202
function mysql_field_name($result, $field_offset) {
202
        if (!$result) {
203
        if (!$result) {
Line 351... Line 352...
351
// Öffnet eine persistente Verbindung zum MySQL Server
352
// Öffnet eine persistente Verbindung zum MySQL Server
352
function mysql_pconnect($server=null, $username=null, $password=null, $client_flags=0) {
353
function mysql_pconnect($server=null, $username=null, $password=null, $client_flags=0) {
353
        global $vts_mysqli;
354
        global $vts_mysqli;
354
        $ary = explode(':', $server);
355
        $ary = explode(':', $server);
355
        $host = $ary[0];
356
        $host = $ary[0];
-
 
357
        $ini_port = ini_get("mysqli.default_port");
356
        $port = isset($ary[1]) ? $ary[1] : ini_get("mysqli.default_port");
358
        $port = isset($ary[1]) ? (int)$ary[1] : ($ini_port ? (int)$ini_port : 3306);
357
        if (is_null($server)) $port = ini_get("mysqli.default_host");
359
        if (is_null($server)) $port = ini_get("mysqli.default_host");
358
        if (is_null($username)) $port = ini_get("mysqli.default_user");
360
        if (is_null($username)) $port = ini_get("mysqli.default_user");
359
        if (is_null($password)) $port = ini_get("mysqli.default_password");
361
        if (is_null($password)) $port = ini_get("mysqli.default_password");
360
        $vts_mysqli = new mysqli('p:'.$host, $username, $password, /*dbname*/'', $port, ini_get("mysqli.default_socket"));
362
        $vts_mysqli = new mysqli('p:'.$host, $username, $password, /*dbname*/'', $port, ini_get("mysqli.default_socket"));
361
        return (empty($vts_mysqli->connect_error) && ($vts_mysqli->connect_errno == 0)) ? $vts_mysqli : false;
363
        return (empty($vts_mysqli->connect_error) && ($vts_mysqli->connect_errno == 0)) ? $vts_mysqli : false;