Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
X Lib
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
XLibs
X Lib
Commits
117dd97a
Commit
117dd97a
authored
Jul 24, 2016
by
Alex Ne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
+ удалялка. и свое исключение на ошибку запросов
parent
a63cf7f8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
13 deletions
+23
-13
MySQLi.php
DB/MySQLi.php
+2
-1
TableItem.php
DB/TableItem.php
+21
-12
No files found.
DB/MySQLi.php
View file @
117dd97a
<?php
class
XDatabaseParamError
extends
\X\ETrace\System
{}
class
XDatabaseQueryError
extends
\X\ETrace\System
{}
class
X_DB_MySQLi
{
/**
...
...
@@ -267,7 +268,7 @@ class X_DB_MySQLi {
if
(
self
::
$LINK
[
$this
->
Connect
()
->
DBLN
]
->
real_query
(
$SQL
))
{
return
true
;
}
else
{
throw
new
Exception
(
self
::
$LINK
[
$this
->
DBLN
]
->
error
,
self
::
$LINK
[
$this
->
DBLN
]
->
errno
);
throw
new
XDatabaseQueryError
(
self
::
$LINK
[
$this
->
DBLN
]
->
error
,
self
::
$LINK
[
$this
->
DBLN
]
->
errno
,
[
"SQL"
=>
$SQL
,
"CLASS"
=>
$this
]
);
}
}
...
...
DB/TableItem.php
View file @
117dd97a
...
...
@@ -39,7 +39,7 @@ class TableItem {
}
/**
* @param $Data
* @param
$Data
* @return mixed
*/
public
function
insert
(
$Data
)
{
...
...
@@ -49,7 +49,7 @@ class TableItem {
}
/**
* @param $Data
* @param
$Data
* @return mixed
*/
public
function
replace
(
$Data
)
{
...
...
@@ -104,8 +104,14 @@ class TableItem {
return
$this
;
}
public
function
delete
()
{
$this
->
sql_type
=
"delete"
;
$this
->
sql
=
"DELETE FROM `
{
$this
->
table_name
}
`"
;
return
$this
;
}
/**
* @param $data
* @param
$data
* @return mixed
*/
public
function
where
(
$data
)
{
...
...
@@ -114,9 +120,9 @@ class TableItem {
}
/**
* @param $data
* @param $operator
* @param
false
$gr
* @param
$data
* @param
$operator
* @param
false
$gr
* @return mixed
*/
private
function
where_clause
(
$data
,
$operator
=
false
,
$gr
=
false
)
{
...
...
@@ -293,7 +299,7 @@ class TableItem {
}
/**
* @param $data
* @param
$data
* @return mixed
*/
private
function
escape
(
$data
)
{
...
...
@@ -310,9 +316,9 @@ class TableItem {
}
/**
* @param $op1
* @param
false
$op2
* @param
false
$op3
* @param
$op1
* @param
false
$op2
* @param
false
$op3
* @return mixed
*/
public
function
exec
(
$op1
=
false
,
$op2
=
false
,
$op3
=
false
)
{
...
...
@@ -326,9 +332,12 @@ class TableItem {
if
(
$this
->
sql_type
==
"select"
&&
$this
->
driver
instanceof
\X_DB_MySQLi
)
{
return
$this
->
driver
->
get
(
$this
->
sql
.
$this
->
sql_where
.
$this
->
sql_order
.
$this
->
sql_limit
,
$op1
,
$op2
,
$op3
);
}
else
{
throw
new
\Exception
(
"Internal error"
,
0
);
}
if
(
$this
->
sql_type
==
"delete"
&&
$this
->
driver
instanceof
\X_DB_MySQLi
)
{
return
$this
->
driver
->
rq
(
$this
->
sql
.
$this
->
sql_where
);
}
throw
new
\Exception
(
"Internal error"
,
0
);
}
}
?>
\ 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