function most_similar(&$context, $string, $source_str) { // decode the data retrieved from the database $string = sqlite_udf_decode_binary($string); $sim = similar_text($string, $source_str); if (empty($context) || $sim > $context['sim']) { $context = array('sim' => $sim, 'title' => $string); } }
/** * Performs sqlite_udf_decode_binary on binary data. * @see ResultSet::getBlob() */ public function getBlob($column) { $idx = is_int($column) ? $column - 1 : $column; if (!array_key_exists($idx, $this->fields)) { throw new SQLException("Invalid resultset column: " . $column); } if ($this->fields[$idx] === null) { return null; } require_once 'creole/util/Blob.php'; $b = new Blob(); $b->setContents(sqlite_udf_decode_binary($this->fields[$idx])); return $b; }
function sqlitem_udf_decode_binary($data) { die('sqlitem_udf_decode_binary not implemented in PDO'); return sqlite_udf_decode_binary($data); }
function sqlitem_udf_decode_binary($data) { return sqlite_udf_decode_binary($data); }
public function unquoteBinary($data) { return sqlite_udf_decode_binary($data); }
$x = @zip_entry_open($r, $e); for ($i = 0; $i < 1000; $i++) { $arr[$i] = array(array("")); } unset($arr[600]); @zip_entry_read($e, -1); unset($arr[601]); break; case 'dos17': $z = "UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU"; $y = "DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD"; $x = "AQ "; unset($z); unset($y); $x = base64_decode($x); $y = @sqlite_udf_decode_binary($x); unset($x); break; case 'dos18': $MSGKEY = 519052; $msg_id = @msg_get_queue($MSGKEY, 0600); if (!@msg_send($msg_id, 1, 'AAAABBBBCCCCDDDDEEEEFFFFGGGGHHHH', false, true, $msg_err)) { echo "Msg not sent because {$msg_err}\n"; } if (@msg_receive($msg_id, 1, $msg_type, 0xffffffff, $_SESSION, false, 0, $msg_error)) { echo "{$msg}\n"; } else { echo "Received {$msg_error} fetching message\n"; break; } @msg_remove_queue($msg_id);
/** * This method return decoded binary data * * @param string $content binary data * @access public * @return string */ function decodeBinary($content) { return sqlite_udf_decode_binary($content); }
<?php // string escaping $str = "foo ' '' \\' \\ \" \\\""; echo sqlite_escape_string($str) . "\n"; $str = "this has a " . chr(0) . " char in the middle"; echo sqlite_escape_string($str) . "\n"; // encodeing/decoding binary $data = array("hello there", "this has a " . chr(0) . " char in the middle", chr(1) . " this has an 0x01 at the start", "this has " . chr(1) . " in the middle", ""); foreach ($data as $item) { echo "raw: {$item}\n"; $coded = sqlite_udf_encode_binary($item); echo "coded: {$coded}\n"; $decoded = sqlite_udf_decode_binary($coded); echo "decoded: {$decoded}\n"; if ($item != $decoded) { echo "FAIL:\n"; echo "[{$item}]\n"; echo "[{$decoded}]\n"; } } ?>
function dbi_get_blob($table, $column, $key) { global $unavail_DBI_Update_blob; assert('! empty ( $table )'); assert('! empty ( $column )'); assert('! empty ( $key )'); $res = dbi_execute('SELECT ' . $column . ' FROM ' . $table . ' WHERE ' . $key); if (!$res) { return false; } $ret = ''; if ($row = dbi_fetch_row($res)) { if (strcmp($GLOBALS['db_type'], 'mysql') == 0 || strcmp($GLOBALS['db_type'], 'mssql') == 0) { $ret = $row[0]; } elseif (strcmp($GLOBALS['db_type'], 'sqlite') == 0) { $ret = sqlite_udf_decode_binary($row[0]); } elseif (strcmp($GLOBALS['db_type'], 'postgresql') == 0) { $ret = pg_unescape_bytea($row[0]); } else { // TODO! die_miserable_death($unavail_DBI_Update_blob); } } dbi_free_result($res); return $ret; }