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.
Summary of Changes
Add two new methods:
$db->quoteBinary()
- required by ms sql server (to explicitly cast a value on INSERT query)$db->decodeBinary()
- required by Postgresql/Pgsql drivers to get the original binary string.Add a missing class
DatabaseSqliteCase
in order to load./Stubs/ddl.sql
file and the same./Stubs/database.xml
file as on other drivers.Previously, phpunit loaded SQL/XML data from the additional package 'Joomla\Test'.
Testing Instructions
Code review.
Unit tests should pass
Documentation Changes Required
To work properly with a binary string, we have to quote it using
quoteBinary()
. This method replaces the binary string with hexadecimal text wrapped in the specified format depending on the database driver.When we want to get value of
BLOB/VARBINARY
then Postgresql/Pgsql database API returns an equivalent of binary string.Postgresql (>= 9.0) by default returns hexdecimal text or (<9.0) escaped string.
I changed SQL variable
buffer_output
to always return escaped string and then usepg_unescape_string
to get the original binary string.PgSQL returns a stream instead of string. To get the original binary string we have to use
stream_get_contents()
.Other databases do not require this additional conversion. For the code to work properly regardless of the database driver, we will use
$db->decodeBinary($value)
.