Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 107... Línea 107...
107
		if (!function_exists('db2_connect')) {
107
		if (!function_exists('db2_connect')) {
108
			ADOConnection::outp("DB2 extension not installed.");
108
			ADOConnection::outp("DB2 extension not installed.");
109
			return null;
109
			return null;
110
		}
110
		}
Línea 111... Línea 111...
111
 
111
 
-
 
112
		$connectionParameters = $this->unpackParameters(
112
		$connectionParameters = $this->unpackParameters($argDSN,
113
			$argDSN,
113
														$argUsername,
114
			$argUsername,
114
														$argPassword,
115
			$argPassword,
-
 
116
			$argDatabasename
Línea 115... Línea 117...
115
														$argDatabasename);
117
		);
116
 
118
 
117
		if ($connectionParameters == null)
119
		if ($connectionParameters == null)
118
		{
120
		{
Línea 127... Línea 129...
127
		$argPassword 	         = $connectionParameters['pwd'];
129
		$argPassword 	         = $connectionParameters['pwd'];
128
		$argDatabasename         = $connectionParameters['database'];
130
		$argDatabasename         = $connectionParameters['database'];
129
		$useCataloguedConnection = $connectionParameters['catalogue'];
131
		$useCataloguedConnection = $connectionParameters['catalogue'];
Línea 130... Línea 132...
130
 
132
 
-
 
133
		if ($this->debug){
-
 
134
			if (strcmp($argDSN,'*LOCAL') == 0)
-
 
135
			{
-
 
136
				$connectMessage = '*LOCAL connection';
131
		if ($this->debug){
137
			}
-
 
138
			else if ($useCataloguedConnection)
132
			if ($useCataloguedConnection){
139
			{
133
				$connectMessage = "Catalogued connection using parameters: ";
140
				$connectMessage = "Catalogued connection using parameters: ";
134
				$connectMessage .= "DB=$argDatabasename / ";
141
				$connectMessage .= "DB=$argDatabasename / ";
135
				$connectMessage .= "UID=$argUsername / ";
142
				$connectMessage .= "UID=$argUsername / ";
136
				$connectMessage .= "PWD=$argPassword";
143
				$connectMessage .= "PWD=$argPassword";
Línea 139... Línea 146...
139
			{
146
			{
140
				$connectMessage = "Uncatalogued connection using DSN: $argDSN";
147
				$connectMessage = "Uncatalogued connection using DSN: $argDSN";
141
			}
148
			}
142
			ADOConnection::outp($connectMessage);
149
			ADOConnection::outp($connectMessage);
143
		}
150
		}
-
 
151
 
144
		/*
152
		/*
145
		 * This needs to be set before the connect().
153
		 * This needs to be set before the connect().
146
		 */
154
		 */
147
		ini_set('ibm_db2.binmode', $this->binmode);
155
		ini_set('ibm_db2.binmode', $this->binmode);
Línea 162... Línea 170...
162
				foreach($p as $k=>$v)
170
				foreach($p as $k=>$v)
163
					$db2Options[$k] = $v;
171
					$db2Options[$k] = $v;
164
		}
172
		}
Línea 165... Línea 173...
165
 
173
 
-
 
174
		if ($useCataloguedConnection)
166
		if ($useCataloguedConnection)
175
		{
167
			$this->_connectionID = $db2Function($argDatabasename,
176
			$this->_connectionID = $db2Function($argDatabasename,
168
												$argUsername,
177
												$argUsername,
169
												$argPassword,
178
												$argPassword,
-
 
179
												$db2Options);
170
												$db2Options);
180
		}
-
 
181
		else
171
		else
182
		
172
			$this->_connectionID = $db2Function($argDSN,
183
			$this->_connectionID = $db2Function($argDSN,
173
												null,
184
												'',
174
												null,
185
												'',
Línea 175... Línea 186...
175
												$db2Options);
186
												$db2Options);
Línea 176... Línea 187...
176
 
187
 
177
 
188
 
Línea -... Línea 189...
-
 
189
		$this->_errorMsg = @db2_conn_errormsg();
-
 
190
 
-
 
191
		if ($this->_connectionID && $this->connectStmt)
178
		$this->_errorMsg = @db2_conn_errormsg();
192
			$this->execute($this->connectStmt);
Línea 179... Línea 193...
179
 
193
 
Línea 180... Línea 194...
180
		if ($this->_connectionID && $this->connectStmt)
194
		if ($this->_connectionID && $argDatabasename)
Línea 196... Línea 210...
196
	 */
210
	 */
197
	private function unpackParameters($argDSN, $argUsername, $argPassword, $argDatabasename)
211
	private function unpackParameters($argDSN, $argUsername, $argPassword, $argDatabasename)
198
	{
212
	{
Línea 199... Línea 213...
199
 
213
 
-
 
214
 
200
 
215
		$connectionParameters = array(
201
		$connectionParameters = array('dsn'=>'',
216
			'dsn'=>'',
202
									  'uid'=>'',
217
			'uid'=>'',
203
									  'pwd'=>'',
218
			'pwd'=>'',
204
									  'database'=>'',
219
			'database'=>'',
-
 
220
			'catalogue'=>true
-
 
221
		);
-
 
222
 
-
 
223
		/*
-
 
224
		* Shortcut for *LOCAL
-
 
225
		*/
-
 
226
		if (strcmp($argDSN,'*LOCAL') == 0)
-
 
227
		{
-
 
228
			$connectionParameters['dsn']      = $argDSN;
-
 
229
			$connectionParameters['database'] = $argDatabasename;
-
 
230
			$connectionParameters['catalogue'] = false;
-
 
231
			
Línea 205... Línea 232...
205
									  'catalogue'=>true
232
			return $connectionParameters;
206
									  );
233
		}
207
 
234
 
208
		/*
235
		/*