MediaWiki REL1_32
MssqlBlob.php
Go to the documentation of this file.
1<?php
2
3namespace Wikimedia\Rdbms;
4
5class MssqlBlob extends Blob {
11 public function __construct( $data ) {
12 if ( $data instanceof MssqlBlob ) {
13 return $data;
14 } elseif ( $data instanceof Blob ) {
15 $this->data = $data->fetch();
16 } elseif ( is_array( $data ) && is_object( $data ) ) {
17 $this->data = serialize( $data );
18 } else {
19 $this->data = $data;
20 }
21 }
22
28 public function fetch() {
29 if ( $this->data === null ) {
30 return 'null';
31 }
32
33 $ret = '0x';
34 $dataLength = strlen( $this->data );
35 for ( $i = 0; $i < $dataLength; $i++ ) {
36 $ret .= bin2hex( pack( 'C', ord( $this->data[$i] ) ) );
37 }
38
39 return $ret;
40 }
41}
serialize()
fetch()
Returns an unquoted hex representation of a binary string for insertion into varbinary-type fields.
Definition MssqlBlob.php:28
__construct( $data)
@noinspection PhpMissingParentConstructorInspection
Definition MssqlBlob.php:11
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses & $ret
Definition hooks.txt:2054