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
0f2d3117
Commit
0f2d3117
authored
Feb 12, 2012
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleaning up some code.
parent
aed1443b
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
44 additions
and
48 deletions
+44
-48
connection.php
laravel/database/connection.php
+1
-2
query.php
laravel/database/query.php
+2
-3
schema.php
laravel/database/schema.php
+12
-14
mysql.php
laravel/database/schema/grammars/mysql.php
+9
-9
postgres.php
laravel/database/schema/grammars/postgres.php
+6
-6
sqlite.php
laravel/database/schema/grammars/sqlite.php
+6
-6
sqlserver.php
laravel/database/schema/grammars/sqlserver.php
+6
-6
response.php
laravel/response.php
+1
-1
view.php
laravel/view.php
+1
-1
No files found.
laravel/database/connection.php
View file @
0f2d3117
...
@@ -222,8 +222,7 @@ class Connection {
...
@@ -222,8 +222,7 @@ class Connection {
// Once we have execute the query, we log the SQL, bindings, and
// Once we have execute the query, we log the SQL, bindings, and
// execution time in a static array that is accessed by all of
// execution time in a static array that is accessed by all of
// the connections used by the application. This allows us to
// the connections used by the application.
// review all of the executed SQL.
$this
->
log
(
$sql
,
$bindings
,
$time
);
$this
->
log
(
$sql
,
$bindings
,
$time
);
return
array
(
$statement
,
$result
);
return
array
(
$statement
,
$result
);
...
...
laravel/database/query.php
View file @
0f2d3117
...
@@ -399,7 +399,7 @@ class Query {
...
@@ -399,7 +399,7 @@ class Query {
// To handle a nested where statement, we will actually instantiate a
// To handle a nested where statement, we will actually instantiate a
// new Query instance and run the callback over that instance, which
// new Query instance and run the callback over that instance, which
// will allow the developer to have a fresh query
to work with
.
// will allow the developer to have a fresh query.
$query
=
new
Query
(
$this
->
connection
,
$this
->
grammar
,
$this
->
from
);
$query
=
new
Query
(
$this
->
connection
,
$this
->
grammar
,
$this
->
from
);
// Once the callback has been run on the query, we will store the
// Once the callback has been run on the query, we will store the
...
@@ -623,8 +623,7 @@ class Query {
...
@@ -623,8 +623,7 @@ class Query {
// If the query has an offset and we are using the SQL Server grammar,
// If the query has an offset and we are using the SQL Server grammar,
// we need to spin through the results and remove the "rownum" from
// we need to spin through the results and remove the "rownum" from
// each of the objects. Unfortunately SQL Server does not have an
// each of the objects since there is no "offset".
// offset keyword, so we have to use row numbers in the query.
if
(
$this
->
offset
>
0
and
$this
->
grammar
instanceof
SQLServer
)
if
(
$this
->
offset
>
0
and
$this
->
grammar
instanceof
SQLServer
)
{
{
array_walk
(
$results
,
function
(
$result
)
array_walk
(
$results
,
function
(
$result
)
...
...
laravel/database/schema.php
View file @
0f2d3117
...
@@ -35,17 +35,16 @@ class Schema {
...
@@ -35,17 +35,16 @@ class Schema {
$grammar
=
static
::
grammar
(
$connection
);
$grammar
=
static
::
grammar
(
$connection
);
// Each grammar has a function that corresponds to the command type
// Each grammar has a function that corresponds to the command type and is for
// and is responsible for building that's commands SQL. This lets
// building that command's SQL. This lets the SQL generation stay granular
// the SQL generation stay very granular and makes it simply to
// and flexible across various database systems.
// add new database systems to the schema system.
if
(
method_exists
(
$grammar
,
$method
=
$command
->
type
))
if
(
method_exists
(
$grammar
,
$method
=
$command
->
type
))
{
{
$statements
=
$grammar
->
$method
(
$table
,
$command
);
$statements
=
$grammar
->
$method
(
$table
,
$command
);
// Once we have the statements, we will cast them to an array
// Once we have the statements, we will cast them to an array
even though
//
even though not all of the commands return an array just
//
not all of the commands return an array just in case the command
//
in case the command needs to run more than one query
.
//
needs multiple queries to complete its database work
.
foreach
((
array
)
$statements
as
$statement
)
foreach
((
array
)
$statements
as
$statement
)
{
{
$connection
->
statement
(
$statement
);
$connection
->
statement
(
$statement
);
...
@@ -62,10 +61,9 @@ class Schema {
...
@@ -62,10 +61,9 @@ class Schema {
*/
*/
protected
static
function
implications
(
$table
)
protected
static
function
implications
(
$table
)
{
{
// If the developer has specified columns for the table and the
// If the developer has specified columns for the table and the table is
// table is not being created, we will assume they simply want
// not being created, we'll assume they simply want to add the columns
// to add the columns to the table, and will generate an add
// to the table and generate the add command.
// command on the schema automatically.
if
(
count
(
$table
->
columns
)
>
0
and
!
$table
->
creating
())
if
(
count
(
$table
->
columns
)
>
0
and
!
$table
->
creating
())
{
{
$command
=
new
Fluent
(
array
(
'type'
=>
'add'
));
$command
=
new
Fluent
(
array
(
'type'
=>
'add'
));
...
@@ -73,9 +71,9 @@ class Schema {
...
@@ -73,9 +71,9 @@ class Schema {
array_unshift
(
$table
->
commands
,
$command
);
array_unshift
(
$table
->
commands
,
$command
);
}
}
// For some extra syntax sugar, we'll check for any implicit
// For some extra syntax sugar, we'll check for any implicit
indexes
//
indexes on the table since the developer may specify the
//
on the table since the developer may specify the index type on
//
index type on the fluent column declaration
.
//
the fluent column declaration for convenience
.
foreach
(
$table
->
columns
as
$column
)
foreach
(
$table
->
columns
as
$column
)
{
{
foreach
(
array
(
'primary'
,
'unique'
,
'fulltext'
,
'index'
)
as
$key
)
foreach
(
array
(
'primary'
,
'unique'
,
'fulltext'
,
'index'
)
as
$key
)
...
...
laravel/database/schema/grammars/mysql.php
View file @
0f2d3117
...
@@ -23,14 +23,14 @@ class MySQL extends Grammar {
...
@@ -23,14 +23,14 @@ class MySQL extends Grammar {
{
{
$columns
=
implode
(
', '
,
$this
->
columns
(
$table
));
$columns
=
implode
(
', '
,
$this
->
columns
(
$table
));
// First we will generate the base table creation statement. Other than
incrementing
// First we will generate the base table creation statement. Other than
auto
//
keys, no indexes will be created during the first creation of the table since
//
incrementing keys, no indexes will be created during the first creation
//
they will b
e added in separate commands.
//
of the table as they'r
e added in separate commands.
$sql
=
'CREATE TABLE '
.
$this
->
wrap
(
$table
)
.
' ('
.
$columns
.
')'
;
$sql
=
'CREATE TABLE '
.
$this
->
wrap
(
$table
)
.
' ('
.
$columns
.
')'
;
// MySQL supports various "engines" for database tables. If an engine w
s specified
// MySQL supports various "engines" for database tables. If an engine w
as
//
by the developer, we will set it after adding the columns the table creation
//
specified by the developer, we will set it after adding the columns
//
statement. Some engines support extra indexes
.
//
the table creation statement the schema
.
if
(
!
is_null
(
$table
->
engine
))
if
(
!
is_null
(
$table
->
engine
))
{
{
$sql
.=
' ENGINE = '
.
$table
->
engine
;
$sql
.=
' ENGINE = '
.
$table
->
engine
;
...
@@ -50,9 +50,9 @@ class MySQL extends Grammar {
...
@@ -50,9 +50,9 @@ class MySQL extends Grammar {
{
{
$columns
=
$this
->
columns
(
$table
);
$columns
=
$this
->
columns
(
$table
);
// Once we the array of column definitions, we need to add "add" to the
front
// Once we the array of column definitions, we need to add "add" to the
//
of each definition, then we'll concatenate the definitions using comma
s
//
front of each definition, then we'll concatenate the definition
s
// like normal and generate the SQL.
//
using commas
like normal and generate the SQL.
$columns
=
implode
(
', '
,
array_map
(
function
(
$column
)
$columns
=
implode
(
', '
,
array_map
(
function
(
$column
)
{
{
return
'ADD '
.
$column
;
return
'ADD '
.
$column
;
...
...
laravel/database/schema/grammars/postgres.php
View file @
0f2d3117
...
@@ -16,9 +16,9 @@ class Postgres extends Grammar {
...
@@ -16,9 +16,9 @@ class Postgres extends Grammar {
{
{
$columns
=
implode
(
', '
,
$this
->
columns
(
$table
));
$columns
=
implode
(
', '
,
$this
->
columns
(
$table
));
// First we will generate the base table creation statement. Other than
incrementing
// First we will generate the base table creation statement. Other than
auto
//
keys, no indexes will be created during the first creation of the table since
//
incrementing keys, no indexes will be created during the first creation
//
they will b
e added in separate commands.
//
of the table as they'r
e added in separate commands.
$sql
=
'CREATE TABLE '
.
$this
->
wrap
(
$table
)
.
' ('
.
$columns
.
')'
;
$sql
=
'CREATE TABLE '
.
$this
->
wrap
(
$table
)
.
' ('
.
$columns
.
')'
;
return
$sql
;
return
$sql
;
...
@@ -35,9 +35,9 @@ class Postgres extends Grammar {
...
@@ -35,9 +35,9 @@ class Postgres extends Grammar {
{
{
$columns
=
$this
->
columns
(
$table
);
$columns
=
$this
->
columns
(
$table
);
// Once we the array of column definitions, we need to add "add" to the
front
// Once we the array of column definitions, we need to add "add" to the
//
of each definition, then we'll concatenate the definitions using comma
s
//
front of each definition, then we'll concatenate the definition
s
// like normal and generate the SQL.
//
using commas
like normal and generate the SQL.
$columns
=
implode
(
', '
,
array_map
(
function
(
$column
)
$columns
=
implode
(
', '
,
array_map
(
function
(
$column
)
{
{
return
'ADD COLUMN '
.
$column
;
return
'ADD COLUMN '
.
$column
;
...
...
laravel/database/schema/grammars/sqlite.php
View file @
0f2d3117
...
@@ -53,18 +53,18 @@ class SQLite extends Grammar {
...
@@ -53,18 +53,18 @@ class SQLite extends Grammar {
{
{
$columns
=
$this
->
columns
(
$table
);
$columns
=
$this
->
columns
(
$table
);
// Once we the array of column definitions, we need to add "add" to the
front
// Once we the array of column definitions, we need to add "add" to the
//
of each definition, then we'll concatenate the definitions using comma
s
//
front of each definition, then we'll concatenate the definition
s
// like normal and generate the SQL.
//
using commas
like normal and generate the SQL.
$columns
=
array_map
(
function
(
$column
)
$columns
=
array_map
(
function
(
$column
)
{
{
return
'ADD COLUMN '
.
$column
;
return
'ADD COLUMN '
.
$column
;
},
$columns
);
},
$columns
);
// SQLite only allows one column to be added in an ALTER statement,
so we
// SQLite only allows one column to be added in an ALTER statement,
//
will create an array of statements and return them all to the schema
//
so we will create an array of statements and return them all to
//
manager, which will execute each one separately
.
//
the schema manager for separate execution
.
foreach
(
$columns
as
$column
)
foreach
(
$columns
as
$column
)
{
{
$sql
[]
=
'ALTER TABLE '
.
$this
->
wrap
(
$table
)
.
' '
.
$column
;
$sql
[]
=
'ALTER TABLE '
.
$this
->
wrap
(
$table
)
.
' '
.
$column
;
...
...
laravel/database/schema/grammars/sqlserver.php
View file @
0f2d3117
...
@@ -23,9 +23,9 @@ class SQLServer extends Grammar {
...
@@ -23,9 +23,9 @@ class SQLServer extends Grammar {
{
{
$columns
=
implode
(
', '
,
$this
->
columns
(
$table
));
$columns
=
implode
(
', '
,
$this
->
columns
(
$table
));
// First we will generate the base table creation statement. Other than
incrementing
// First we will generate the base table creation statement. Other than
auto
//
keys, no indexes will be created during the first creation of the table since
//
incrementing keys, no indexes will be created during the first creation
//
they will b
e added in separate commands.
//
of the table as they'r
e added in separate commands.
$sql
=
'CREATE TABLE '
.
$this
->
wrap
(
$table
)
.
' ('
.
$columns
.
')'
;
$sql
=
'CREATE TABLE '
.
$this
->
wrap
(
$table
)
.
' ('
.
$columns
.
')'
;
return
$sql
;
return
$sql
;
...
@@ -42,9 +42,9 @@ class SQLServer extends Grammar {
...
@@ -42,9 +42,9 @@ class SQLServer extends Grammar {
{
{
$columns
=
$this
->
columns
(
$table
);
$columns
=
$this
->
columns
(
$table
);
// Once we the array of column definitions, we need to add "add" to the
front
// Once we the array of column definitions, we need to add "add" to the
//
of each definition, then we'll concatenate the definitions using comma
s
//
front of each definition, then we'll concatenate the definition
s
// like normal and generate the SQL.
//
using commas
like normal and generate the SQL.
$columns
=
implode
(
', '
,
array_map
(
function
(
$column
)
$columns
=
implode
(
', '
,
array_map
(
function
(
$column
)
{
{
return
'ADD '
.
$column
;
return
'ADD '
.
$column
;
...
...
laravel/response.php
View file @
0f2d3117
...
@@ -285,7 +285,7 @@ class Response {
...
@@ -285,7 +285,7 @@ class Response {
// Once the framework controlled headers have been sentm, we can
// Once the framework controlled headers have been sentm, we can
// simply iterate over the developer's headers and send each one
// simply iterate over the developer's headers and send each one
//
to the browser. Headers with the same name will be overriden
.
//
back to the browser for the response
.
foreach
(
$this
->
headers
as
$name
=>
$value
)
foreach
(
$this
->
headers
as
$name
=>
$value
)
{
{
header
(
"
{
$name
}
:
{
$value
}
"
,
true
);
header
(
"
{
$name
}
:
{
$value
}
"
,
true
);
...
...
laravel/view.php
View file @
0f2d3117
...
@@ -213,7 +213,7 @@ class View implements ArrayAccess {
...
@@ -213,7 +213,7 @@ class View implements ArrayAccess {
//
//
// Also, if the Blade view has expired or doesn't exist it will be
// Also, if the Blade view has expired or doesn't exist it will be
// re-compiled and placed in the view storage directory. The Blade
// re-compiled and placed in the view storage directory. The Blade
// views are re-compiled
each time the original view is changed
.
// views are re-compiled
the original view changes
.
if
(
strpos
(
$this
->
path
,
BLADE_EXT
)
!==
false
)
if
(
strpos
(
$this
->
path
,
BLADE_EXT
)
!==
false
)
{
{
$this
->
path
=
$this
->
compile
();
$this
->
path
=
$this
->
compile
();
...
...
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