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

Class: DB_ldap

Source Location: /DB_ldap-1.2.1/DB/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 309]
LDAP DB interface class

LDAP extends DB_common to provide DB compliant access to LDAP servers



[ Top ]


Method Detail

DB_ldap (Constructor)   [line 364]

DB_ldap DB_ldap( )

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

[ Top ]

base   [line 834]

void base( [ $base = null])


Parameters:

   $base   — 

[ Top ]

connect   [line 405]

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 952]

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 460]

int disconnect( )

Unbinds from LDAP server
  • Return: return value

[ Top ]

dropSequence   [line 980]

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 573]

LDAP_result execute( string $stmt, [array $data = false], [string $action = null], [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 599]

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

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
   &$data   — 

[ Top ]

freeQuery   [line 823]

void freeQuery( [ $query = ''])


Parameters:

   $query   — 

[ Top ]

freeResult   [line 818]

void freeResult( )


[ Top ]

getAll   [line 787]

array &getAll( $query $query, [array $data = null], [$fetchmode $fetchmode = DB_FETCHMODE_DEFAULT], [string $action = null], [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 764]

array &getAssoc( $query $query, [$force_array $force_array = false], [array $data = array()], [$fetchmode $fetchmode = DB_FETCHMODE_ORDERED], [boolean $group = false], [string $action = null], [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 737]

array &getCol( $query $query, [$col $col = 0], [$data $data = array()], [string $action = null], [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 808]

void getListOf( $type)


Parameters:

   $type   — 

[ Top ]

getOne   [line 687]

array &getOne( $query $query, [$data $data = array()], [string $action = null], [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.
  • See: DB_common::getOne()
  • 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
$data   $data   —  if supplied, prepare/execute will be used with this array as execute parameters

[ Top ]

getRow   [line 710]

array &getRow( $query $query, [$fetchmode $data = null], [$data $fetchmode = DB_FETCHMODE_DEFAULT], [string $action = null], [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 803]

void getTables( )


[ Top ]

isManip   [line 813]

void isManip( $action)


Parameters:

   $action   — 

[ Top ]

ldapRaiseError   [line 994]

void ldapRaiseError( [ $errno = null])


Parameters:

   $errno   — 

[ Top ]

ldapSetAction   [line 847]

void ldapSetAction( [ $action = 'search'])


Parameters:

   $action   — 

[ Top ]

ldapSetBase   [line 840]

void ldapSetBase( [ $base = null])


Parameters:

   $base   — 

[ Top ]

limitQuery   [line 665]

LDAP_result limitQuery( string $query, int $from, int $count, [string $action = null], [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 645]

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 871]

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 798]

void numRows( $result)


Parameters:

   $result   — 

[ Top ]

query   [line 616]

LDAP_result &query( string $query, [array $data = array()], [string $action = null], [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 480]

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 Mon, 11 Mar 2019 15:46:33 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.