MediaWiki  REL1_31
MssqlBlob.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Wikimedia\Rdbms;
4 
5 class 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 }
$ret
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:2005
Wikimedia\Rdbms
Definition: ChronologyProtector.php:24
serialize
serialize()
Definition: ApiMessage.php:184
php
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:37
Wikimedia\Rdbms\MssqlBlob\__construct
__construct( $data)
@noinspection PhpMissingParentConstructorInspection
Definition: MssqlBlob.php:11
Wikimedia\Rdbms\MssqlBlob\fetch
fetch()
Returns an unquoted hex representation of a binary string for insertion into varbinary-type fields.
Definition: MssqlBlob.php:28
Wikimedia\Rdbms\Blob\$data
string $data
Definition: Blob.php:7
Wikimedia\Rdbms\MssqlBlob
Definition: MssqlBlob.php:5
data
and how to run hooks for an and one after Each event has a preferably in CamelCase For ArticleDelete hook A clump of code and data that should be run when an event happens This can be either a function and a chunk of data
Definition: hooks.txt:18
Wikimedia\Rdbms\Blob
Definition: Blob.php:5