downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

PDOStatement::bindColumn> <PDO::setAttribute
[edit] Last updated: Fri, 10 Feb 2012

view this page in

La classe PDOStatement

(No version information available, might only be in SVN)

Introduction

Représente une requête préparée et, une fois exécutée, le jeu de résultats associé.

Synopsis de la classe

PDOStatement implements Traversable {
/* Propriétés */
/* Méthodes */
bool PDOStatement::bindColumn ( mixed $column , mixed &$param [, int $type [, int $maxlen [, mixed $driverdata ]]] )
bool PDOStatement::bindParam ( mixed $parameter , mixed &$variable [, int $data_type = PDO::PARAM_STR [, int $length [, mixed $driver_options ]]] )
bool PDOStatement::bindValue ( mixed $parameter , mixed $value [, int $data_type = PDO::PARAM_STR ] )
string PDOStatement::errorCode ( void )
array PDOStatement::errorInfo ( void )
bool PDOStatement::execute ([ array $input_parameters ] )
mixed PDOStatement::fetch ([ int $fetch_style [, int $cursor_orientation = PDO::FETCH_ORI_NEXT [, int $cursor_offset = 0 ]]] )
array PDOStatement::fetchAll ([ int $fetch_style [, mixed $fetch_argument [, array $ctor_args = array() ]]] )
string PDOStatement::fetchColumn ([ int $column_number = 0 ] )
mixed PDOStatement::fetchObject ([ string $class_name = "stdClass" [, array $ctor_args ]] )
mixed PDOStatement::getAttribute ( int $attribute )
array PDOStatement::getColumnMeta ( int $column )
bool PDOStatement::setAttribute ( int $attribute , mixed $value )
bool PDOStatement::setFetchMode ( int $mode )
}

Propriétés

queryString

chaîne de caractères utilisée pour la requête.

Sommaire



add a note add a note User Contributed Notes PDOStatement
Dmitri Snytkine 25-Jul-2011 06:17
It looks like cloning PDOStatement object does not make any sense because while clone($sth) will not generate any errors, the returned object is not a new object but a reference to original PDOStatement object $sth.
rosko at zeta dot org dot au 02-Dec-2009 05:50
There are many references around for returning a refcursor from a pgSQL function using pg_query. All essentially boil down to executing the following single statement (or some variation of it):

 begin; select yourFunction(params...); fetch all in cursorname; commit;

In PDO, this doesn't work because PDO won't allow multiple statements submitted as a single statement (due to SQL injection detection). Instead, try this or similar:

<?php
$sql
= 'select yourFunction(params...)';
$db = new PDO('pgsql:dbname=yourDBname');
$db->beginTransaction();
$cmd = $db->prepare($sql);
if (
$cmd->execute()) {
  if (
$query = $db->query('fetch all in cursorname')) {
    ...
processing...
   
$query->closeCursor();
   
$cmd->closeCursor();
  }
}
$db->commit();
?>

 
show source | credits | stats | sitemap | contact | advertising | mirror sites