Passed
Push — master ( 7ff405...d0230e )
by Adrian
01:39
created
src/Statements/QueryUpdate.php 1 patch
Indentation   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -26,89 +26,89 @@
 block discarded – undo
26 26
 class QueryUpdate extends QueryStatement implements QueryStatementInterface
27 27
 {
28 28
 
29
-    use Limit, Where, WhereAndHavingBuilder, Replacement, OrderBy, SetFields, Ignore, DefaultPriority, LowPriority, Utilities;
30
-
31
-    /**
32
-     * @var string
33
-     */
34
-    protected $statement = self::QUERY_STATEMENT_UPDATE;
35
-
36
-
37
-    /**
38
-     * QueryUpdate constructor.
39
-     * @param QueryBuild $queryBuild
40
-     * @param string $table
41
-     */
42
-    public function __construct(QueryBuild $queryBuild, $table = null)
43
-    {
44
-        parent::__construct($queryBuild, $table);
45
-    }
46
-
47
-    public function getSyntax($replacement = self::REPLACEMENT_NONE)
48
-    {
49
-
50
-        $syntax = array();
51
-
52
-        /**
53
-         *  Explain
54
-         */
55
-        $syntax[] = $this->getExplainSyntax();
56
-
57
-        /**
58
-         * UPDATE statement
59
-         */
60
-        $syntax[] = $this->statement;
61
-
62
-        /**
63
-         * PRIORITY
64
-         */
65
-        $syntax[] = $this->queryStructure->getElement(QueryStructure::PRIORITY);
66
-
67
-        /**
68
-         * IGNORE clause
69
-         */
70
-        $syntax[] = $this->queryStructure->getElement(QueryStructure::IGNORE) ? 'IGNORE' : '';
71
-
72
-        /**
73
-         * TABLE update
74
-         */
75
-        $syntax[] = $this->queryStructure->getElement(QueryStructure::TABLE);
76
-
77
-        /**
78
-         * FIELDS update
79
-         */
80
-        $syntax[] = $this->getSettingFieldsSyntax();
81
-
82
-        /**
83
-         * WHERE clause
84
-         */
85
-        $syntax[] = $this->getWhereSyntax();
86
-
87
-        /**
88
-         * ORDER BY clause
89
-         */
90
-        $syntax[] = $this->getOrderBySyntax();
91
-
92
-        /**
93
-         * LIMIT clause
94
-         */
95
-        $syntax[] = $this->getLimitSyntax();
96
-
97
-        $syntax = implode(' ', $syntax);
98
-
99
-        return $this->getSyntaxReplace($syntax, $replacement);
100
-
101
-    }
102
-
103
-    /**
104
-     * @return array|int|null
105
-     * @throws QueryException
106
-     */
107
-    public function execute()
108
-    {
109
-        if ($this->queryStructure->getElement((QueryStructure::WHERE_TRIGGER)) && !count($this->queryStructure->getElement(QueryStructure::WHERE)))
110
-            throw new QueryException('Where clause is required for this statement!', QueryException::QUERY_ERROR_DELETE_NOT_FILTER);
111
-
112
-        return DbService::getInstance()->query($this->getSyntax(), $this->queryStructure->getElement(QueryStructure::BIND_PARAMS));
113
-    }
29
+	use Limit, Where, WhereAndHavingBuilder, Replacement, OrderBy, SetFields, Ignore, DefaultPriority, LowPriority, Utilities;
30
+
31
+	/**
32
+	 * @var string
33
+	 */
34
+	protected $statement = self::QUERY_STATEMENT_UPDATE;
35
+
36
+
37
+	/**
38
+	 * QueryUpdate constructor.
39
+	 * @param QueryBuild $queryBuild
40
+	 * @param string $table
41
+	 */
42
+	public function __construct(QueryBuild $queryBuild, $table = null)
43
+	{
44
+		parent::__construct($queryBuild, $table);
45
+	}
46
+
47
+	public function getSyntax($replacement = self::REPLACEMENT_NONE)
48
+	{
49
+
50
+		$syntax = array();
51
+
52
+		/**
53
+		 *  Explain
54
+		 */
55
+		$syntax[] = $this->getExplainSyntax();
56
+
57
+		/**
58
+		 * UPDATE statement
59
+		 */
60
+		$syntax[] = $this->statement;
61
+
62
+		/**
63
+		 * PRIORITY
64
+		 */
65
+		$syntax[] = $this->queryStructure->getElement(QueryStructure::PRIORITY);
66
+
67
+		/**
68
+		 * IGNORE clause
69
+		 */
70
+		$syntax[] = $this->queryStructure->getElement(QueryStructure::IGNORE) ? 'IGNORE' : '';
71
+
72
+		/**
73
+		 * TABLE update
74
+		 */
75
+		$syntax[] = $this->queryStructure->getElement(QueryStructure::TABLE);
76
+
77
+		/**
78
+		 * FIELDS update
79
+		 */
80
+		$syntax[] = $this->getSettingFieldsSyntax();
81
+
82
+		/**
83
+		 * WHERE clause
84
+		 */
85
+		$syntax[] = $this->getWhereSyntax();
86
+
87
+		/**
88
+		 * ORDER BY clause
89
+		 */
90
+		$syntax[] = $this->getOrderBySyntax();
91
+
92
+		/**
93
+		 * LIMIT clause
94
+		 */
95
+		$syntax[] = $this->getLimitSyntax();
96
+
97
+		$syntax = implode(' ', $syntax);
98
+
99
+		return $this->getSyntaxReplace($syntax, $replacement);
100
+
101
+	}
102
+
103
+	/**
104
+	 * @return array|int|null
105
+	 * @throws QueryException
106
+	 */
107
+	public function execute()
108
+	{
109
+		if ($this->queryStructure->getElement((QueryStructure::WHERE_TRIGGER)) && !count($this->queryStructure->getElement(QueryStructure::WHERE)))
110
+			throw new QueryException('Where clause is required for this statement!', QueryException::QUERY_ERROR_DELETE_NOT_FILTER);
111
+
112
+		return DbService::getInstance()->query($this->getSyntax(), $this->queryStructure->getElement(QueryStructure::BIND_PARAMS));
113
+	}
114 114
 }
