PHP Doku:: Is used to bind values - function.cubrid-bind.html

Verlauf / Chronik / History: (23) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzDatenbankerweiterungenAnbieterspezifische DatenbankerweiterungenCubridCubrid Funktionencubrid_bind

Ein Service von Reinhard Neidl - Webprogrammierung.

Cubrid Funktionen

<<cubrid_affected_rows

cubrid_client_encoding>>

cubrid_bind

(PECL CUBRID >= 8.3.0)

cubrid_bindIs used to bind values

Beschreibung

int cubrid_bind ( resource $req_identifier , int $bind_index , string $bind_value [, string $bind_value_type ] )

The cubrid_bind() function is used to bind values in a cubrid_prepare() variable, a various types in PHP and corresponding types in SQL. If bind_value_type is not given, string will be the default.

Hinweis:

Collection type (set, multiset or sequence) value can't be bind now.

Hinweis:

Known issue: If column data type is CLOB, binding parameter will fail. This bug will fixed later, better use BLOB now.

Parameter-Liste

req_identifier

Request identifier as a result of cubrid_prepare().

bind_index

Index for binding.

bind_value

Actual value for binding.

bind_index

A type of the value to bind. (It is omitted by default. Thus, system internally use string by default. However, you need to specify the exact type of the value as an argument when they are NCHAR, BIT, or BLOB/CLOB).

Rückgabewerte

TRUE, when process is successful.

FALSE, when process is unsuccessful.

Changelog

Version Beschreibung
8.3.1 Added BLOB/CLOB data types support.

Beispiele

Beispiel #1 cubrid_bind() example

<?php
$con 
cubrid_connect("dbsvr.cubrid.com"12345"demodb");
if (
$con) {
    
$sql "insert into tbl values (?,?,?)"
    
$req cubrid_prepare($con$sqlCUBRID_INCLUDE_OID); 

    
$i 0;
    while (
$i 2) { 
        
$res cubrid_bind($req1"1""NUMBER"); 
        
$res cubrid_bind($req2"2"); 
        
$res cubrid_bind($req3"04:22:34 PM 08/07/2007"); 
        
$res cubrid_execute$req );  
        
$i $i 1
    }

?>

Beispiel #2 cubrid_bind() BLOB/CLOB example

<?php
$con 
cubrid_connect ("localhost"33000"foo");
if (
$con) {
    
$sql "INSERT INTO php_cubrid_lob_test(doc_content) VALUES(?)"
    
$req cubrid_prepare($con$sql); 

    
$fp fopen("book.txt""rb");

    
cubrid_bind($req1$fp"blob"); 
    
cubrid_execute($req);  
}
?>

Siehe auch


Keine BenutzerBeiträge.
- Beiträge aktualisieren...



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)