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
3507d153
Commit
3507d153
authored
Feb 17, 2012
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix charset in mysql and pgsql connectors.
parent
bf6313e5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
13 deletions
+17
-13
mysql.php
laravel/database/connectors/mysql.php
+1
-1
postgres.php
laravel/database/connectors/postgres.php
+1
-1
query.php
laravel/database/query.php
+15
-11
No files found.
laravel/database/connectors/mysql.php
View file @
3507d153
...
@@ -32,7 +32,7 @@ class MySQL extends Connector {
...
@@ -32,7 +32,7 @@ class MySQL extends Connector {
if
(
isset
(
$config
[
'charset'
]))
if
(
isset
(
$config
[
'charset'
]))
{
{
$connection
->
prepare
(
"SET NAMES '
{
$c
harset
}
'"
)
->
execute
();
$connection
->
prepare
(
"SET NAMES '
{
$c
onfig
[
'charset'
]
}
'"
)
->
execute
();
}
}
return
$connection
;
return
$connection
;
...
...
laravel/database/connectors/postgres.php
View file @
3507d153
...
@@ -32,7 +32,7 @@ class Postgres extends Connector {
...
@@ -32,7 +32,7 @@ class Postgres extends Connector {
if
(
isset
(
$config
[
'charset'
]))
if
(
isset
(
$config
[
'charset'
]))
{
{
$connection
->
prepare
(
"SET NAMES '
{
$c
harset
}
'"
)
->
execute
();
$connection
->
prepare
(
"SET NAMES '
{
$c
onfig
[
'charset'
]
}
'"
)
->
execute
();
}
}
return
$connection
;
return
$connection
;
...
...
laravel/database/query.php
View file @
3507d153
...
@@ -157,6 +157,7 @@ class Query {
...
@@ -157,6 +157,7 @@ class Query {
call_user_func
(
$column1
,
end
(
$this
->
joins
));
call_user_func
(
$column1
,
end
(
$this
->
joins
));
}
}
// If the column is just a string, we can assume that the join just
// If the column is just a string, we can assume that the join just
// has a simple on clause, and we'll create the join instance and
// has a simple on clause, and we'll create the join instance and
// add the clause automatically for the develoepr.
// add the clause automatically for the develoepr.
...
@@ -648,15 +649,18 @@ class Query {
...
@@ -648,15 +649,18 @@ class Query {
*/
*/
public
function
aggregate
(
$aggregator
,
$columns
)
public
function
aggregate
(
$aggregator
,
$columns
)
{
{
// We'll set the aggregate value so the grammar does not try to compile
// a SELECT clause on the query. If an aggregator is present, it's own
// grammar function will be used to build the SQL syntax.
$this
->
aggregate
=
compact
(
'aggregator'
,
'columns'
);
$this
->
aggregate
=
compact
(
'aggregator'
,
'columns'
);
$sql
=
$this
->
grammar
->
select
(
$this
);
$sql
=
$this
->
grammar
->
select
(
$this
);
$result
=
$this
->
connection
->
only
(
$sql
,
$this
->
bindings
);
$result
=
$this
->
connection
->
only
(
$sql
,
$this
->
bindings
);
// Reset the aggregate so more queries can be performed using
// Reset the aggregate so more queries can be performed using
the same
//
the same instance. This is helpful for getting aggregates
//
instance. This is helpful for getting aggregates and then getting
// a
nd then getting actual results from the query
.
// a
ctual results from the query such as during paging
.
$this
->
aggregate
=
null
;
$this
->
aggregate
=
null
;
return
$result
;
return
$result
;
...
@@ -673,8 +677,7 @@ class Query {
...
@@ -673,8 +677,7 @@ class Query {
{
{
// Because some database engines may throw errors if we leave orderings
// Because some database engines may throw errors if we leave orderings
// on the query when retrieving the total number of records, we'll drop
// on the query when retrieving the total number of records, we'll drop
// all of the ordreings and put them back on the query after we have
// all of the ordreings and put them back on the query.
// retrieved the count from the table.
list
(
$orderings
,
$this
->
orderings
)
=
array
(
$this
->
orderings
,
null
);
list
(
$orderings
,
$this
->
orderings
)
=
array
(
$this
->
orderings
,
null
);
$total
=
$this
->
count
(
reset
(
$columns
));
$total
=
$this
->
count
(
reset
(
$columns
));
...
@@ -685,8 +688,7 @@ class Query {
...
@@ -685,8 +688,7 @@ class Query {
// Now we're ready to get the actual pagination results from the table
// Now we're ready to get the actual pagination results from the table
// using the for_page and get methods. The "for_page" method provides
// using the for_page and get methods. The "for_page" method provides
// a convenient way to set the limit and offset so we get the correct
// a convenient way to set the paging limit and offset.
// span of results from the table.
$results
=
$this
->
for_page
(
$page
,
$per_page
)
->
get
(
$columns
);
$results
=
$this
->
for_page
(
$page
,
$per_page
)
->
get
(
$columns
);
return
Paginator
::
make
(
$results
,
$total
,
$per_page
);
return
Paginator
::
make
(
$results
,
$total
,
$per_page
);
...
@@ -773,10 +775,12 @@ class Query {
...
@@ -773,10 +775,12 @@ class Query {
*/
*/
protected
function
adjust
(
$column
,
$amount
,
$operator
)
protected
function
adjust
(
$column
,
$amount
,
$operator
)
{
{
// To make the adjustment to the column, we'll wrap the expression
$wrapped
=
$this
->
grammar
->
wrap
(
$column
);
// in an Expression instance, which forces the adjustment to be
// injected into the query as a string instead of bound.
// To make the adjustment to the column, we'll wrap the expression in
$value
=
Database
::
raw
(
$this
->
grammar
->
wrap
(
$column
)
.
$operator
.
$amount
);
// an Expression instance, which forces the adjustment to be injected
// into the query as a string instead of bound.
$value
=
Database
::
raw
(
$wrapped
.
$operator
.
$amount
);
return
$this
->
update
(
array
(
$column
=>
$value
));
return
$this
->
update
(
array
(
$column
=>
$value
));
}
}
...
...
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