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
fe0b4b28
Commit
fe0b4b28
authored
Feb 17, 2012
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleaning up code.
parent
33e49146
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
27 deletions
+28
-27
mysql.php
laravel/database/connectors/mysql.php
+13
-11
postgres.php
laravel/database/connectors/postgres.php
+8
-11
sqlserver.php
laravel/database/connectors/sqlserver.php
+1
-2
grammar.php
laravel/database/grammar.php
+4
-1
query.php
laravel/database/query.php
+2
-2
No files found.
laravel/database/connectors/mysql.php
View file @
fe0b4b28
...
@@ -12,24 +12,26 @@ class MySQL extends Connector {
...
@@ -12,24 +12,26 @@ class MySQL extends Connector {
{
{
extract
(
$config
);
extract
(
$config
);
// Format the initial MySQL PDO connection string. These options are required
// for every MySQL connection that is established. The connection strings
// have the following convention: "mysql:host=hostname;dbname=database"
$dsn
=
"mysql:host=
{
$host
}
;dbname=
{
$database
}
"
;
$dsn
=
"mysql:host=
{
$host
}
;dbname=
{
$database
}
"
;
//
Check for any optional MySQL PDO options. These options are not required
//
The developer has the freedom of specifying a port for the MySQL database
//
to establish a PDO connection; however, may be needed in certain server
//
or the default port (3306) will be used to make the connection by PDO.
//
or hosting environments used by the developer
.
//
The Unix socket may also be specified if necessary
.
foreach
(
array
(
'port'
,
'unix_socket'
)
as
$key
)
if
(
isset
(
$config
[
'port'
])
)
{
{
if
(
isset
(
$config
[
$key
]))
$dsn
.=
";port=
{
$config
[
'port'
]
}
"
;
{
}
$dsn
.=
";
{
$key
}
=
{
$config
[
$key
]
}
"
;
}
if
(
isset
(
$config
[
'unix_socket'
]))
{
$dsn
.=
";unix_socket=
{
$config
[
'unix_socket'
]
}
"
;
}
}
$connection
=
new
PDO
(
$dsn
,
$username
,
$password
,
$this
->
options
(
$config
));
$connection
=
new
PDO
(
$dsn
,
$username
,
$password
,
$this
->
options
(
$config
));
// If a character set has been specified, we'll execute a query against
// the database to set the correct character set. By default, this is
// set to UTF-8 which should be fine for most scenarios.
if
(
isset
(
$config
[
'charset'
]))
if
(
isset
(
$config
[
'charset'
]))
{
{
$connection
->
prepare
(
"SET NAMES '
{
$config
[
'charset'
]
}
'"
)
->
execute
();
$connection
->
prepare
(
"SET NAMES '
{
$config
[
'charset'
]
}
'"
)
->
execute
();
...
...
laravel/database/connectors/postgres.php
View file @
fe0b4b28
...
@@ -12,24 +12,21 @@ class Postgres extends Connector {
...
@@ -12,24 +12,21 @@ class Postgres extends Connector {
{
{
extract
(
$config
);
extract
(
$config
);
// Format the initial Postgres PDO connection string. These options are required
// for every Postgres connection that is established. The connection strings
// have the following convention: "pgsql:host=hostname;dbname=database"
$dsn
=
"pgsql:host=
{
$host
}
;dbname=
{
$database
}
"
;
$dsn
=
"pgsql:host=
{
$host
}
;dbname=
{
$database
}
"
;
//
Check for any optional Postgres PDO options. These options are not required
//
The developer has the freedom of specifying a port for the PostgresSQL
//
to establish a PDO connection; however, may be needed in certain server
//
database or the default port (5432) will be used by PDO to create the
//
or hosting environments used by
the developer.
//
connection to the database for
the developer.
foreach
(
array
(
'port'
)
as
$key
=>
$value
)
if
(
isset
(
$config
[
'port'
])
)
{
{
if
(
isset
(
$config
[
$key
]))
$dsn
.=
";port=
{
$config
[
'port'
]
}
"
;
{
$dsn
.=
";
{
$key
}
=
{
$value
}
"
;
}
}
}
$connection
=
new
PDO
(
$dsn
,
$username
,
$password
,
$this
->
options
(
$config
));
$connection
=
new
PDO
(
$dsn
,
$username
,
$password
,
$this
->
options
(
$config
));
// If a character set has been specified, we'll execute a query against
// the database to set the correct character set. By default, this is
// set to UTF-8 which should be fine for most scenarios.
if
(
isset
(
$config
[
'charset'
]))
if
(
isset
(
$config
[
'charset'
]))
{
{
$connection
->
prepare
(
"SET NAMES '
{
$config
[
'charset'
]
}
'"
)
->
execute
();
$connection
->
prepare
(
"SET NAMES '
{
$config
[
'charset'
]
}
'"
)
->
execute
();
...
...
laravel/database/connectors/sqlserver.php
View file @
fe0b4b28
...
@@ -26,8 +26,7 @@ class SQLServer extends Connector {
...
@@ -26,8 +26,7 @@ class SQLServer extends Connector {
// Format the SQL Server connection string. This connection string format can
// Format the SQL Server connection string. This connection string format can
// also be used to connect to Azure SQL Server databases. The port is defined
// also be used to connect to Azure SQL Server databases. The port is defined
// directly after the server name, so we'll create that and then create the
// directly after the server name, so we'll create that first.
// final DSN string to pass to PDO.
$port
=
(
isset
(
$port
))
?
','
.
$port
:
''
;
$port
=
(
isset
(
$port
))
?
','
.
$port
:
''
;
$dsn
=
"sqlsrv:Server=
{
$host
}{
$port
}
;Database=
{
$database
}
"
;
$dsn
=
"sqlsrv:Server=
{
$host
}{
$port
}
;Database=
{
$database
}
"
;
...
...
laravel/database/grammar.php
View file @
fe0b4b28
...
@@ -59,7 +59,10 @@ abstract class Grammar {
...
@@ -59,7 +59,10 @@ abstract class Grammar {
// Expressions should be injected into the query as raw strings so
// Expressions should be injected into the query as raw strings so
// so we do not want to wrap them in any way. We will just return
// so we do not want to wrap them in any way. We will just return
// the string value from the expression to be included.
// the string value from the expression to be included.
if
(
$value
instanceof
Expression
)
return
$value
->
get
();
if
(
$value
instanceof
Expression
)
{
return
$value
->
get
();
}
// If the value being wrapped contains a column alias, we need to
// If the value being wrapped contains a column alias, we need to
// wrap it a little differently as each segment must be wrapped
// wrap it a little differently as each segment must be wrapped
...
...
laravel/database/query.php
View file @
fe0b4b28
...
@@ -150,7 +150,7 @@ class Query {
...
@@ -150,7 +150,7 @@ class Query {
{
{
// If the "column" is really an instance of a Closure, the developer is
// If the "column" is really an instance of a Closure, the developer is
// trying to create a join with a complex "ON" clause. So, we will add
// trying to create a join with a complex "ON" clause. So, we will add
// the join, and then call the Closure with the join
.
// the join, and then call the Closure with the join
/
if
(
$column1
instanceof
Closure
)
if
(
$column1
instanceof
Closure
)
{
{
$this
->
joins
[]
=
new
Query\Join
(
$type
,
$table
);
$this
->
joins
[]
=
new
Query\Join
(
$type
,
$table
);
...
@@ -435,7 +435,7 @@ class Query {
...
@@ -435,7 +435,7 @@ class Query {
//
//
// The index variable helps us get the correct parameter value
// The index variable helps us get the correct parameter value
// for the where condition. We increment it each time we add
// for the where condition. We increment it each time we add
// a condition to the query.
// a condition to the query
's where
.
$connector
=
'AND'
;
$connector
=
'AND'
;
$index
=
0
;
$index
=
0
;
...
...
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