You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+28-8Lines changed: 28 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,9 @@ Query Builder for SphinxQL
8
8
9
9
## About
10
10
11
-
This is a SphinxQL Query Builder used to work with SphinxQL, a SQL dialect used with the Sphinx search engine and it's fork Manticore. It maps most of the functions listed in the [SphinxQL reference](http://sphinxsearch.com/docs/current.html#SphinxQL-reference) and is generally [faster](http://sphinxsearch.com/blog/2010/04/25/sphinxapi-vs-SphinxQL-benchmark/) than the available Sphinx API.
11
+
This is a query builder for SphinxQL/ManticoreQL, the SQL dialect used by
12
+
Sphinx Search and Manticore Search. It maps most common query-builder use cases
13
+
and supports both `mysqli` and `PDO` drivers.
12
14
13
15
This Query Builder has no dependencies except PHP 8.2 or later, `\MySQLi` extension, `PDO`, and [Sphinx](http://sphinxsearch.com)/[Manticore](https://manticoresearch.com).
14
16
@@ -24,22 +26,22 @@ If any feature is unreachable through this library, open a new issue or send a p
24
26
25
27
The majority of the methods in the package have been unit tested.
26
28
27
-
The only methods that have not been fully tested are the Helpers, which are mostly simple shorthands for SQL strings.
29
+
Helper methods and engine compatibility scenarios are covered by the test suite.
28
30
29
31
## How to Contribute
30
32
31
33
### Pull Requests
32
34
33
35
1. Fork the SphinxQL Query Builder repository
34
36
2. Create a new branch for each feature or improvement
35
-
3. Submit a pull request from each branch to the **master** branch
37
+
3. Submit a pull request from each branch to the repository default branch
36
38
37
39
It is very important to separate new features or improvements into separate feature branches, and to send a pull
38
40
request for each branch. This allows me to review and pull in new features or improvements individually.
39
41
40
42
### Style Guide
41
43
42
-
All pull requests must adhere to the [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) standard.
44
+
All pull requests should follow PSR-12-compatible formatting.
43
45
44
46
### Unit Testing
45
47
@@ -80,6 +82,19 @@ We support the following database connection drivers:
80
82
* Foolz\SphinxQL\Drivers\Mysqli\Connection
81
83
* Foolz\SphinxQL\Drivers\Pdo\Connection
82
84
85
+
### Engine Compatibility Matrix
86
+
87
+
| Engine | Query Builder | Helper APIs | Notes |
88
+
| --- | --- | --- | --- |
89
+
| Sphinx 2.x | Supported | Supported | Full CI lane |
90
+
| Sphinx 3.x | Supported | Supported with engine-specific assertions | Full CI lane |
91
+
| Manticore | Supported | Supported + Percolate | Full CI lane |
92
+
93
+
### Migration to 4.0
94
+
95
+
See [`MIGRATING-4.0.md`](MIGRATING-4.0.md) for the complete migration checklist,
96
+
including strict runtime validation behavior introduced in the 4.0 line.
97
+
83
98
### Connection
84
99
85
100
*__$conn = new Connection()__
@@ -118,10 +133,6 @@ There are cases when an input __must__ be escaped in the SQL statement. The foll
118
133
119
134
Returns the escaped value. This is processed with the `\MySQLi::real_escape_string()` function.
120
135
121
-
*__$sq->quoteIdentifier($identifier)__
122
-
123
-
Adds backtick quotes to the identifier. For array elements, use `$sq->quoteIdentifierArray($arr)`.
124
-
125
136
*__$sq->quote($value)__
126
137
127
138
Adds quotes to the value and escapes it. For array elements, use `$sq->quoteArr($arr)`.
@@ -136,6 +147,15 @@ There are cases when an input __must__ be escaped in the SQL statement. The foll
136
147
137
148
_Refer to `$sq->match()` for more information._
138
149
150
+
#### Strict Validation in 4.0
151
+
152
+
4.0 performs fail-fast validation for invalid query-shape input. Examples:
153
+
154
+
* invalid `setType()` values
155
+
* invalid `ORDER BY` direction values
156
+
* negative `limit()`/`offset()`
157
+
* invalid value shapes for `IN`/`BETWEEN`
158
+
139
159
#### SELECT
140
160
141
161
*__$sq = (new SphinxQL($conn))->select($column1, $column2, ...)->from($index1, $index2, ...)__
The existing PDO driver written is considered experimental as the behaviour changes between certain PHP releases.
18
+
$conn->setParams(array(
19
+
'host' => '127.0.0.1',
20
+
'port' => 9306,
21
+
));
23
22
24
-
Connection Parameters
25
-
---------------------
23
+
You can also use the PDO driver:
26
24
27
-
The connection parameters provide information about the instance you wish to establish a connection with. The parameters required is set with the `setParams($array)` or `setParam($key, $value)` methods.
2. Create a new branch for each feature or improvement
9
-
3. Submit a pull request with your branch against the master branch
9
+
3. Submit a pull request with your branch against the default branch
10
10
11
11
It is very important that you create a new branch for each feature, improvement, or fix so that may review the changes and merge the pull requests in a timely manner.
12
12
13
13
Coding Style
14
14
------------
15
15
16
-
All pull requests must adhere to the `PSR-2 <https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md>`_ standard.
16
+
All pull requests should follow modern PHP style conventions (PSR-12 compatible formatting).
0 commit comments