115 115
\ No newline at end of file
Please login to merge, or discard this patch.
src/Statements/QueryInsert.php 1 patch
Indentation   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -23,81 +23,81 @@
 block discarded – undo
23 23
 class QueryInsert extends QueryStatement implements QueryStatementInterface
24 24
 {
25 25
 
26
-    use Replacement, SetFields, Ignore, DefaultPriority, LowPriority, HighPriority, Utilities;
27
-
28
-    /**
29
-     * @var string
30
-     */
31
-    protected $statement = self::QUERY_STATEMENT_INSERT;
32
-
33
-
34
-    /**
35
-     * QueryInsert constructor.
36
-     * @param QueryBuild $queryBuild
37
-     * @param string $table
38
-     */
39
-    public function __construct(QueryBuild $queryBuild, $table = null)
40
-    {
41
-        parent::__construct($queryBuild, $table);
42
-    }
43
-
44
-    /**
45
-     * @return QueryInsertMultiple
46
-     */
47
-    public function multiple()
48
-    {
49
-        return new QueryInsertMultiple($this->queryBuild, $this->queryStructure->getElement(QueryStructure::TABLE));
50
-    }
51
-
52
-    /**
53
-     * @param bool|int $replacement
54
-     * @return mixed|string
55
-     */
56
-    public function getSyntax($replacement = self::REPLACEMENT_NONE)
57
-    {
58
-        $syntax = array();
59
-
60
-        /**
61
-         *  Explain
62
-         */
63
-        $syntax[] = $this->getExplainSyntax();
64
-
65
-        /**
66
-         * UPDATE statement
67
-         */
68
-        $syntax[] = $this->statement;
69
-
70
-        /**
71
-         * PRIORITY
72
-         */
73
-        $syntax[] = $this->queryStructure->getElement(QueryStructure::PRIORITY);
74
-
75
-        /**
76
-         * IGNORE clause
77
-         */
78
-        $syntax[] = $this->queryStructure->getElement(QueryStructure::IGNORE) ? 'IGNORE' : '';
79
-
80
-        /**
81
-         * INTO table
82
-         */
83
-        $syntax[] = 'INTO ' . $this->queryStructure->getElement(QueryStructure::TABLE);
84
-
85
-        /**
86
-         * FIELDS update
87
-         */
88
-        $syntax[] = $this->getSettingFieldsSyntax();
89
-
90
-        $syntax = implode(' ', $syntax);
91
-
92
-        return $this->getSyntaxReplace($syntax, $replacement);
93
-
94
-    }
95
-
96
-
97
-    public function execute()
98
-    {
99
-        return DbService::getInstance()->query($this->getSyntax(), $this->queryStructure->getElement(QueryStructure::BIND_PARAMS));
100
-    }
26
+	use Replacement, SetFields, Ignore, DefaultPriority, LowPriority, HighPriority, Utilities;
27
+
28
+	/**
29
+	 * @var string
30
+	 */
31
+	protected $statement = self::QUERY_STATEMENT_INSERT;
32
+
33
+
34
+	/**
35
+	 * QueryInsert constructor.
36
+	 * @param QueryBuild $queryBuild
37
+	 * @param string $table
38
+	 */
39
+	public function __construct(QueryBuild $queryBuild, $table = null)
40
+	{
41
+		parent::__construct($queryBuild, $table);
42
+	}
43
+
44
+	/**
45
+	 * @return QueryInsertMultiple
46
+	 */
47
+	public function multiple()
48
+	{
49
+		return new QueryInsertMultiple($this->queryBuild, $this->queryStructure->getElement(QueryStructure::TABLE));
50
+	}
51
+
52
+	/**
53
+	 * @param bool|int $replacement
54
+	 * @return mixed|string
55
+	 */
56
+	public function getSyntax($replacement = self::REPLACEMENT_NONE)
57
+	{
58
+		$syntax = array();
59
+
60
+		/**
61
+		 *  Explain
62
+		 */
63
+		$syntax[] = $this->getExplainSyntax();
64
+
65
+		/**
66
+		 * UPDATE statement
67
+		 */
68
+		$syntax[] = $this->statement;
69
+
70
+		/**
71
+		 * PRIORITY
72
+		 */
73
+		$syntax[] = $this->queryStructure->getElement(QueryStructure::PRIORITY);
74
+
75
+		/**
76
+		 * IGNORE clause
77
+		 */
78
+		$syntax[] = $this->queryStructure->getElement(QueryStructure::IGNORE) ? 'IGNORE' : '';
79
+
80
+		/**
81
+		 * INTO table
82
+		 */
83
+		$syntax[] = 'INTO ' . $this->queryStructure->getElement(QueryStructure::TABLE);
84
+
85
+		/**
86
+		 * FIELDS update
87
+		 */
88
+		$syntax[] = $this->getSettingFieldsSyntax();
89
+
90
+		$syntax = implode(' ', $syntax);
91
+
92
+		return $this->getSyntaxReplace($syntax, $replacement);
93
+
94
+	}
95
+
96
+
97
+	public function execute()
98
+	{
99
+		return DbService::getInstance()->query($this->getSyntax(), $this->queryStructure->getElement(QueryStructure::BIND_PARAMS));
100
+	}
101 101
 
102 102
 
103 103
 }
