Heim  >  Artikel  >  php教程  >  PHP处理Oracle的CLOB

PHP处理Oracle的CLOB

WBOY
WBOYOriginal
2016-06-06 19:54:241748Durchsuche

1. 写入数据 在使用 PDO 的预处理方法时,如果使用 bindParam() 等而不指定字段的数据类型或使用 execute() , PDO 都会默认为 string 类型,并且限定一个默认长度 所以在存 clob 类型字段时必须使用 bindParam() 或 bindValue() 等,并指定字符串长度,例如

1.       写入数据

 

在使用PDO的预处理方法时,如果使用bindParam()等而不指定字段的数据类型或使用execute()PDO都会默认为string类型,并且限定一个默认长度

所以在存clob类型字段时必须使用bindParam()bindValue()等,并指定字符串长度,例如 $pdo -> bindParam(‘:clobData’, $clobData, PDO::PARAM_STR,strlen($clobData));

 

 

2.       读取数据

 

PDO取出的CLOB字段值在该字段不为空时是资源标识符,为空时为空字符串,取数据方法如下

$arr = $pdo -> fetch();

is_resource($arr[‘clob’]) && $arr[‘clob’] =stream_get_contents($arr[‘clob’]);

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn