本文整理匯總了PHP中MetabaseLOBError函數的典型用法代碼示例。如果您正苦於以下問題:PHP MetabaseLOBError函數的具體用法?PHP MetabaseLOBError怎麽用?PHP MetabaseLOBError使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了MetabaseLOBError函數的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: DumpDatabase
//.........這裏部分代碼省略.........
if ($support_summary_functions = MetabaseSupport($this->database, "SummaryFunctions")) {
if (($result = MetabaseQuery($this->database, "SELECT COUNT(*) FROM {$table_name}")) == 0) {
return MetabaseError($this->database);
}
$rows = MetabaseFetchResult($this->database, $result, 0, 0);
MetabaseFreeResult($this->database, $result);
}
if (($result = MetabaseQuery($this->database, "SELECT {$query_fields} FROM {$table_name}")) == 0) {
return MetabaseError($this->database);
}
if (!$support_summary_functions) {
$rows = MetabaseNumberOfRows($this->database, $result);
}
if ($rows > 0) {
$output("{$eol} <initialization>{$eol}");
for ($row = 0; $row < $rows; $row++) {
$output("{$eol} <insert>{$eol}");
for (Reset($fields), $field_number = 0; $field_number < count($fields); $field_number++, Next($fields)) {
$field_name = Key($fields);
if (!MetabaseResultIsNull($this->database, $result, $row, $field_name)) {
$field = $fields[$field_name];
$output("{$eol} <field>{$eol} <name>{$field_name}</name>{$eol} <value>");
switch ($field["type"]) {
case "integer":
case "text":
$output($this->EscapeSpecialCharacters(MetabaseFetchResult($this->database, $result, $row, $field_name)));
break;
case "clob":
if (!($lob = MetabaseFetchCLOBResult($this->database, $result, $row, $field_name))) {
return MetabaseError($this->database);
}
while (!MetabaseEndOfLOB($lob)) {
if (MetabaseReadLOB($lob, $data, 8000) < 0) {
return MetabaseLOBError($lob);
}
$output($this->EscapeSpecialCharacters($data));
}
MetabaseDestroyLOB($lob);
break;
case "blob":
if (!($lob = MetabaseFetchBLOBResult($this->database, $result, $row, $field_name))) {
return MetabaseError($this->database);
}
while (!MetabaseEndOfLOB($lob)) {
if (MetabaseReadLOB($lob, $data, 8000) < 0) {
return MetabaseLOBError($lob);
}
$output(bin2hex($data));
}
MetabaseDestroyLOB($lob);
break;
case "float":
$output($this->EscapeSpecialCharacters(MetabaseFetchFloatResult($this->database, $result, $row, $field_name)));
break;
case "decimal":
$output($this->EscapeSpecialCharacters(MetabaseFetchDecimalResult($this->database, $result, $row, $field_name)));
break;
case "boolean":
$output($this->EscapeSpecialCharacters(MetabaseFetchBooleanResult($this->database, $result, $row, $field_name)));
break;
case "date":
$output($this->EscapeSpecialCharacters(MetabaseFetchDateResult($this->database, $result, $row, $field_name)));
break;
case "timestamp":
$output($this->EscapeSpecialCharacters(MetabaseFetchTimestampResult($this->database, $result, $row, $field_name)));
break;
示例2: GetBLOBFieldValue
function GetBLOBFieldValue($prepared_query, $parameter, $blob, &$value)
{
for ($value = "'"; !MetabaseEndOfLOB($blob);) {
if (!MetabaseReadLOB($blob, $data, $this->lob_buffer_length)) {
$value = "";
return $this->SetError("Get BLOB field value", MetabaseLOBError($blob));
}
$value .= AddSlashes($data);
}
$value .= "'";
return 1;
}
示例3: GetLOBFieldValue
function GetLOBFieldValue($prepared_query, $parameter, $lob, &$value, $binary)
{
if (!$this->Connect(0)) {
return 0;
}
for ($blob_data = ""; !MetabaseEndOfLOB($lob);) {
if (MetabaseReadLOB($lob, $data, $this->lob_buffer_length) < 0) {
return $this->SetError("Get LOB field value", MetabaseLOBError($lob));
}
$blob_data .= $data;
}
if (!($blob = ifx_create_blob($binary ? 0 : 1, 0, $blob_data))) {
return $this->SetIFXError("Get LOB field value", "Could not create a blob");
}
if (!isset($this->query_parameters[$prepared_query])) {
$this->query_parameters[$prepared_query] = $this->query_parameter_values[$prepared_query] = array();
}
$query_parameter = count($this->query_parameters[$prepared_query]);
$this->query_parameter_values[$prepared_query][$parameter] = $query_parameter;
$this->query_parameters[$prepared_query][$query_parameter] = $blob;
$value = "?";
return 1;
}
示例4: GetLOBFieldValue
function GetLOBFieldValue($prepared_query, $parameter, $lob, &$value)
{
if (!$this->Connect()) {
return 0;
}
$success = 1;
if ($blob = ibase_blob_create($this->auto_commit ? $this->connection : $this->transaction_id)) {
while (!MetabaseEndOfLOB($lob)) {
if (MetabaseReadLOB($lob, $data, $this->lob_buffer_length) < 0) {
$this->SetError("Get LOB field value", MetabaseLOBError($lob));
$success = 0;
break;
}
if (!ibase_blob_add($blob, $data)) {
$this->SetError("Get LOB field value", "Could not add data to a large object: " . ibase_errmsg());
$success = 0;
break;
}
}
if ($success) {
if (GetType($value = ibase_blob_close($blob))) {
if (!isset($this->query_parameters[$prepared_query])) {
$this->query_parameters[$prepared_query] = array(0, "");
$this->query_parameter_values[$prepared_query] = array();
}
$query_parameter = count($this->query_parameters[$prepared_query]);
$this->query_parameter_values[$prepared_query][$parameter] = $query_parameter;
$this->query_parameters[$prepared_query][$query_parameter] = $value;
$value = "?";
} else {
$success = 0;
}
}
if (!$success) {
ibase_blob_cancel($blob);
}
} else {
$this->SetError("Get LOB field value", "Could not create a large object: " . ibase_errmsg());
$success = 0;
}
return $success;
}
示例5: GetLOBFieldValue
function GetLOBFieldValue($prepared_query, $parameter, $lob, &$value)
{
if (!$this->Connect()) {
return 0;
}
if ($this->auto_commit && !@pg_Exec($this->connection, "BEGIN")) {
return 0;
}
$success = 1;
if ($lo = pg_locreate($this->connection)) {
if ($handle = pg_loopen($this->connection, $lo, "w")) {
while (!MetabaseEndOfLOB($lob)) {
if (MetabaseReadLOB($lob, $data, $this->lob_buffer_length) < 0) {
$this->SetError("Get LOB field value", MetabaseLOBError($lob));
$success = 0;
break;
}
if (!pg_lowrite($handle, $data)) {
$this->SetError("Get LOB field value", pg_ErrorMessage($this->connection));
$success = 0;
break;
}
}
pg_loclose($handle);
if ($success) {
$value = strval($lo);
}
} else {
$this->SetError("Get LOB field value", pg_ErrorMessage($this->connection));
$success = 0;
}
if (!$success) {
pg_lounlink($this->connection, $lo);
}
} else {
$this->SetError("Get LOB field value", pg_ErrorMessage($this->connection));
$success = 0;
}
if ($this->auto_commit) {
@pg_Exec($this->connection, "END");
}
return $success;
}
示例6: value
} else {
$success = 0;
$error = "could not reopen the character lob data file";
}
}
if ($success) {
if (strcmp($value, $character_data)) {
$pass = 0;
echo "FAILED!{$eol}";
$failed++;
echo "Test {$test}: retrieved character LOB value (\"" . $value . "\") is different from what was stored (\"" . $character_data . "\"){$eol}";
} else {
$binary_lob = array("Type" => "outputfile", "Database" => $database, "Result" => $result, "Row" => 0, "Field" => "picture", "Binary" => 1, "Error" => "", "FileName" => $binary_data_file, "BufferLength" => 32);
if ($success = MetabaseCreateLOB($binary_lob, $blob)) {
if (MetabaseReadLOB($blob, $data, 0) < 0) {
$error = MetabaseLOBError($clob);
$success = 0;
}
MetabaseDestroyLOB($blob);
if ($success) {
if ($file = fopen($binary_data_file, "rb")) {
if (GetType($value = fread($file, filesize($binary_data_file))) != "string") {
$success = 0;
$error = "could not read from the binary lob data file";
}
fclose($file);
} else {
$success = 0;
$error = "could not reopen the binary lob data file";
}
}
示例7: ReadLOB
function ReadLOB(&$data, $length)
{
$buffer_length = $length == 0 ? $this->buffer_length : min($this->buffer_length, $length);
for ($written = 0; !MetabaseEndOfLOB($this->input_lob) && ($length == 0 || $written < $buffer_length); $written += $read) {
if (MetabaseReadLOB($this->input_lob, $buffer, $buffer_length) == -1) {
$this->error = MetabaseLOBError($this->input_lob);
return -1;
}
$read = strlen($buffer);
if (@fwrite($this->file, $buffer, $read) != $read) {
$this->error = "could not write to the output file";
return -1;
}
}
return $written;
}
示例8: DoQuery
function DoQuery($query, $first = 0, $limit = 0, $prepared_query = 0)
{
$lobs = 0;
$success = 1;
$result = 0;
$descriptors = array();
if ($prepared_query) {
$columns = "";
$variables = "";
for (Reset($this->clobs[$prepared_query]), $clob = 0; $clob < count($this->clobs[$prepared_query]); $clob++, Next($this->clobs[$prepared_query])) {
$position = Key($this->clobs[$prepared_query]);
if (GetType($descriptors[$position] = OCINewDescriptor($this->connection, OCI_D_LOB)) != "object") {
$this->SetError("Do query", "Could not create descriptor for clob parameter");
$success = 0;
break;
}
$columns .= ($lobs == 0 ? " RETURNING " : ",") . $this->prepared_queries[$prepared_query - 1]["Fields"][$position - 1];
$variables .= ($lobs == 0 ? " INTO " : ",") . ":clob" . $position;
$lobs++;
}
if ($success) {
for (Reset($this->blobs[$prepared_query]), $blob = 0; $blob < count($this->blobs[$prepared_query]); $blob++, Next($this->blobs[$prepared_query])) {
$position = Key($this->blobs[$prepared_query]);
if (GetType($descriptors[$position] = OCINewDescriptor($this->connection, OCI_D_LOB)) != "object") {
$this->SetError("Do query", "Could not create descriptor for blob parameter");
$success = 0;
break;
}
$columns .= ($lobs == 0 ? " RETURNING " : ",") . $this->prepared_queries[$prepared_query - 1]["Fields"][$position - 1];
$variables .= ($lobs == 0 ? " INTO " : ",") . ":blob" . $position;
$lobs++;
}
$query .= $columns . $variables;
}
}
if ($success) {
if ($statement = OCIParse($this->connection, $query)) {
if ($lobs) {
for (Reset($this->clobs[$prepared_query]), $clob = 0; $clob < count($this->clobs[$prepared_query]); $clob++, Next($this->clobs[$prepared_query])) {
$position = Key($this->clobs[$prepared_query]);
if (!OCIBindByName($statement, ":clob" . $position, $descriptors[$position], -1, OCI_B_CLOB)) {
$this->SetOCIError("Do query", "Could not bind clob upload descriptor", OCIError($statement));
$success = 0;
break;
}
}
if ($success) {
for (Reset($this->blobs[$prepared_query]), $blob = 0; $blob < count($this->blobs[$prepared_query]); $blob++, Next($this->blobs[$prepared_query])) {
$position = Key($this->blobs[$prepared_query]);
if (!OCIBindByName($statement, ":blob" . $position, $descriptors[$position], -1, OCI_B_BLOB)) {
$this->SetOCIError("Do query", "Could not bind blob upload descriptor", OCIError($statement));
$success = 0;
break;
}
}
}
}
if ($success) {
if ($result = @OCIExecute($statement, $lobs == 0 && $this->auto_commit ? OCI_COMMIT_ON_SUCCESS : OCI_DEFAULT)) {
if ($lobs) {
for (Reset($this->clobs[$prepared_query]), $clob = 0; $clob < count($this->clobs[$prepared_query]); $clob++, Next($this->clobs[$prepared_query])) {
$position = Key($this->clobs[$prepared_query]);
$clob_stream = $this->prepared_queries[$prepared_query - 1]["Values"][$position - 1];
for ($value = ""; !MetabaseEndOfLOB($clob_stream);) {
if (MetabaseReadLOB($clob_stream, $data, $this->lob_buffer_length) < 0) {
$this->SetError("Do query", MetabaseLOBError($clob));
$success = 0;
break;
}
$value .= $data;
}
if ($success && !$descriptors[$position]->save($value)) {
$this->SetOCIError("Do query", "Could not upload clob data", OCIError($statement));
$success = 0;
}
}
if ($success) {
for (Reset($this->blobs[$prepared_query]), $blob = 0; $blob < count($this->blobs[$prepared_query]); $blob++, Next($this->blobs[$prepared_query])) {
$position = Key($this->blobs[$prepared_query]);
$blob_stream = $this->prepared_queries[$prepared_query - 1]["Values"][$position - 1];
for ($value = ""; !MetabaseEndOfLOB($blob_stream);) {
if (MetabaseReadLOB($blob_stream, $data, $this->lob_buffer_length) < 0) {
$this->SetError("Do query", MetabaseLOBError($blob));
$success = 0;
break;
}
$value .= $data;
}
if ($success && !$descriptors[$position]->save($value)) {
$this->SetOCIError("Do query", "Could not upload blob data", OCIError($statement));
$success = 0;
}
}
}
}
if ($this->auto_commit) {
if ($lobs) {
if ($success) {
if (!OCICommit($this->connection)) {
$this->SetOCIError("Do query", "Could not commit pending LOB updating transaction", OCIError());
//.........這裏部分代碼省略.........
示例9: GetLOBFieldValue
function GetLOBFieldValue($prepared_query, $parameter, $lob, &$value)
{
if (!isset($this->query_parameters[$prepared_query])) {
$this->query_parameters[$prepared_query] = $this->query_parameter_values[$prepared_query] = array();
}
$query_parameter = count($this->query_parameters[$prepared_query]);
$this->query_parameter_values[$prepared_query][$parameter] = $query_parameter;
for ($this->query_parameters[$prepared_query][$query_parameter] = ""; !MetabaseEndOfLOB($lob);) {
if (MetabaseReadLOB($lob, $data, $this->lob_buffer_length) < 0) {
$this->FreeLOBValue($prepared_query, $lob, $value, 0);
return $this->SetError("Get LOB field value", MetabaseLOBError($clob));
}
$this->query_parameters[$prepared_query][$query_parameter] .= $data;
}
$value = "?";
return 1;
}