-
Notifications
You must be signed in to change notification settings - Fork 111
Resumable-friendly external database drivers embedding API & PDO::MySQL resumable basic version #393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Resumable-friendly external database drivers embedding API & PDO::MySQL resumable basic version #393
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5949cbb
[build] add libmysqlclient-dev to build
DrDet 53543c2
[net] small fixes
DrDet 0518712
[tests] use raw memory for setting up script allocator in RuntimeTest…
DrDet d7805e2
implement resumable-friendly external net drivers embedding API
DrDet 2381051
implement basic PDO::MySQL version
DrDet 2e563ea
[tests] add PDO::MySQL tests
DrDet 88c5f6e
[docs] update Invoking MySQL section
DrDet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,42 @@ | ||
| <?php | ||
|
|
||
| require_once __DIR__ . '/PDOStatement.php'; | ||
|
|
||
| class PDO { | ||
| /** | ||
| * Sets the timeout value in seconds for communications with the database. | ||
| * @link https://php.net/manual/en/pdo.constants.php#pdo.constants.attr-timeout | ||
| */ | ||
| const ATTR_TIMEOUT = 2; | ||
|
|
||
| public function __construct( | ||
| string $dsn, | ||
| ?string $username = null, | ||
| ?string $password = null, | ||
| ?array $options = null | ||
| ): PDO; | ||
|
|
||
| /** @kphp-extern-func-info resumable */ | ||
| public function query(string $query): ?PDOStatement; // TODO: $fetchMode is not supported | ||
|
|
||
| /** @kphp-extern-func-info resumable */ | ||
| public function exec(string $statement): int|false; | ||
|
|
||
| public function errorCode(): ?string; | ||
| public function errorInfo(): (int|string)[]; | ||
|
|
||
| // These methods are not supported yet: | ||
| // | ||
| // public function prepare(string $query, array $options = []): ?PDOStatement; | ||
| // public function beginTransaction(): bool; | ||
| // public function commit(): bool; | ||
|
|
||
| // public function getAttribute(int $attribute): bool|int|string|array|null; | ||
| // public function inTransaction(): bool; | ||
| // public function lastInsertId(?string $name = null): string|false; | ||
| // public static function getAvailableDrivers(): array; | ||
| // public function quote(string $string, int $type = PDO::PARAM_STR): string|false; | ||
| // public function rollBack(): bool; | ||
| // public function setAttribute(int $attribute, mixed $value): bool; | ||
| } | ||
|
|
This file contains hidden or 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,46 @@ | ||
| <?php | ||
|
|
||
| require_once __DIR__ . '/PDO.php'; | ||
|
|
||
| class PDOStatement { | ||
| /** | ||
| * @kphp-const | ||
| */ | ||
| public string $queryString; | ||
|
|
||
| public function fetch(): mixed; // TODO: only default behaviour supported | ||
| public function fetchAll(): mixed[]; // TODO: only default behaviour supported | ||
|
|
||
| // These methods are not supported yet: | ||
| // | ||
| // public function execute(?array $params = null): bool; | ||
| // public bindColumn( | ||
| // string|int $column, | ||
| // mixed &$var, | ||
| // int $type = PDO::PARAM_STR, | ||
| // int $maxLength = 0, | ||
| // mixed $driverOptions = null | ||
| // ): bool | ||
| // public bindParam( | ||
| // string|int $param, | ||
| // mixed &$var, | ||
| // int $type = PDO::PARAM_STR, | ||
| // int $maxLength = 0, | ||
| // mixed $driverOptions = null | ||
| // ): bool | ||
| // public bindValue(string|int $param, mixed $value, int $type = PDO::PARAM_STR): bool | ||
| // public closeCursor(): bool | ||
| // public columnCount(): int | ||
| // public debugDumpParams(): ?bool | ||
| // public errorCode(): ?string | ||
| // public errorInfo(): array | ||
| // public fetchAll(int $mode = PDO::FETCH_DEFAULT): array | ||
| // public fetchColumn(int $column = 0): mixed | ||
| // public fetchObject(?string $class = "stdClass", array $constructorArgs = []): object|false | ||
| // public getAttribute(int $name): mixed | ||
| // public getColumnMeta(int $column): array|false | ||
| // public nextRowset(): bool | ||
| // public rowCount(): int | ||
| // public setAttribute(int $attribute, mixed $value): bool | ||
| // public setFetchMode(int $mode): bool | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,15 @@ | ||
| // Compiler for PHP (aka KPHP) | ||
| // Copyright (c) 2021 LLC «V Kontakte» | ||
| // Distributed under the GPL v3 License, see LICENSE.notice.txt | ||
|
|
||
| #include "runtime/pdo/abstract_pdo_driver.h" | ||
|
|
||
| #include "server/database-drivers/adaptor.h" | ||
|
|
||
| namespace pdo { | ||
|
|
||
| AbstractPdoDriver::~AbstractPdoDriver() noexcept { | ||
| vk::singleton<database_drivers::Adaptor>::get().remove_connector(connector_id); | ||
| } | ||
|
|
||
| } // namespace pdo |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.