[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/includes/utils/ -> CdbPHP.php (summary)

This is a port of D.J. Bernstein's CDB to PHP. It's based on the copy that appears in PHP 5.3. Changes are: * Error returns replaced with exceptions * Exception thrown if sizes or offsets are between 2GB and 4GB * Some variables renamed This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

File Size: 494 lines (12 kb)
Included or required:0 times
Referenced: 3 times
Includes or requires: 0 files

Defines 3 classes

CdbFunctions:: (3 methods):
  unsignedMod()
  unsignedShiftRight()
  hash()

CdbReaderPHP:: (10 methods):
  __construct()
  close()
  get()
  match()
  findStart()
  read()
  unpack31()
  unpackSigned()
  findNext()
  find()

CdbWriterPHP:: (9 methods):
  __construct()
  set()
  close()
  write()
  posplus()
  addend()
  addbegin()
  finish()
  throwException()


Class: CdbFunctions  - X-Ref

Common functions for readers and writers

unsignedMod( $a, $b )   X-Ref
Take a modulo of a signed integer as if it were an unsigned integer.
$b must be less than 0x40000000 and greater than 0

param: int $a
param: int $b
return: int

unsignedShiftRight( $a, $b )   X-Ref
Shift a signed integer right as if it were unsigned

param: int $a
param: int $b
return: int

hash( $s )   X-Ref
The CDB hash function.

param: string $s
return: int

Class: CdbReaderPHP  - X-Ref

CDB reader class

__construct( $fileName )   X-Ref

param: string $fileName

close()   X-Ref
No description

get( $key )   X-Ref

param: mixed $key
return: bool|string

match( $key, $pos )   X-Ref

param: string $key
param: int $pos
return: bool

findStart()   X-Ref
No description

read( $length, $pos )   X-Ref

param: int $length
param: int $pos
return: string

unpack31( $s )   X-Ref
Unpack an unsigned integer and throw an exception if it needs more than 31 bits

param: string $s
return: mixed

unpackSigned( $s )   X-Ref
Unpack a 32-bit signed integer

param: string $s
return: int

findNext( $key )   X-Ref

param: string $key
return: bool

find( $key )   X-Ref

param: mixed $key
return: bool

Class: CdbWriterPHP  - X-Ref

CDB writer class

__construct( $fileName )   X-Ref

param: string $fileName

set( $key, $value )   X-Ref

param: string $key
param: string $value

close()   X-Ref


write( $buf )   X-Ref

param: string $buf

posplus( $len )   X-Ref

param: int $len

addend( $keylen, $datalen, $h )   X-Ref

param: int $keylen
param: int $datalen
param: int $h

addbegin( $keylen, $datalen )   X-Ref

param: int $keylen
param: int $datalen

finish()   X-Ref


throwException( $msg )   X-Ref
Clean up the temp file and throw an exception

param: string $msg



Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1