104 104
\ No newline at end of file
Please login to merge, or discard this patch.
src/Statements/QueryInsertMultiple.php 1 patch
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -23,67 +23,67 @@
 block discarded – undo
23 23
 class QueryInsertMultiple extends QueryStatement implements QueryStatementInterface
24 24
 {
25 25
 
26
-    use InsertMultiple, Replacement, Ignore, DefaultPriority, LowPriority, HighPriority, Utilities;
27
-
28
-    /**
29
-     * @var string
30
-     */
31
-    protected $statement = self::QUERY_STATEMENT_INSERT;
32
-
33
-
34
-    /**
35
-     * QueryInsert constructor.
36
-     * @param QueryBuild $queryBuild
37
-     * @param string $table
38
-     */
39
-    public function __construct(QueryBuild $queryBuild, $table = null)
40
-    {
41
-        parent::__construct($queryBuild, $table);
42
-        $this->queryStructure->setElement(QueryStructure::FIELDS, array());
43
-    }
44
-
45
-    public function getSyntax($replacement = self::REPLACEMENT_NONE)
46
-    {
47
-        $syntax = array();
48
-
49
-        /**
50
-         *  Explain
51
-         */
52
-        $syntax[] = $this->getExplainSyntax();
53
-
54
-        /**
55
-         * UPDATE statement
56
-         */
57
-        $syntax[] = $this->statement;
58
-
59
-        /**
60
-         * PRIORITY
61
-         */
62
-        $syntax[] = $this->queryStructure->getElement(QueryStructure::PRIORITY);
63
-
64
-        /**
65
-         * IGNORE clause
66
-         */
67
-        $syntax[] = $this->queryStructure->getElement(QueryStructure::IGNORE) ? 'IGNORE' : '';
68
-
69
-        /**
70
-         * INTO table
71
-         */
72
-        $syntax[] = 'INTO ' . $this->queryStructure->getElement(QueryStructure::TABLE);
73
-
74
-        /**
75
-         * FIELDS update
76
-         */
77
-        $syntax[] = $this->getInsertMultipleRowsSyntax();
78
-
79
-        $syntax = implode(' ', $syntax);
80
-
81
-        return $this->getSyntaxReplace($syntax, $replacement);
82
-
83
-    }
84
-
85
-    public function execute()
86
-    {
87
-        return DbService::getInstance()->query($this->getSyntax(), $this->queryStructure->getElement(QueryStructure::BIND_PARAMS));
88
-    }
26
+	use InsertMultiple, Replacement, Ignore, DefaultPriority, LowPriority, HighPriority, Utilities;
27
+
28
+	/**
29
+	 * @var string
30
+	 */
31
+	protected $statement = self::QUERY_STATEMENT_INSERT;
32
+
33
+
34
+	/**
35
+	 * QueryInsert constructor.
36
+	 * @param QueryBuild $queryBuild
37
+	 * @param string $table
38
+	 */
39
+	public function __construct(QueryBuild $queryBuild, $table = null)
40
+	{
41
+		parent::__construct($queryBuild, $table);
42
+		$this->queryStructure->setElement(QueryStructure::FIELDS, array());
43
+	}
44
+
45
+	public function getSyntax($replacement = self::REPLACEMENT_NONE)
46
+	{
47
+		$syntax = array();
48
+
49
+		/**
50
+		 *  Explain
51
+		 */
52
+		$syntax[] = $this->getExplainSyntax();
53
+
54
+		/**
55
+		 * UPDATE statement
56
+		 */
57
+		$syntax[] = $this->statement;
58
+
59
+		/**
60
+		 * PRIORITY
61
+		 */
62
+		$syntax[] = $this->queryStructure->getElement(QueryStructure::PRIORITY);
63
+
64
+		/**
65
+		 * IGNORE clause
66
+		 */
67
+		$syntax[] = $this->queryStructure->getElement(QueryStructure::IGNORE) ? 'IGNORE' : '';
68
+
69
+		/**
70
+		 * INTO table
71
+		 */
72
+		$syntax[] = 'INTO ' . $this->queryStructure->getElement(QueryStructure::TABLE);
73
+
74
+		/**
75
+		 * FIELDS update
76
+		 */
77
+		$syntax[] = $this->getInsertMultipleRowsSyntax();
78
+
79
+		$syntax = implode(' ', $syntax);
80
+
81
+		return $this->getSyntaxReplace($syntax, $replacement);
82
+
83
+	}
84
+
85
+	public function execute()
86
+	{
87
+		return DbService::getInstance()->query($this->getSyntax(), $this->queryStructure->getElement(QueryStructure::BIND_PARAMS));
88
+	}
89 89
 }
