Subversion-Projekte lars-tiefland.ci

Revision

Revision 68 | Revision 2049 | Zur aktuellen Revision | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 68 Revision 1257
Zeile 104... Zeile 104...
104
 
104
 
105
			empty($this->port) OR $this->dsn .= ';port='.$this->port;
105
			empty($this->port) OR $this->dsn .= ';port='.$this->port;
106
			empty($this->database) OR $this->dsn .= ';dbname='.$this->database;
106
			empty($this->database) OR $this->dsn .= ';dbname='.$this->database;
107
			empty($this->char_set) OR $this->dsn .= ';charset='.$this->char_set;
107
			empty($this->char_set) OR $this->dsn .= ';charset='.$this->char_set;
108
		}
108
		}
109
		elseif ( ! empty($this->char_set) && strpos($this->dsn, 'charset=', 6) === FALSE && is_php('5.3.6'))
109
		elseif ( ! empty($this->char_set) && strpos($this->dsn, 'charset=', 6) === FALSE)
110
		{
110
		{
111
			$this->dsn .= ';charset='.$this->char_set;
111
			$this->dsn .= ';charset='.$this->char_set;
112
		}
112
		}
Zeile 120... Zeile 120...
120
	 * @param	bool	$persistent
120
	 * @param	bool	$persistent
121
	 * @return	object
121
	 * @return	object
122
	 */
122
	 */
123
	public function db_connect($persistent = FALSE)
123
	public function db_connect($persistent = FALSE)
124
	{
124
	{
125
		/* Prior to PHP 5.3.6, even if the charset was supplied in the DSN
-
 
126
		 * on connect - it was ignored. This is a work-around for the issue.
-
 
127
		 *
-
 
128
		 * Reference: http://www.php.net/manual/en/ref.pdo-mysql.connection.php
-
 
129
		 */
-
 
130
		if ( ! is_php('5.3.6') && ! empty($this->char_set))
-
 
131
		{
-
 
132
			$this->options[PDO::MYSQL_ATTR_INIT_COMMAND] = 'SET NAMES '.$this->char_set
-
 
133
				.(empty($this->dbcollat) ? '' : ' COLLATE '.$this->dbcollat);
-
 
134
		}
-
 
135
 
-
 
136
		if (isset($this->stricton))
125
		if (isset($this->stricton))
137
		{
126
		{
138
			if ($this->stricton)
127
			if ($this->stricton)
139
			{
128
			{
140
				$sql = 'CONCAT(@@sql_mode, ",", "STRICT_ALL_TABLES")';
129
				$sql = 'CONCAT(@@sql_mode, ",", "STRICT_ALL_TABLES")';
Zeile 167... Zeile 156...
167
		if ($this->compress === TRUE)
156
		if ($this->compress === TRUE)
168
		{
157
		{
169
			$this->options[PDO::MYSQL_ATTR_COMPRESS] = TRUE;
158
			$this->options[PDO::MYSQL_ATTR_COMPRESS] = TRUE;
170
		}
159
		}
Zeile 171... Zeile -...
171
 
-
 
172
		// SSL support was added to PDO_MYSQL in PHP 5.3.7
160
 
173
		if (is_array($this->encrypt) && is_php('5.3.7'))
161
		if (is_array($this->encrypt))
174
		{
162
		{
175
			$ssl = array();
163
			$ssl = array();
176
			empty($this->encrypt['ssl_key'])    OR $ssl[PDO::MYSQL_ATTR_SSL_KEY]    = $this->encrypt['ssl_key'];
164
			empty($this->encrypt['ssl_key'])    OR $ssl[PDO::MYSQL_ATTR_SSL_KEY]    = $this->encrypt['ssl_key'];
177
			empty($this->encrypt['ssl_cert'])   OR $ssl[PDO::MYSQL_ATTR_SSL_CERT]   = $this->encrypt['ssl_cert'];
165
			empty($this->encrypt['ssl_cert'])   OR $ssl[PDO::MYSQL_ATTR_SSL_CERT]   = $this->encrypt['ssl_cert'];
Zeile 222... Zeile 210...
222
			return TRUE;
210
			return TRUE;
223
		}
211
		}
Zeile 224... Zeile 212...
224
 
212
 
225
		return FALSE;
213
		return FALSE;
-
 
214
	}
-
 
215
 
-
 
216
	// --------------------------------------------------------------------
-
 
217
 
-
 
218
	/**
-
 
219
	 * Begin Transaction
-
 
220
	 *
-
 
221
	 * @return	bool
-
 
222
	 */
-
 
223
	protected function _trans_begin()
-
 
224
	{
-
 
225
		$this->conn_id->setAttribute(PDO::ATTR_AUTOCOMMIT, FALSE);
-
 
226
		return $this->conn_id->beginTransaction();
-
 
227
	}
-
 
228
 
-
 
229
	// --------------------------------------------------------------------
-
 
230
 
-
 
231
	/**
-
 
232
	 * Commit Transaction
-
 
233
	 *
-
 
234
	 * @return	bool
-
 
235
	 */
-
 
236
	protected function _trans_commit()
-
 
237
	{
-
 
238
		if ($this->conn_id->commit())
-
 
239
		{
-
 
240
			$this->conn_id->setAttribute(PDO::ATTR_AUTOCOMMIT, TRUE);
-
 
241
			return TRUE;
-
 
242
		}
-
 
243
 
-
 
244
		return FALSE;
-
 
245
	}
-
 
246
 
-
 
247
	// --------------------------------------------------------------------
-
 
248
 
-
 
249
	/**
-
 
250
	 * Rollback Transaction
-
 
251
	 *
-
 
252
	 * @return	bool
-
 
253
	 */
-
 
254
	protected function _trans_rollback()
-
 
255
	{
-
 
256
		if ($this->conn_id->rollBack())
-
 
257
		{
-
 
258
			$this->conn_id->setAttribute(PDO::ATTR_AUTOCOMMIT, TRUE);
-
 
259
			return TRUE;
-
 
260
		}
-
 
261
 
-
 
262
		return FALSE;
Zeile 226... Zeile 263...
226
	}
263
	}
Zeile 227... Zeile 264...
227
 
264
 
228
	// --------------------------------------------------------------------
265
	// --------------------------------------------------------------------