aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/web/offline_mysql.php
diff options
context:
space:
mode:
authorDavid Walter Seikel2016-11-03 21:44:39 +1000
committerDavid Walter Seikel2016-11-03 21:44:39 +1000
commit134f86e8d5c414409631b25b8c6f0ee45fbd8631 (patch)
tree216b89d3fb89acfb81be1e440c25c41ab09fa96d /web/offline_mysql.php
parentMore changing to production grid. Double oops. (diff)
downloadopensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.zip
opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.gz
opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.bz2
opensim-SC-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.xz
Initial update to OpenSim 0.8.2.1 source code.
Diffstat (limited to 'web/offline_mysql.php')
-rw-r--r--web/offline_mysql.php112
1 files changed, 0 insertions, 112 deletions
diff --git a/web/offline_mysql.php b/web/offline_mysql.php
deleted file mode 100644
index fe0eb3e..0000000
--- a/web/offline_mysql.php
+++ /dev/null
@@ -1,112 +0,0 @@
1<?php
2/*
3 * Copyright (c) 2007, 2008 Contributors, http://opensimulator.org/
4 * See CONTRIBUTORS for a full list of copyright holders.
5 *
6 * See LICENSE for the full licensing terms of this file.
7 *
8*/
9
10// This looks like its lifted from http://www.weberdev.com/get_example-4372.html
11// I'd contact the original developer for licensing info, but his website is broken.
12
13class DB
14{
15 var $Host = C_DB_HOST; // Hostname of our MySQL server
16 var $Database = C_DB_NAME; // Logical database name on that server
17 var $User = C_DB_USER; // Database user
18 var $Password = C_DB_PASS; // Database user's password
19 var $Link_ID = 0; // Result of mysql_connect()
20 var $Query_ID = 0; // Result of most recent mysql_query()
21 var $Record = array(); // Current mysql_fetch_array()-result
22 var $Row; // Current row number
23 var $Errno = 0; // Error state of query
24 var $Error = "";
25
26 function halt($msg)
27 {
28 echo("</TD></TR></TABLE><B>Database error:</B> $msg<BR>\n");
29 echo("<B>MySQL error</B>: $this->Errno ($this->Error)<BR>\n");
30 die("Session halted.");
31 }
32
33 function connect()
34 {
35 if($this->Link_ID == 0)
36 {
37 $this->Link_ID = mysql_connect($this->Host, $this->User, $this->Password);
38 if (!$this->Link_ID)
39 {
40 $this->halt("Link_ID == false, connect failed");
41 }
42 $SelectResult = mysql_select_db($this->Database, $this->Link_ID);
43 if(!$SelectResult)
44 {
45 $this->Errno = mysql_errno($this->Link_ID);
46 $this->Error = mysql_error($this->Link_ID);
47 $this->halt("cannot select database <I>".$this->Database."</I>");
48 }
49 }
50 }
51
52 function escape($String)
53 {
54 return mysql_escape_string($String);
55 }
56
57 function query($Query_String)
58 {
59 $this->connect();
60 $this->Query_ID = mysql_query($Query_String,$this->Link_ID);
61 $this->Row = 0;
62 $this->Errno = mysql_errno();
63 $this->Error = mysql_error();
64 if (!$this->Query_ID)
65 {
66 $this->halt("Invalid SQL: ".$Query_String);
67 }
68 return $this->Query_ID;
69 }
70
71 function next_record()
72 {
73 $this->Record = @mysql_fetch_array($this->Query_ID);
74 $this->Row += 1;
75 $this->Errno = mysql_errno();
76 $this->Error = mysql_error();
77 $stat = is_array($this->Record);
78 if (!$stat)
79 {
80 @mysql_free_result($this->Query_ID);
81 $this->Query_ID = 0;
82 }
83 return $this->Record;
84 }
85
86 function num_rows()
87 {
88 return mysql_num_rows($this->Query_ID);
89 }
90
91 function affected_rows()
92 {
93 return mysql_affected_rows($this->Link_ID);
94 }
95
96 function optimize($tbl_name)
97 {
98 $this->connect();
99 $this->Query_ID = @mysql_query("OPTIMIZE TABLE $tbl_name",$this->Link_ID);
100 }
101
102 function clean_results()
103 {
104 if($this->Query_ID != 0) mysql_freeresult($this->Query_ID);
105 }
106
107 function close()
108 {
109 if($this->Link_ID != 0) mysql_close($this->Link_ID);
110 }
111}
112?>