FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
database/Query/Processors/PostgresProcessor.php at master · fwling/database · GitHub
fwling
database
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
database
/
Query
/
Processors
/
PostgresProcessor.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
41 lines (34 loc) · 1.02 KB
Breadcrumbs
database
/
Query
/
Processors
/
PostgresProcessor.php
Copy path
File metadata and controls
executable file
·
41 lines (34 loc) · 1.02 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
namespace
Illuminate
\
Database
\
Query
\
Processors
;
use
Illuminate
\
Database
\
Query
\
Builder
;
class
PostgresProcessor
extends
Processor
{
/**
* Process an "insert get ID" query.
*
* @param \Illuminate\Database\Query\Builder $query
* @param string $sql
* @param array $values
* @param string $sequence
* @return int
*/
public
function
processInsertGetId
(
Builder
$
query
,
$
sql
,
$
values
,
$
sequence
=
null
)
{
$
result
=
$
query
->
getConnection
()->
selectFromWriteConnection
(
$
sql
,
$
values
)[
0
];
$
sequence
=
$
sequence
?:
'
id
'
;
$
id
=
is_object
(
$
result
) ?
$
result
->{
$
sequence
} :
$
result
[
$
sequence
];
return
is_numeric
(
$
id
) ? (
int
)
$
id
:
$
id
;
}
/**
* Process the results of a column listing query.
*
* @param array $results
* @return array
*/
public
function
processColumnListing
(
$
results
)
{
return
array_map
(
function
(
$
result
) {
return
((
object
)
$
result
)->
column_name
;
},
$
results
);
}
}
Back
|
FazBrowse Home
|
New Git URL