New: Add SQLite implementation of UuidValue expression - #432
Conversation
SQLite stores a UUID as 16 raw bytes in a `blob(16)` column, so `prepareValue()` converts the canonical form with `DbUuidHelper::uuidToBlob()` and binds it as `DataType::LOB`. Requires yiisoft/db#1199.
938d5ab to
ee901ce
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #432 +/- ##
=========================================
Coverage 98.48% 98.48%
- Complexity 329 330 +1
=========================================
Files 22 23 +1
Lines 1055 1058 +3
=========================================
+ Hits 1039 1042 +3
Misses 16 16 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| { | ||
| protected function prepareValue(UuidValue $expression): Param | ||
| { | ||
| return new Param(DbUuidHelper::uuidToBlob($expression->value), DataType::LOB); |
There was a problem hiding this comment.
Will it work when $expression->value is 16 raw bytes or 32 hexadecimal characters? Needs a test
There was a problem hiding this comment.
$expression->value is always the canonical lowercase form — UuidValue::__construct() normalizes through DbUuidHelper::toUuid(), so 16 raw bytes and 32 hexadecimal characters are input forms rather than states the builder can observe.
Both tests in UuidValueBuilderTest are now data-provider driven over every accepted form — canonical, canonical uppercase, 32 hex, 32 hex uppercase and 16 raw bytes. The build test asserts the same Param(uuidToBlob(...), DataType::LOB) for each, and testInsertAndSelectUuid() does a real-database round-trip per form.
|
These The other workflows don't hit it because they install the core from the PR branch: It clears itself once #1199 is merged and 2.0.2 is tagged. If you'd rather see it green before that, adding |
SQLite half of
UuidValue, added in yiisoft/db#1199 — that PR has to be merged first.SQLite stores a UUID as 16 raw bytes (
ColumnDefinitionBuildermapsColumnType::UUIDtoblob(16)), soprepareValue()converts the canonical form withDbUuidHelper::uuidToBlob()and binds it asDataType::LOBrather than lettingbuildValue()inferDataType::STRING:The branch name matches the one in yiisoft/db#1199, so
install-packagesresolves the core package from it and CI runs against the new class.