fdafa
Browse files
php/connections/ConnectionManagers.php
ADDED
@@ -0,0 +1,206 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
include_once(getabspath("connections/ConnectionManager_base.php"));
|
4 |
+
|
5 |
+
class ConnectionManager extends ConnectionManager_Base
|
6 |
+
{
|
7 |
+
/**
|
8 |
+
* @param String connId
|
9 |
+
* @return Connection
|
10 |
+
*/
|
11 |
+
protected function getConnection( $connId )
|
12 |
+
{
|
13 |
+
include_once getabspath("connections/Connection.php");
|
14 |
+
|
15 |
+
$data = $this->_connectionsData[ $connId ];
|
16 |
+
switch( $data["connStringType"] )
|
17 |
+
{
|
18 |
+
case "mysql":
|
19 |
+
if( useMySQLiLib() )
|
20 |
+
{
|
21 |
+
include_once getabspath("connections/MySQLiConnection.php");
|
22 |
+
return new MySQLiConnection( $data );
|
23 |
+
}
|
24 |
+
|
25 |
+
include_once getabspath("connections/MySQLConnection.php");
|
26 |
+
return new MySQLConnection( $data );
|
27 |
+
|
28 |
+
case "mssql":
|
29 |
+
case "compact":
|
30 |
+
if( useMSSQLWinConnect() )
|
31 |
+
{
|
32 |
+
include_once getabspath("connections/MSSQLWinConnection.php");
|
33 |
+
return new MSSQLWinConnection( $data );
|
34 |
+
}
|
35 |
+
if( isSqlsrvExtLoaded() )
|
36 |
+
{
|
37 |
+
include_once getabspath("connections/MSSQLSrvConnection.php");
|
38 |
+
return new MSSQLSrvConnection( $data );
|
39 |
+
}
|
40 |
+
|
41 |
+
if( function_exists("mssql_connect") ) {
|
42 |
+
include_once getabspath("connections/MSSQLUnixConnection.php");
|
43 |
+
return new MSSQLUnixConnection( $data );
|
44 |
+
}
|
45 |
+
|
46 |
+
if( class_exists("PDO") ) {
|
47 |
+
include_once getabspath("connections/PDOConnection.php");
|
48 |
+
$drivers = pdo_drivers();
|
49 |
+
if( in_array( "sqlsrv", $drivers) )
|
50 |
+
{
|
51 |
+
$data["PDOString"] = "sqlsrv:Server=" . $data["connInfo"][0] . ";Database=" . $data["connInfo"][3];
|
52 |
+
$data["PDOUser"] = $data["connInfo"][1];
|
53 |
+
$data["PDOPass"] = $data["connInfo"][2];
|
54 |
+
return new PDOConnection( $data );
|
55 |
+
}
|
56 |
+
if( in_array( "dblib", $drivers) )
|
57 |
+
{
|
58 |
+
$data["PDOString"] = "dblib:host=" . $data["connInfo"][0] . ";dbname=" . $data["connInfo"][3];
|
59 |
+
$data["PDOUser"] = $data["connInfo"][1];
|
60 |
+
$data["PDOPass"] = $data["connInfo"][2];
|
61 |
+
return new PDOConnection( $data );
|
62 |
+
}
|
63 |
+
}
|
64 |
+
echo "No SQL Server driver found in your PHP settings.";
|
65 |
+
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
66 |
+
echo "<br>To enable SQL Server support add the following line to php.ini file:";
|
67 |
+
echo "<br>extension=php_com_dotnet.dll";
|
68 |
+
}
|
69 |
+
exit();
|
70 |
+
|
71 |
+
case "msaccess":
|
72 |
+
case "odbc":
|
73 |
+
case "odbcdsn":
|
74 |
+
case "custom":
|
75 |
+
case "file":
|
76 |
+
if( stripos($data["ODBCString"], 'Provider=') !== false )
|
77 |
+
{
|
78 |
+
include_once getabspath("connections/ADOConnection.php");
|
79 |
+
return new ADOConnection( $data );
|
80 |
+
}
|
81 |
+
|
82 |
+
include_once getabspath("connections/ODBCConnection.php");
|
83 |
+
return new ODBCConnection( $data );
|
84 |
+
|
85 |
+
case "oracle":
|
86 |
+
include_once getabspath("connections/OracleConnection.php");
|
87 |
+
return new OracleConnection( $data );
|
88 |
+
|
89 |
+
case "postgre":
|
90 |
+
include_once getabspath("connections/PostgreConnection.php");
|
91 |
+
return new PostgreConnection( $data );
|
92 |
+
|
93 |
+
case "db2":
|
94 |
+
include_once getabspath("connections/DB2Connection.php");
|
95 |
+
return new DB2Connection( $data );
|
96 |
+
|
97 |
+
case "informix":
|
98 |
+
include_once getabspath("connections/InformixConnection.php");
|
99 |
+
return new InformixConnection( $data );
|
100 |
+
|
101 |
+
case "sqlite":
|
102 |
+
include_once getabspath("connections/SQLite3Connection.php");
|
103 |
+
return new SQLite3Connection( $data );
|
104 |
+
case "pdo":
|
105 |
+
include_once getabspath("connections/PDOConnection.php");
|
106 |
+
return new PDOConnection( $data );
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Set the data representing the project's
|
112 |
+
* db connection properties
|
113 |
+
*/
|
114 |
+
protected function _setConnectionsData()
|
115 |
+
{
|
116 |
+
// content of this function can be modified on demo account
|
117 |
+
// variable names $data and $connectionsData are important
|
118 |
+
|
119 |
+
$connectionsData = array();
|
120 |
+
|
121 |
+
$data = array();
|
122 |
+
$data["dbType"] = 4;
|
123 |
+
$data["connId"] = "KnowledgeBase2_at_localhost";
|
124 |
+
$data["connName"] = "KnowledgeBase2 at localhost";
|
125 |
+
$data["connStringType"] = "postgre";
|
126 |
+
$postgre_url = getenv("postgre_url");
|
127 |
+
$data["connectionString"] = $postgre_url; //currently unused
|
128 |
+
|
129 |
+
$this->_connectionsIdByName["KnowledgeBase2 at localhost"] = "KnowledgeBase2_at_localhost";
|
130 |
+
|
131 |
+
$data["connInfo"] = array();
|
132 |
+
$data["ODBCUID"] = "";
|
133 |
+
$data["ODBCPWD"] = "";
|
134 |
+
$data["leftWrap"] = "\"";
|
135 |
+
$data["rightWrap"] = "\"";
|
136 |
+
|
137 |
+
$data["DBPath"] = "db"; //currently unused
|
138 |
+
$data["useServerMapPath"] = 1; //currently unused
|
139 |
+
|
140 |
+
$host="ep-odd-mode-93794521.us-east-2.aws.neon.tech";
|
141 |
+
$user="miyataken999";
|
142 |
+
$password="yz1wPf4KrWTm";
|
143 |
+
$options="options=endpoint=ep-odd-mode-93794521 port=5432";
|
144 |
+
$dbname="neondb";
|
145 |
+
$data["connInfo"][0] = $host;
|
146 |
+
$data["connInfo"][1] = $user;
|
147 |
+
$data["connInfo"][2] = $password;
|
148 |
+
$data["connInfo"][3] = $options;
|
149 |
+
$data["connInfo"][4] = $dbname;
|
150 |
+
;
|
151 |
+
// encription set
|
152 |
+
$data["EncryptInfo"] = array();
|
153 |
+
$data["EncryptInfo"]["mode"] = 0;
|
154 |
+
$data["EncryptInfo"]["alg"] = 128;
|
155 |
+
$data["EncryptInfo"]["key"] = "";
|
156 |
+
|
157 |
+
$connectionsData["KnowledgeBase2_at_localhost"] = $data;
|
158 |
+
$data = array();
|
159 |
+
$data["dbType"] = 4;
|
160 |
+
$data["connId"] = "neondbatuseast2awsneontech";
|
161 |
+
$data["connName"] = "neondb at us-east-2.aws.neon.t";
|
162 |
+
$data["connStringType"] = "postgre";
|
163 |
+
$data["connectionString"] = $postgre_url; //currently unused
|
164 |
+
|
165 |
+
$this->_connectionsIdByName["neondb at us-east-2.aws.neon.t"] = "neondbatuseast2awsneontech";
|
166 |
+
|
167 |
+
$data["connInfo"] = array();
|
168 |
+
$data["ODBCUID"] = "";
|
169 |
+
$data["ODBCPWD"] = "";
|
170 |
+
$data["leftWrap"] = "\"";
|
171 |
+
$data["rightWrap"] = "\"";
|
172 |
+
|
173 |
+
$data["DBPath"] = "db"; //currently unused
|
174 |
+
$data["useServerMapPath"] = 1; //currently unused
|
175 |
+
|
176 |
+
$host="ep-odd-mode-93794521.us-east-2.aws.neon.tech";
|
177 |
+
$user="miyataken999";
|
178 |
+
$password="yz1wPf4KrWTm";
|
179 |
+
$options="options=endpoint=ep-odd-mode-93794521 port=5432";
|
180 |
+
$dbname="neondb";
|
181 |
+
$data["connInfo"][0] = $host;
|
182 |
+
$data["connInfo"][1] = $user;
|
183 |
+
$data["connInfo"][2] = $password;
|
184 |
+
$data["connInfo"][3] = $options;
|
185 |
+
$data["connInfo"][4] = $dbname;
|
186 |
+
;
|
187 |
+
// encription set
|
188 |
+
$data["EncryptInfo"] = array();
|
189 |
+
$data["EncryptInfo"]["mode"] = 0;
|
190 |
+
$data["EncryptInfo"]["alg"] = 256;
|
191 |
+
$data["EncryptInfo"]["key"] = "";
|
192 |
+
|
193 |
+
$connectionsData["neondbatuseast2awsneontech"] = $data;
|
194 |
+
$this->_connectionsData = &$connectionsData;
|
195 |
+
}
|
196 |
+
|
197 |
+
/**
|
198 |
+
* Close db connections
|
199 |
+
* @destructor
|
200 |
+
*/
|
201 |
+
function __desctruct()
|
202 |
+
{
|
203 |
+
$this->CloseConnections();
|
204 |
+
}
|
205 |
+
}
|
206 |
+
?>
|
php/include/appsettings.php
CHANGED
@@ -793,9 +793,9 @@ $suggestAllContent = true;
|
|
793 |
$strLastSQL = "";
|
794 |
$showCustomMarkerOnPrint = false;
|
795 |
|
796 |
-
$projectBuildKey = "
|
797 |
$wizardBuildKey = "41974";
|
798 |
-
$projectBuildNumber = "
|
799 |
|
800 |
$mlang_messages = array();
|
801 |
$mlang_charsets = array();
|
|
|
793 |
$strLastSQL = "";
|
794 |
$showCustomMarkerOnPrint = false;
|
795 |
|
796 |
+
$projectBuildKey = "492_1720354121";
|
797 |
$wizardBuildKey = "41974";
|
798 |
+
$projectBuildNumber = "492";
|
799 |
|
800 |
$mlang_messages = array();
|
801 |
$mlang_charsets = array();
|