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 {
if
(
isset
(
$config
[
'charset'
]))
{
$connection
->
prepare
(
"SET NAMES '
{
$c
harset
}
'"
)
->
execute
();
$connection
->
prepare
(
"SET NAMES '
{
$c
onfig
[
'charset'
]
}
'"
)
->
execute
();
}
return
$connection
;
...
...
laravel/database/connectors/postgres.php
View file @
3507d153
...
...
@@ -32,7 +32,7 @@ class Postgres extends Connector {
if
(
isset
(
$config
[
'charset'
]))
{
$connection
->
prepare
(
"SET NAMES '
{
$c
harset
}
'"
)
->
execute
();
$connection
->
prepare
(
"SET NAMES '
{
$c
onfig
[
'charset'
]
}
'"
)
->
execute
();
}
return
$connection
;
...
...
laravel/database/query.php
View file @
3507d153
...
...
@@ -157,6 +157,7 @@ class Query {
call_user_func
(
$column1
,
end
(
$this
->
joins
));
}
// 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
// add the clause automatically for the develoepr.
...
...
@@ -648,15 +649,18 @@ class Query {
*/
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'
);
$sql
=
$this
->
grammar
->
select
(
$this
);
$result
=
$this
->
connection
->
only
(
$sql
,
$this
->
bindings
);
// Reset the aggregate so more queries can be performed using
//
the same instance. This is helpful for getting aggregates
// a
nd then getting actual results from the query
.
// Reset the aggregate so more queries can be performed using
the same
//
instance. This is helpful for getting aggregates and then getting
// a
ctual results from the query such as during paging
.
$this
->
aggregate
=
null
;
return
$result
;
...
...
@@ -673,8 +677,7 @@ class Query {
{
// Because some database engines may throw errors if we leave orderings
// 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
// retrieved the count from the table.
// all of the ordreings and put them back on the query.
list
(
$orderings
,
$this
->
orderings
)
=
array
(
$this
->
orderings
,
null
);
$total
=
$this
->
count
(
reset
(
$columns
));
...
...
@@ -685,8 +688,7 @@ class Query {
// 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
// a convenient way to set the limit and offset so we get the correct
// span of results from the table.
// a convenient way to set the paging limit and offset.
$results
=
$this
->
for_page
(
$page
,
$per_page
)
->
get
(
$columns
);
return
Paginator
::
make
(
$results
,
$total
,
$per_page
);
...
...
@@ -773,10 +775,12 @@ class Query {
*/
protected
function
adjust
(
$column
,
$amount
,
$operator
)
{
// To make the adjustment to the column, we'll wrap the expression
// in an Expression instance, which forces the adjustment to be
// injected into the query as a string instead of bound.
$value
=
Database
::
raw
(
$this
->
grammar
->
wrap
(
$column
)
.
$operator
.
$amount
);
$wrapped
=
$this
->
grammar
->
wrap
(
$column
);
// To make the adjustment to the column, we'll wrap the expression in
// 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
));
}
...
...
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