90 90
\ No newline at end of file
Please login to merge, or discard this patch.
src/Statements/QueryStatement.php 1 patch
Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -18,71 +18,71 @@
 block discarded – undo
18 18
 abstract class QueryStatement
19 19
 {
20 20
 
21
-    use Utilities, TableValidation, ColumnValidation;
22
-
23
-
24
-    /**
25
-     * Statements
26
-     */
27
-    const QUERY_STATEMENT_SELECT = 'SELECT';
28
-    const QUERY_STATEMENT_UPDATE = 'UPDATE';
29
-    const QUERY_STATEMENT_DELETE = 'DELETE';
30
-    const QUERY_STATEMENT_INSERT = 'INSERT';
31
-    const QUERY_STATEMENT_CUSTOM = 'CUSTOM';
32
-
33
-
34
-    /**
35
-     * @var string
36
-     */
37
-    protected $statement;
38
-
39
-    /**
40
-     * @var QueryBuild
41
-     */
42
-    protected $queryBuild;
43
-
44
-    /**
45
-     * @var QueryStructure
46
-     */
47
-    protected $queryStructure;
48
-
49
-    /**
50
-     * @var array
51
-     */
52
-    protected $usedInstanceIds = [];
53
-
54
-    /**
55
-     * @var string
56
-     */
57
-    protected $tablePrefix;
58
-
59
-
60
-    /**
61
-     * QueryStatement constructor.
62
-     * @param QueryBuild $queryBuild
63
-     * @param string|QuerySelect $table
64
-     * @throws QueryException
65
-     */
66
-    public function __construct(QueryBuild $queryBuild, $table = '')
67
-    {
68
-
69
-        $table = $this->validateTable($table);
70
-
71
-        $this->queryBuild = $queryBuild;
72
-        $this->queryStructure = new QueryStructure();
73
-        $this->queryStructure->setElement(QueryStructure::TABLE, $table);
74
-        $this->queryStructure->setElement(QueryStructure::STATEMENT, $this->statement);
75
-        $this->queryStructure->setElement(QueryStructure::QUERY_TYPE, $this->queryBuild->getType());
76
-
77
-    }
78
-
79
-    /**
80
-     * @return mixed
81
-     */
82
-    public function getBindParams()
83
-    {
84
-        return $this->queryStructure->getElement(QueryStructure::BIND_PARAMS);
85
-    }
21
+	use Utilities, TableValidation, ColumnValidation;
22
+
23
+
24
+	/**
25
+	 * Statements
26
+	 */
27
+	const QUERY_STATEMENT_SELECT = 'SELECT';
28
+	const QUERY_STATEMENT_UPDATE = 'UPDATE';
29
+	const QUERY_STATEMENT_DELETE = 'DELETE';
30
+	const QUERY_STATEMENT_INSERT = 'INSERT';
31
+	const QUERY_STATEMENT_CUSTOM = 'CUSTOM';
32
+
33
+
34
+	/**
35
+	 * @var string
36
+	 */
37
+	protected $statement;
38
+
39
+	/**
40
+	 * @var QueryBuild
41
+	 */
42
+	protected $queryBuild;
43
+
44
+	/**
45
+	 * @var QueryStructure
46
+	 */
47
+	protected $queryStructure;
48
+
49
+	/**
50
+	 * @var array
51
+	 */
52
+	protected $usedInstanceIds = [];
53
+
54
+	/**
55
+	 * @var string
56
+	 */
57
+	protected $tablePrefix;
58
+
59
+
60
+	/**
61
+	 * QueryStatement constructor.
62
+	 * @param QueryBuild $queryBuild
63
+	 * @param string|QuerySelect $table
64
+	 * @throws QueryException
65
+	 */
66
+	public function __construct(QueryBuild $queryBuild, $table = '')
67
+	{
68
+
69
+		$table = $this->validateTable($table);
70
+
71
+		$this->queryBuild = $queryBuild;
72
+		$this->queryStructure = new QueryStructure();
73
+		$this->queryStructure->setElement(QueryStructure::TABLE, $table);
74
+		$this->queryStructure->setElement(QueryStructure::STATEMENT, $this->statement);
75
+		$this->queryStructure->setElement(QueryStructure::QUERY_TYPE, $this->queryBuild->getType());
76
+
77
+	}
78
+
79
+	/**
80
+	 * @return mixed
81
+	 */
82
+	public function getBindParams()
83
+	{
84
+		return $this->queryStructure->getElement(QueryStructure::BIND_PARAMS);
85
+	}
86 86
 
87 87
 
88 88
 }
