Home
Accueil
Downloads
Téléchargements
Forums
Forums
Your Account
Votre compte
Menu
· Accueil ·

· Communication ·
  · Forums
  · Messages privés
  · Contactez nous
  · Recommendez nous
  · Sondages
  · Les projets

· Nouvelles ·Stats
  · Sujets
  · Ecrire un article
  · Articles archivés
  · Articles RSS
  · Lettre de sécurité
  · Archive de lettres

· Téléchargements ·
  · Accueil
  · Nouveautés
  · Mises à jour
  · Thêmes

· Outils ·
  · Outils divers
  · Convertisseur de temps
  · Table de caractères
  · Générateur de boutons
  · Compresseur Javascript

· Documentation ·
  · Wiki
  · Questions/Réponses
  · Documents
  · Manuel PHP-Nuke
  · Manuel PHP
  · Manuel PEAR
  · Encyclopédies

· Liens ·
  · Nos liens
  · Nos fluxs RSS
  · Partenaires
  · Votre publicité
  · Sitemap
  · Mes bannières

· Infos ·
  · Rechercher
  · Votre compte
  · Liste des membres
  · Carte des membres
  · Top

· Divers ·
  · Météo
  · Galeries
  · Statistiques Phpnuke
  · MS Analysis


Connecting

Connecting

Connecting -- Connecting and disconnecting a database

Description

To instantiate a database object you have several methods available using MDB2.

To connect to a database you have to use the function factory(), connect() or singleton(), which require a valid DSN as the first parameter. This parameter can either be a string or an array. If using an array, the array used gets merged with the default information:
$dsn = array(
    'phptype'  => false,
    'dbsyntax' => false,
    'username' => false,
    'password' => false,
    'protocol' => false,
    'hostspec' => false,
    'port'     => false,
    'socket'   => false,
    'database' => false,
    'new_ink'  => false,
);
Any elements you set override the defaults and the remainder stay at their defaults.

The second parameter is the optional $options array that can contain runtime configuration settings for this package.

Tableau 33-2. List of options

NameTypeDescription
sslboolean determines if ssl should be used for connections
field_caseinteger CASE_LOWER|CASE_UPPER: determines what case to force on field/table names
disable_queryboolean determines if queries should be executed
result_classstring class used for result sets
buffered_result_classstring class used for buffered result sets, default is MDB2_Result_Common
result_wrap_classstring class used to wrap result sets into, default is MDB2_Result_Common
result_bufferingboolean should results be buffered or not?
fetch_classstring class to use when fetch mode object is used
persistentboolean persistent connection?
debuginteger numeric debug level
debug_handlerstring function/method that captures debug messages
debug_expanded_outputboolean BC option to determine if more context information should be send to the debug handler
default_text_field_lengthinteger default text field length to use
lob_buffer_lengthinteger LOB buffer length
log_line_breakstring line-break format
idxname_formatstring pattern with '%s' for index name
seqname_formatstring pattern with '%s' for sequence name
savepoint_formatstring pattern with '%s' for auto generated savepoint names
seqcol_namestring sequence column name
quote_identifierboolean if identifier quoting should be done when check_option is used
use_transactionsboolean if transaction use should be enabled
decimal_placesinteger number of decimal places to handle
portabilityinteger portability constant
modulesarray short to long module name mapping for __call()
emulate_preparedboolean force prepared statements to be emulated
datatype_maparray map user defined datatypes to other primitive datatypes
'datatype_map_callbackarray callback function/method that should be called

In case of success you get a new instance of the database class. It is strongly recommened to check this return value with PEAR::isError() (will detect PEAR_Error or any subclass) or the MDB2_Driver_Common specific isError().

To disconnect use the method disconnect() from your database class instance.


Manuel PEAR pour PHP-Nuke © www.stefvar.com
Syndiquez notre contenu RSS, Atom, etc..
PHP-Nuke © 2007Reproduction interdite sans autorisation de ma part www.stefvar.com Copyright © 2008Thème iCGstation
Site français de la communauté PragmaMx