FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
arraybase/src/Query.php at master · whizsid/arraybase · GitHub
whizsid
/
arraybase
Public
Notifications
You must be signed in to change notification settings
Fork
1
Star
18
Code
Issues
1
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
arraybase
/
src
/
Query.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
117 lines (100 loc) · 2.14 KB
Breadcrumbs
arraybase
/
src
/
Query.php
Copy path
File metadata and controls
117 lines (100 loc) · 2.14 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?php
namespace
WhizSid
\
ArrayBase
;
use
WhizSid
\
ArrayBase
\
AB
\
Table
;
use
WhizSid
\
ArrayBase
\
AB
\
Table
\
Column
;
use
WhizSid
\
ArrayBase
\
Query
\
Type
\
Delete
;
use
WhizSid
\
ArrayBase
\
Query
\
Type
\
Insert
;
use
WhizSid
\
ArrayBase
\
Query
\
Type
\
Select
;
use
WhizSid
\
ArrayBase
\
Query
\
Type
\
Update
;
class
Query
extends
KeepAB
{
protected
$
tables
= [];
/**
* Creating a selct query.
*
* @param Table $table
* @param Column ...$columns
*
* @return Select
*/
public
function
select
(
$
table
, ...
$
columns
)
{
$
query
=
new
Select
();
$
query
->
setQuery
(
$
this
)
->
setAB
(
$
this
->
ab
)
->
setFrom
(
$
table
)
->
setColumns
(...
$
columns
);
return
$
query
;
}
/**
* Creating a insert query.
*
* @return Insert
*/
public
function
insert
()
{
$
query
=
new
Insert
();
$
query
->
setAB
(
$
this
->
ab
)
->
setQuery
(
$
this
);
return
$
query
;
}
/**
* Making a update query.
*
* @param Table $table
*
* @return Update
*/
public
function
update
(
$
table
)
{
$
query
=
new
Update
();
$
query
->
setTable
(
$
table
)
->
setQuery
(
$
this
)
->
setAB
(
$
this
->
ab
);
return
$
query
;
}
/**
* Creating a new delete query.
*
* @param Table $from
*
* @return Delete
*/
public
function
delete
(
$
from
)
{
$
query
=
new
Delete
();
$
query
->
setFrom
(
$
from
)
->
setQuery
(
$
this
)
->
setAB
(
$
this
->
ab
);
return
$
query
;
}
/**
* Adding a new table to the query.
*
* @param Table $table
*
* @return void
*/
public
function
addTable
(
$
table
)
{
$
this
->
tables
[
$
table
->
getName
()] =
$
table
;
}
/**
* Returning the table by name.
*
* @param string $name
*
* @return Table
*/
public
function
__get
(
$
name
)
{
if
(!
isset
(
$
this
->
tables
[
$
name
])) {
// <ABE16> \\
throw
new
ABException
(
'
Table is not in the query scope
'
,
16
);
}
return
$
this
->
tables
[
$
name
];
}
}
Back
|
FazBrowse Home
|
New Git URL