89 89
\ No newline at end of file
Please login to merge, or discard this patch.
src/Statements/QueryStatementInterface.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -11,17 +11,17 @@
 block discarded – undo
11 11
 interface QueryStatementInterface
12 12
 {
13 13
 
14
-    const REPLACEMENT_NONE = 0;
15
-    const REPLACEMENT_VALUES = 1;
14
+	const REPLACEMENT_NONE = 0;
15
+	const REPLACEMENT_VALUES = 1;
16 16
 
17
-    /**
18
-     * @param bool $replacement
19
-     * @return string
20
-     */
21
-    public function getSyntax($replacement = self::REPLACEMENT_NONE);
17
+	/**
18
+	 * @param bool $replacement
19
+	 * @return string
20
+	 */
21
+	public function getSyntax($replacement = self::REPLACEMENT_NONE);
22 22
 
23
-    public function execute();
23
+	public function execute();
24 24
 
25
-    public function getBindParams();
25
+	public function getBindParams();
26 26
 
27 27
 }
28 28
\ No newline at end of file
Please login to merge, or discard this patch.
src/Statements/QueryDelete.php 1 patch
Indentation   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -27,81 +27,81 @@
 block discarded – undo
27 27
 class QueryDelete extends QueryStatement implements QueryStatementInterface
