-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
79d388b
commit 12625dd
Showing
5 changed files
with
83 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
Open index | ||
------------ | ||
|
||
Open a connection to the read socket, and authorize with the password `passwordRead` | ||
|
||
```php | ||
$reader = new \HS\Reader('localhost', 9998, 'passwordRead'); | ||
``` | ||
|
||
When you open the index you must use a numeric identifier. If the identifier was not used, it will simply be assigned | ||
new index, if you have already used this index number, the new index just overwrite the old one. | ||
|
||
Therefore it is very important to store information about all open indexes in the current connection, not to open several times indexes. | ||
An example of a method that checks and not open if we already has index, which we need, if so, just returns us to the identifier | ||
if not, it opens a new index, and returns us to its identifier. | ||
|
||
```php | ||
$indexId = $reader->getIndexId( | ||
'database', | ||
'tableName', | ||
'PRIMARY', | ||
array('key', 'text') | ||
); | ||
``` | ||
|
||
If we just need to open the subscript c number 12 (for example), and we don't want to check: | ||
|
||
```php | ||
$indexIndexQuery = $reader->openIndex( | ||
'12' | ||
'database', | ||
'tableName', | ||
'PRIMARY', | ||
array('key', 'text'), | ||
array('num') | ||
); | ||
``` | ||
|
||
Here we open the index with identifier 12, columns `key`,` text`, and the column to filter `num`. | ||
Method returns us to the class OpenIndexQuery. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
Открываем Индекс | ||
------------ | ||
|
||
Открываем соединение на сокет только для чления и авторизовываемся с паролем `passwordRead` | ||
```php | ||
$reader = new \HS\Reader('localhost', 9998, 'passwordRead'); | ||
``` | ||
|
||
При открытии индекса используется числовой идентификатор. Если этот идентификатор еще не использовался, то ему просто будет присвоен | ||
новый индекс, если же он уже использовался, то новый индекс просто перезапишет старый. | ||
|
||
Поэтому очень важно хранить данные обо всех открытых индексах в рамках текущего подключения, чтобы не открывать по несколько раз индексы. | ||
Пример команды, которая проверяет, а не открыт ли у нас уже индекс, который нам нужен, если да, то просто возвращает нам идентификатор, | ||
если нет, то открывает новый индекс и возвращает нам его идентификатор. | ||
```php | ||
$indexId = $reader->getIndexId( | ||
'database', | ||
'tableName', | ||
'PRIMARY', | ||
array('key', 'text') | ||
); | ||
``` | ||
|
||
Если нам нужно просто открыть индекс c номер 12(например), и мы ничего не хотим проверять: | ||
|
||
```php | ||
$indexIndexQuery = $reader->openIndex( | ||
'12' | ||
'database', | ||
'tableName', | ||
'PRIMARY', | ||
array('key', 'text'), | ||
array('num') | ||
); | ||
``` | ||
|
||
Здесь мы открываем индекс c номером 12, колонками `key`, `text`, а так же колонкой для фильтров `num`. | ||
Метод вернет нам класс OpenIndexQuery. |