|
|
@@ -628,4 +628,29 @@ EOF_STRUCT_MYSQL;
|
|
|
return $sth->rowCount();
|
|
|
}
|
|
|
|
|
|
+ public function getBlob($tableName, $fieldName, $pkField, $primaryKey) {
|
|
|
+ if (empty($tableName)) throw new Exception("Missing tableName in PDO::getBlob");
|
|
|
+ if (empty($fieldName)) throw new Exception("Missing fieldName in PDO::getBlob");
|
|
|
+ if (empty($pkField)) throw new Exception("Missing pkField in PDO::getBlob");
|
|
|
+ if (empty($primaryKey)) throw new Exception("Missing primaryKey in PDO::getBlob");
|
|
|
+ $dbType = $this->getType();
|
|
|
+ switch ($dbType) {
|
|
|
+ case 'mysql': {
|
|
|
+ $sql = "
|
|
|
+ select `{$fieldName}`
|
|
|
+ from `{$tableName}`
|
|
|
+ where `{$pkField}` = :pk
|
|
|
+ limit 1
|
|
|
+ ";
|
|
|
+ $sth = $this->prepare($sql);
|
|
|
+ $sth->bindValue(':pk', $primaryKey, PDO::PARAM_STR);
|
|
|
+ $sth->execute();
|
|
|
+ $sth->bindColumn(1, $content, PDO::PARAM_LOB);
|
|
|
+ $sth->fetch();
|
|
|
+ return $content;
|
|
|
+ } break;
|
|
|
+ default: throw new Exception("Not implemented getBlob for database type '{$dbType}'");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|