Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yeray Santana Hualde
syncEnrollments
Commits
e70726ca
Commit
e70726ca
authored
Jul 19, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added support for odbc connections.
parent
f7fc0130
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
2 deletions
+16
-2
connector.php
system/db/connector.php
+16
-2
No files found.
system/db/connector.php
View file @
e70726ca
...
@@ -34,6 +34,9 @@ class Connector {
...
@@ -34,6 +34,9 @@ class Connector {
case
'mysql'
:
case
'mysql'
:
case
'pgsql'
:
case
'pgsql'
:
return
static
::
connect_to_server
(
$config
);
return
static
::
connect_to_server
(
$config
);
case
'odbc'
:
return
static
::
connect_to_odbc
(
$config
);
}
}
throw
new
\Exception
(
'Database driver '
.
$config
->
driver
.
' is not supported.'
);
throw
new
\Exception
(
'Database driver '
.
$config
->
driver
.
' is not supported.'
);
...
@@ -45,7 +48,7 @@ class Connector {
...
@@ -45,7 +48,7 @@ class Connector {
* SQLite database paths can be specified either relative to the application/db
* SQLite database paths can be specified either relative to the application/db
* directory, or as an absolute path to any location on the file system.
* directory, or as an absolute path to any location on the file system.
*
*
* @param
array
$config
* @param
object
$config
* @return PDO
* @return PDO
*/
*/
private
static
function
connect_to_sqlite
(
$config
)
private
static
function
connect_to_sqlite
(
$config
)
...
@@ -67,7 +70,7 @@ class Connector {
...
@@ -67,7 +70,7 @@ class Connector {
/**
/**
* Connect to a MySQL or PostgreSQL database server.
* Connect to a MySQL or PostgreSQL database server.
*
*
* @param
array
$config
* @param
object
$config
* @return PDO
* @return PDO
*/
*/
private
static
function
connect_to_server
(
$config
)
private
static
function
connect_to_server
(
$config
)
...
@@ -89,6 +92,17 @@ class Connector {
...
@@ -89,6 +92,17 @@ class Connector {
return
$connection
;
return
$connection
;
}
}
/**
* Connect to an ODBC data source.
*
* @param object $config
* @return PDO
*/
private
static
function
connect_to_odbc
(
$config
)
{
return
new
\PDO
(
$config
->
dsn
,
$config
->
username
,
$config
->
password
,
static
::
$options
);
}
/**
/**
* Get the configuration options for a database connection.
* Get the configuration options for a database connection.
*
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment