DB
[ class tree: DB ] [ index: DB ] [ all elements ]

Class: DB_ldap

Source Location: /DB_ldap-1.0/ldap.php

Class Overview

DB_common
   |
   --DB_ldap

LDAP DB interface class


Author(s):

Version:

  • 1.0

Methods


Inherited Variables

Inherited Methods


Class Details

[line 295]
LDAP DB interface class

LDAP extends DB_common to provide DB compliant access to LDAP servers



[ Top ]


Method Detail

DB_ldap (Constructor)   [line 340]

DB_ldap DB_ldap( )

Constructor, calls DB_common constructor
  • See: DB_common::DB_common()

[ Top ]

base   [line 761]

void base( [mixed $base = null])


[ Top ]

connect   [line 360]

DB_OK connect( array $dsninfo, [boolean $persistent = false])

Connect and bind to LDAP server with either anonymous or authenticated bind depending on dsn info
  • Return: if successfully connected. A DB error code is returned on failure.

Parameters:

array   $dsninfo     dsn info as passed by DB::connect()
boolean   $persistent     kept for interface compatibility

[ Top ]

createSequence   [line 862]

mixed createSequence( string $seq_name)

Create the sequence

The sequence entry is based on core schema with extensibleObject, so it should work with any LDAP server which doesn't check schema or supports extensibleObject object class.

Sequence name have to be DN started with "sn=$seq_id,", i.e.:

$seq_name = "sn=uidNumber,ou=sequences,dc=php,dc=net";

dn: $seq_name objectClass: top objectClass: extensibleObject sn: $seq_id cn: $seq_value uid: $seq_uniq

  • Return: DB_OK on success or DB error on error
  • Access: public

Parameters:

string   $seq_name     the DN of the sequence

[ Top ]

disconnect   [line 396]

int disconnect( )

Unbinds from LDAP server
  • Return: ldap_unbind() return value

[ Top ]

dropSequence   [line 891]

mixed dropSequence( string $seq_name)

Drop a sequence
  • Return: DB_OK on success or DB error on error
  • Access: public

Parameters:

string   $seq_name     the DN of the sequence

[ Top ]

execute   [line 505]

LDAP_result execute( string $stmt, [array $data = false], [string $action = 'search'], [array $params = array()])

Executes a query performing variables substitution in the query text
  • Return: object or DB Error object if no result
  • See: DB_common::executeEmulateQuery $this->simpleQuery()

Parameters:

string   $stmt     text of the request to send to the LDAP server
array   $data     query variables values to substitute
string   $action     type of request to perform, defaults to search (ldap_search())
array   $params     array of additional parameters to pass to the PHP ldap function requested

[ Top ]

executeMultiple   [line 531]

LDAP_result executeMultiple( string $stmt, array &$data, [string $action = 'search'], [array $params = array()])

Executes multiple queries performing variables substitution for each query
  • Return: object or DB Error object if no result
  • See: DB_common::executeMultiple

Parameters:

string   $stmt     text of the request to send to the LDAP server
array   $data     query variables values to substitute
string   $action     type of request to perform, defaults to search (ldap_search())
array   $params     array of additional parameters to pass to the PHP ldap function requested

[ Top ]

freeQuery   [line 751]

void freeQuery( [mixed $query = ''])


[ Top ]

freeResult   [line 746]

void freeResult( )


[ Top ]

getAll   [line 716]

array &getAll( $query $query, [array $data = null], [$fetchmode $fetchmode = DB_FETCHMODE_DEFAULT], [string $action = 'search'], [array $params = array()])

Fetch all the rows returned from a query.
  • Return: an nested array, or a DB error
  • See: DB_common::getAll()
  • Access: public

Parameters:

array   $data     if supplied, prepare/execute will be used with this array as execute parameters
string   $action     type of request to perform, defaults to search (ldap_search())
array   $params     array of additional parameters to pass to the PHP ldap function requested
$query   $query     the SQL query
$fetchmode   $fetchmode     the fetch mode to use

[ Top ]

getAssoc   [line 694]

array &getAssoc( $query $query, [$force_array $force_array = false], [array $data = array()], [$fetchmode $fetchmode = DB_FETCHMODE_ORDERED], [boolean $group = false], [string $action = 'search'], [array $params = array()])

Calls DB_common::getAssoc()
  • Return: an indexed array with the data from the first row at index 0, or a DB error code.
  • See: DB_common::getAssoc()
  • Access: public

Parameters:

array   $data     if supplied, prepare/execute will be used with this array as execute parameters
boolean   $group     see DB_Common::getAssoc()
string   $action     type of request to perform, defaults to search (ldap_search())
array   $params     array of additional parameters to pass to the PHP ldap function requested
$query   $query     the SQL query
$force_array   $force_array     (optional) used only when the query returns exactly two columns. If true, the values of the returned array will be one-element arrays instead of scalars. starting at 0] or string [column name])
$fetchmode   $fetchmode     the fetch mode to use

