-
Notifications
You must be signed in to change notification settings - Fork 10
Support for Doctrine DBAL 3 #122
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
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
4a03d6f
DBAL3: Update to `doctrine/dbal` version 3
amotl cf2ca79
DBAL3: Adjust interfaces and autoloading to match implementation
amotl 5bfc306
DBAL3: Start populating PDOConnection, detouring from PDOCrateDB
amotl 9cf0a19
DBAL3: Code-style fixes
amotl 832226c
DBAL3: Making actual progress
amotl dbc307d
DBAL3: Apply suggestions by CodeRabbit, and more copy editing
amotl 8d8e25f
DBAL3: Minor wording updates
amotl 40283de
DBAL3: More copy editing with CodeRabbit
amotl 1038d06
Chore: Switch linter/formatter to PHP Coding Standards Fixer
amotl 40429d1
DBAL3: Rename more symbols
JulianMar fe34cf7
DBAL3: Towards DBAL4
JulianMar 4b72137
DBAL3: Implement suggestions by CodeRabbit
amotl 32c556a
DBAL3: More generic type hinting
JulianMar 8bf6a95
Chore: Naming things `s/TestCase/Test/`
amotl e15924c
Chore: Implement suggestions by CodeRabbit
amotl ec6eef9
DBAL3: Use `Doctrine\DBAL\Driver\PDO\Exception` instead of copying
amotl 05f85d5
DBAL3: At `lastInsertId`, catch `PDOException` and wrap into `DBAL` one
amotl 24d1767
DBAL3: Clarify remark about differences of the new DBAL3 Type API
amotl b07a4a4
DBAL3: Remove comment about `wrapperClass`
amotl ee38c2f
Tests: Adjust skip messages instead of blatantly using `ALTER TABLE`
amotl 425f4ee
DBAL3: Implement suggestions by CodeRabbit
amotl 9732bf6
DBAL3: Use CrateDB 5.0.0 in `getServerVersion` to select modern dialect
amotl b8a9929
DBAL3: Implement suggestions by CodeRabbit
amotl 2e7eb41
Connection: Make statement class registration more compliant with PDO
amotl b4b6870
Use `TransactionIsolationLevel::READ_UNCOMMITTED` as new default
amotl d920f69
Forward beginTransaction, commit, rollBack to PDO driver
amotl 27efef8
DBAL3: Implement `getServerVersion()`, forwarding to `PDOCrateDB`
amotl cf37370
Example: Update procedure how to properly select the platform
amotl 6425cc4
Documentation: Educate about CrateDB and eventual consistency vs. ACID
amotl 8df8f90
Documentation: Make example program independent of `CratePlatform4`
amotl 07e207a
DBAL3: Remove `assert($result !== false)` in `PDOConnection.exec()`
amotl 27294b0
DBAL3: Apply optimization to `PDOConnection.query()` by CodeRabbit
amotl 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
Some comments aren't visible on the classic Files Changed page.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ | |
| .project | ||
| .vagrant | ||
| .phpunit.result.cache | ||
| *.cache | ||
| *-console.log | ||
| .crate-docs | ||
| /composer.lock | ||
|
|
||
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,28 @@ | ||
| <?php | ||
| // PHP Coding Standards Fixer | ||
| // https://cs.symfony.com/ | ||
| // https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/doc/config.rst | ||
|
|
||
| $finder = (new PhpCsFixer\Finder()) | ||
| ->in(__DIR__) | ||
| ->exclude('build') | ||
| ->exclude('vendor') | ||
| ; | ||
|
|
||
| return (new PhpCsFixer\Config()) | ||
| ->setUnsupportedPhpVersionAllowed(true) | ||
| ->setRules([ | ||
| // '@auto' => true, | ||
| // '@PHP7x3Migration' => true, | ||
| // '@PSR1' => true, | ||
| // '@PSR2' => true, | ||
| // '@PSR12' => true, | ||
| // '@Symfony' => true, | ||
| // 'array_syntax' => ['syntax' => 'short'], | ||
| 'ordered_imports' => true, | ||
| // 'strict_param' => true, | ||
| ]) | ||
| ->setFinder($finder) | ||
| ; | ||
|
|
||
| ?> |
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,67 @@ | ||
| <?php | ||
|
|
||
| /* | ||
| * Basic example program about handling CrateDB OBJECTs with Doctrine DBAL. | ||
| * https://github.com/crate/crate-dbal | ||
| */ | ||
| require __DIR__ . '/../vendor/autoload.php'; | ||
|
|
||
| use Crate\DBAL\Driver\PDOCrate\Driver as CrateDBDriver; | ||
| use Crate\DBAL\Types\MapType; | ||
| use Doctrine\DBAL\DriverManager; | ||
| use Doctrine\DBAL\Exception\TableNotFoundException; | ||
| use Doctrine\DBAL\Schema\Column; | ||
| use Doctrine\DBAL\Schema\Table; | ||
|
|
||
| use Doctrine\DBAL\Tools\DsnParser; | ||
| use Doctrine\DBAL\Types\Type; | ||
|
|
||
|
|
||
| // Register driver and select platform. | ||
| // Because DBAL can't connect to the database to determine its version dynamically, | ||
| // it is the obligation of the user to provide the CrateDB version number. | ||
| // Remark: Please let us know if you find a way how to set up more ergonomically. | ||
| // https://www.doctrine-project.org/projects/doctrine-dbal/en/3.10/reference/platforms.html | ||
| $driver = new CrateDBDriver(); | ||
| $dsnParser = new DsnParser(["crate" => $driver::class]); | ||
| $driver->createDatabasePlatformForVersion('6.0.0'); | ||
|
|
||
| // Create connection options from data source URL. | ||
| $options = $dsnParser->parse('crate://crate:crate@localhost:4200/'); | ||
|
|
||
| // Connect to database. | ||
| $connection = DriverManager::getConnection($options); | ||
|
|
||
| // Define table schema. | ||
| $table = new Table('example'); | ||
| $objDefinition = array( | ||
| 'type' => MapType::STRICT, | ||
| 'fields' => array( | ||
| new Column('id', Type::getType('integer'), array()), | ||
| new Column('name', Type::getType('string'), array()), | ||
| ), | ||
| ); | ||
| $table->addColumn( | ||
| 'data', | ||
| MapType::NAME, | ||
| array('platformOptions' => $objDefinition), | ||
| ); | ||
|
|
||
| // Provision database table. | ||
| $schemaManager = $connection->createSchemaManager(); | ||
| try { | ||
| $schemaManager->dropTable($table->getName()); | ||
| } catch (TableNotFoundException) { | ||
| } | ||
| $schemaManager->createTable($table); | ||
|
|
||
| // Insert data. | ||
| $connection->insert('example', array('data' => array('id' => 42, 'name' => 'foo')), array('data' => 'map')); | ||
| $connection->insert('example', array('data' => array('id' => 43, 'name' => 'bar')), array('data' => 'map')); | ||
| $connection->executeStatement('REFRESH TABLE example'); | ||
|
|
||
| // Query data. | ||
| $result = $connection->executeQuery('SELECT * FROM example'); | ||
| print_r($result->fetchAllAssociative()); | ||
|
|
||
| ?> |
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
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.