3 namespace Wikimedia\Rdbms
;
5 class MssqlBlob
extends Blob
{
6 /** @noinspection PhpMissingParentConstructorInspection */
9 * @param Blob|string $data
11 public function __construct( $data ) {
12 if ( $data instanceof MssqlBlob
) {
13 $this->data
= $data->data
;
14 } elseif ( $data instanceof Blob
) {
15 $this->data
= $data->fetch();
22 * Returns an unquoted hex representation of a binary string
23 * for insertion into varbinary-type fields
26 public function fetch() {
27 if ( $this->data
=== null ) {
32 $dataLength = strlen( $this->data
);
33 for ( $i = 0; $i < $dataLength; $i++
) {
34 $ret .= bin2hex( pack( 'C', ord( $this->data
[$i] ) ) );