[ Top ]

getCol   [line 667]

array &getCol( $query $query, [$col $col = 0], [$data $data = array()], [string $action = 'search'], [array $params = array()])

Fetch the first column of data returned from a query. Takes care of doing the query and freeing the results when finished.
  • Return: an indexed array with the data from the first row at index 0, or a DB error code.
  • See: DB_common::getCol()
  • Access: public

Parameters:

string   $action     type of request to perform, defaults to search (ldap_search())
array   $params     array of additional parameters to pass to the PHP ldap function requested
$query   $query     the SQL query
$col   $col     which column to return (integer [column number, starting at 0] or string [column name])
$data   $data     array if supplied, prepare/execute will be used with this array as execute parameters

[ Top ]

getListOf   [line 736]

void getListOf( mixed $type)


[ Top ]

getOne   [line 617]

array &getOne( $query $query, [$data $data = array()], [string $action = 'search'], [array $params = array()])

Fetch the first column of the first row of data returned from a query. Takes care of doing the query and freeing the results when finished.
  • Access: public
  • See: DB_common::getOne()

Parameters:

string   $action     type of request to perform, defaults to search (ldap_search())
array   $params     array of additional parameters to pass to the PHP ldap function requested
$query   $query     the SQL query
$data   $data     if supplied, prepare/execute will be used with this array as execute parameters

[ Top ]

getRow   [line 640]

array &getRow( $query $query, [$fetchmode $data = null], [$data $fetchmode = DB_FETCHMODE_DEFAULT], [string $action = 'search'], [array $params = array()])

Fetch the first row of data returned from a query. Takes care of doing the query and freeing the results when finished.
  • Return: the first row of results as an array indexed from 0, or a DB error code.
  • See: DB_common::getRow()
  • Access: public

Parameters:

string   $action     type of request to perform, defaults to search (ldap_search())
array   $params     array of additional parameters to pass to the PHP ldap function requested
$query   $query     the SQL query
$fetchmode   $data     the fetch mode to use
$data   $fetchmode     array if supplied, prepare/execute will be used with this array as execute parameters

[ Top ]

getTables   [line 731]

void getTables( )


[ Top ]

isManip   [line 741]

void isManip( mixed $action)


[ Top ]

limitQuery   [line 595]

LDAP_result limitQuery( string $query, int $from, int $count, [string $action = 'search'], [array $params = array()])

Executes a query returning only a specified number of rows

This method only saves the $from and $count parameters for LDAP_result where the actual records processing takes place

  • Return: object or DB Error object if no result

Parameters:

string   $query     text of the request to send to the LDAP server
int   $from     record position from which to start returning data
int   $count     number of records to return
string   $action     type of request to perform, defaults to search (ldap_search())
array   $params     array of additional parameters to pass to the PHP ldap function requested

[ Top ]

modifyLimitQuery   [line 575]

modified modifyLimitQuery( string $query, int $from, int $count)

Modifies a query to return only a set of rows, stores $from and $count for LDAP_result
  • Return: query text (no modifications are made, see above)

Parameters:

string   $query     text of the request to send to the LDAP server
int   $from     record position from which to start returning data
int   $count     number of records to return

[ Top ]

nextId   [line 781]

a nextId( string $seq_name, [bool $ondemand = true])

Get the next value in a sequence.

LDAP provides transactions for only one entry and we need to prevent race condition. If unique value before and after modify aren't equal then wait and try again.

The name of sequence is LDAP DN of entry.

  • Return: sequence integer, or a DB error
  • Access: public

Parameters:

string   $seq_name     the DN of the sequence
bool   $ondemand     whether to create the sequence on demand

[ Top ]

numRows   [line 726]

void numRows( mixed $result)


[ Top ]

query   [line 548]

LDAP_result &query( string $query, [array $data = array()], [string $action = 'search'], [array $params = array()])

Executes a query substituting variables if any are present
  • Return: object or DB Error object if no result
  • See: DB_common::prepare() $this->execute()$this->simpleQuery()

Parameters:

string   $query     text of the request to send to the LDAP server
array   $data     query variables values to substitute
string   $action     type of request to perform, defaults to search (ldap_search())
array   $params     array of additional parameters to pass to the PHP ldap function requested

[ Top ]

simpleQuery   [line 416]

result simpleQuery( string $filter, [string $action = null], [array $params = null])

Performs a request against the LDAP server

The type of request (and the corresponding PHP ldap function called) depend on two additional parameters, added in respect to the DB_common interface.

  • Return: from ldap function or DB Error object if no result

Parameters:

string   $filter     text of the request to send to the LDAP server
string   $action     type of request to perform, defaults to search (ldap_search())
array   $params     array of additional parameters to pass to the PHP ldap function requested

[ Top ]


Documentation generated on Fri, 30 Apr 2004 21:35:27 +0200 by phpDocumentor 1.2.3. PEAR Logo Copyright © PHP Group 2004.