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, 23 Mar 2012

view this page in

PDOStatement sınıfı

(Bir sürüm bilgisi bulunamadı; sadece SVN'de olabilir.)

Giriş

Bir hazır deyimi ve hazır deyim çalıştırıldıktan sonra sonuç kümesini temsil eder.

Sınıf Sözdizimi

PDOStatement implements Traversable {
bool bindColumn ( mixed $sütun , mixed &$değişken [, int $veri_türü [, int $uzunluk [, mixed $seçenekler ]]] )
bool bindParam ( mixed $değiştirge , mixed &$değişken [, int $veri_türü [, int $uzunluk [, mixed $seçenekler ]]] )
bool bindValue ( mixed $değiştirge , mixed $değer [, int $veri_türü ] )
bool closeCursor ( void )
int columnCount ( void )
bool debugDumpParams ( void )
string errorCode ( void )
array errorInfo ( void )
bool execute ([ array $girdiler = array() ] )
mixed fetch ([ int $alım_tarzı = PDO::FETCH_BOTH [, int $göst_yönü = PDO::FETCH_ORI_NEXT [, int $göst_başlangıcı = 0 ]]] )
array fetchAll ([ int $alım_tarzı = PDO::FETCH_BOTH [, int $sütunnum [, array $değiştirgeler = array() ]]] )
string fetchColumn ([ int $sütunnum = 0 ] )
mixed fetchObject ([ string $sınıfadı [, array $değiştirgeler ]] )
mixed getAttribute ( int $öznitelik )
array getColumnMeta ( int $sütun )
bool nextRowset ( void )
int rowCount ( void )
bool setAttribute ( int $öznitelik , mixed $değer )
bool setFetchMode ( int $kip )
}

İçindekiler



add a note add a note User Contributed Notes PDOStatement
Dmitri Snytkine 25-Jul-2011 12: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 10: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