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
15449c34
Commit
15449c34
authored
Sep 14, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring database layer.
parent
277729ed
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
4 additions
and
109 deletions
+4
-109
connection.php
laravel/database/connection.php
+0
-37
grammar.php
laravel/database/grammars/grammar.php
+2
-2
mysql.php
laravel/database/grammars/mysql.php
+1
-1
manager.php
laravel/database/manager.php
+1
-28
postgres.php
laravel/database/queries/grammars/postgres.php
+0
-19
postgres.php
laravel/database/queries/postgres.php
+0
-22
No files found.
laravel/database/connection.php
View file @
15449c34
...
...
@@ -30,14 +30,6 @@ class Connection {
/**
* Execute a SQL query against the connection and return a scalar result.
*
* <code>
* // Get the number of rows in the "users" table
* $count = DB::connection()->scalar('select count(*) from users');
*
* // Get the sum of payments from the "bank" table
* $sum = DB::connection()->scalar('select sum(payment) from banks where bank_id = ?', array(1));
* </code>
*
* @param string $sql
* @param array $bindings
* @return int|float
...
...
@@ -52,14 +44,6 @@ class Connection {
/**
* Execute a SQL query against the connection and return the first result.
*
* <code>
* // Get the first result from the "users" table
* $user = DB::connection()->first('select * from users limit 1');
*
* // Get the first result from a specified group of users
* $user = DB::connection()->first('select * from users where group_id = ?', array(1));
* </code>
*
* @param string $sql
* @param array $bindings
* @return object
...
...
@@ -79,14 +63,6 @@ class Connection {
* DELETE -> Number of Rows affected.
* ELSE -> Boolean true / false depending on success.
*
* <code>
* // Execute a query against the connection
* $users = DB::connection()->query('select * from users');
*
* // Execute a query against the connection using bindings
* $users = DB::connection()->query('select * from users where group_id = ?', array(1));
* </code>
*
* @param string $sql
* @param array $bindings
* @return mixed
...
...
@@ -124,14 +100,6 @@ class Connection {
/**
* Begin a fluent query against a table.
*
* <code>
* // Begin a fluent query against the "users" table
* $query = DB::connection()->table('users');
*
* // Retrieve an entire table using a fluent query
* $users = DB::connection()->table('users')->get();
* </code>
*
* @param string $table
* @return Query
*/
...
...
@@ -172,11 +140,6 @@ class Connection {
/**
* Magic Method for dynamically beginning queries on database tables.
*
* <code>
* // Begin a query against the "users" table
* $query = DB::connection()->users();
* </code>
*/
public
function
__call
(
$method
,
$parameters
)
{
...
...
laravel/database/
queries/
grammars/grammar.php
→
laravel/database/grammars/grammar.php
View file @
15449c34
<?php
namespace
Laravel\Database\
Query\
Grammars
;
<?php
namespace
Laravel\Database\Grammars
;
use
Laravel\Database\Quer
ies\Quer
y
;
use
Laravel\Database\Query
;
class
Grammar
{
...
...
laravel/database/
queries/
grammars/mysql.php
→
laravel/database/grammars/mysql.php
View file @
15449c34
<?php
namespace
Laravel\Database\
Query\
Grammars
;
<?php
namespace
Laravel\Database\Grammars
;
class
MySQL
extends
Grammar
{
...
...
laravel/database/manager.php
View file @
15449c34
...
...
@@ -15,10 +15,7 @@ class Manager {
* @param array $config
* @return void
*/
public
function
__construct
(
$config
)
{
$this
->
config
=
$config
;
}
public
function
__construct
(
$config
)
{
$this
->
config
=
$config
;
}
/**
* Get a database connection.
...
...
@@ -28,14 +25,6 @@ class Manager {
*
* Note: Database connections are managed as singletons.
*
* <code>
* // Get the default database connection
* $connection = DB::connection();
*
* // Get a database connection by name
* $connection = DB::connection('slave');
* </code>
*
* @param string $connection
* @return Database\Connection
*/
...
...
@@ -63,14 +52,6 @@ class Manager {
/**
* Begin a fluent query against a table.
*
* <code>
* // Begin a fluent query against the "users" table using the default connection
* $query = DB::table('users');
*
* // Begin a fluent query against the "users" table using a specified connection
* $query = DB::table('users', 'slave');
* </code>
*
* @param string $table
* @param string $connection
* @return Queries\Query
...
...
@@ -84,14 +65,6 @@ class Manager {
* Magic Method for calling methods on the default database connection.
*
* This provides a convenient API for querying or examining the default database connection.
*
* <code>
* // Perform a query against the default connection
* $results = DB::query('select * from users');
*
* // Get the name of the PDO driver being used by the default connection
* $driver = DB::driver();
* </code>
*/
public
function
__call
(
$method
,
$parameters
)
{
...
...
laravel/database/queries/grammars/postgres.php
deleted
100644 → 0
View file @
277729ed
<?php
namespace
Laravel\Database\Query\Grammars
;
use
Laravel\Database\Queries\Query
;
class
Postgres
extends
Grammar
{
/**
* Compile a SQL INSERT statment that returns an auto-incrementing ID from a Query instance.
*
* @param Query $query
* @param array $values
* @return string
*/
public
function
insert_get_id
(
Query
$query
,
$values
)
{
return
$this
->
insert
(
$query
,
$values
)
.
' RETURNING '
.
$this
->
wrap
(
'id'
);
}
}
\ No newline at end of file
laravel/database/queries/postgres.php
deleted
100644 → 0
View file @
277729ed
<?php
namespace
Laravel\Database\Queries
;
use
PDO
;
class
Postgres
extends
Query
{
/**
* Insert an array of values into the database table and return the value of the ID column.
*
* @param array $values
* @return int
*/
public
function
insert_get_id
(
$values
)
{
$query
=
$this
->
connection
->
pdo
->
prepare
(
$this
->
grammar
->
insert_get_id
(
$this
,
$values
));
$query
->
execute
(
array_values
(
$values
));
return
(
int
)
$query
->
fetch
(
PDO
::
FETCH_CLASS
,
'stdClass'
)
->
id
;
}
}
\ No newline at end of file
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