28 28
 {
29 29
 
30
-    use Limit, Where, WhereAndHavingBuilder, Replacement, OrderBy, SetFields, Ignore, DefaultPriority, LowPriority, Utilities;
31
-
32
-    /**
33
-     * @var string
34
-     */
35
-    protected $statement = self::QUERY_STATEMENT_DELETE;
36
-
37
-
38
-    /**
39
-     * QueryDelete constructor.
40
-     * @param QueryBuild $queryBuild
41
-     * @param string $table
42
-     */
43
-    public function __construct(QueryBuild $queryBuild, $table = null)
44
-    {
45
-        parent::__construct($queryBuild, $table);
46
-    }
47
-
48
-    public function getSyntax($replacement = self::REPLACEMENT_NONE)
49
-    {
50
-        $syntax = array();
51
-
52
-        /**
53
-         *  Explain
54
-         */
55
-        $syntax[] = $this->getExplainSyntax();
56
-
57
-        /**
58
-         * UPDATE statement
59
-         */
60
-        $syntax[] = $this->statement;
61
-
62
-        /**
63
-         * PRIORITY
64
-         */
65
-        $syntax[] = $this->queryStructure->getElement(QueryStructure::PRIORITY);
66
-
67
-        /**
68
-         * TABLE update
69
-         */
70
-        $syntax[] = 'FROM ' . $this->queryStructure->getElement(QueryStructure::TABLE);
71
-
72
-        /**
73
-         * WHERE clause
74
-         */
75
-        $syntax[] = $this->getWhereSyntax();
76
-
77
-        /**
78
-         * ORDER BY clause
79
-         */
80
-        $syntax[] = $this->getOrderBySyntax();
81
-
82
-        /**
83
-         * LIMIT clause
84
-         */
85
-        $syntax[] = $this->getLimitSyntax();
86
-
87
-        $syntax = implode(' ', $syntax);
88
-
89
-        return $this->getSyntaxReplace($syntax, $replacement);
90
-    }
91
-
92
-    /**
93
-     * @return array|int|null
94
-     * @throws QueryException
95
-     */
96
-    public function execute()
97
-    {
98
-
99
-        if ($this->queryStructure->getElement((QueryStructure::WHERE_TRIGGER)) && !count($this->queryStructure->getElement(QueryStructure::WHERE)))
100
-            throw new QueryException('Where or Having clause is required for this statement!', QueryException::QUERY_ERROR_DELETE_NOT_FILTER);
101
-
102
-        return DbService::getInstance()->query($this->getSyntax(), $this->queryStructure->getElement(QueryStructure::BIND_PARAMS));
103
-
104
-    }
30
+	use Limit, Where, WhereAndHavingBuilder, Replacement, OrderBy, SetFields, Ignore, DefaultPriority, LowPriority, Utilities;
31
+
32
+	/**
33
+	 * @var string
34
+	 */
35
+	protected $statement = self::QUERY_STATEMENT_DELETE;
36
+
37
+
38
+	/**
39
+	 * QueryDelete constructor.
40
+	 * @param QueryBuild $queryBuild
41
+	 * @param string $table
42
+	 */
43
+	public function __construct(QueryBuild $queryBuild, $table = null)
44
+	{
45
+		parent::__construct($queryBuild, $table);
46
+	}
47
+
48
+	public function getSyntax($replacement = self::REPLACEMENT_NONE)
49
+	{
50
+		$syntax = array();
51
+
52
+		/**
53
+		 *  Explain
54
+		 */
55
+		$syntax[] = $this->getExplainSyntax();
56
+
57
+		/**
58
+		 * UPDATE statement
59
+		 */
60
+		$syntax[] = $this->statement;
61
+
62
+		/**
63
+		 * PRIORITY
64
+		 */
65
+		$syntax[] = $this->queryStructure->getElement(QueryStructure::PRIORITY);
66
+
67
+		/**
68
+		 * TABLE update
69
+		 */
70
+		$syntax[] = 'FROM ' . $this->queryStructure->getElement(QueryStructure::TABLE);
71
+
72
+		/**
73
+		 * WHERE clause
74
+		 */
75
+		$syntax[] = $this->getWhereSyntax();
76
+
77
+		/**
78
+		 * ORDER BY clause
79
+		 */
80
+		$syntax[] = $this->getOrderBySyntax();
81
+
82
+		/**
83
+		 * LIMIT clause
84
+		 */
85
+		$syntax[] = $this->getLimitSyntax();
86
+
87
+		$syntax = implode(' ', $syntax);
88
+
89
+		return $this->getSyntaxReplace($syntax, $replacement);
90
+	}
91
+
92
+	/**
93
+	 * @return array|int|null
94
+	 * @throws QueryException
95
+	 */
96
+	public function execute()
97
+	{
98
+
99
+		if ($this->queryStructure->getElement((QueryStructure::WHERE_TRIGGER)) && !count($this->queryStructure->getElement(QueryStructure::WHERE)))
100
+			throw new QueryException('Where or Having clause is required for this statement!', QueryException::QUERY_ERROR_DELETE_NOT_FILTER);
101
+
102
+		return DbService::getInstance()->query($this->getSyntax(), $this->queryStructure->getElement(QueryStructure::BIND_PARAMS));
103
+
104
+	}
105 105
 
106 106
 
107 107
 }
108 108
\ No newline at end of file
Please login to merge, or discard this patch.
src/DB/DbException.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,9 +11,9 @@
 block discarded – undo
11 11
 class DbException extends \Exception
12 12
 {
13 13
 
14
-    const DB_CONNECTION_ERROR = 1;
15
-    const DB_QUERY_ERROR = 2;
16
-    const DB_ERROR_MASTER_DATA_CONNECTION_MISSING = 3;
14
+	const DB_CONNECTION_ERROR = 1;
15
+	const DB_QUERY_ERROR = 2;
16
+	const DB_ERROR_MASTER_DATA_CONNECTION_MISSING = 3;
17 17
 
18 18
 
19 19
 }
20 20
\ No newline at end of file
Please login to merge, or discard this patch.