本文整理汇总了PHP中pg_lo_unlink函数的典型用法代码示例。如果您正苦于以下问题:PHP pg_lo_unlink函数的具体用法?PHP pg_lo_unlink怎么用?PHP pg_lo_unlink使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pg_lo_unlink函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testExecutePersist
public function testExecutePersist()
{
$fileIn = tempnam(sys_get_temp_dir(), 'PgOidIn');
file_put_contents($fileIn, 'content');
$lo = new PgLargeObject($fileIn);
$this->assertTrue($lo->isNew());
$this->assertTrue($lo->isChanged());
$this->assertFalse($lo->isDeleted());
$this->assertSame($lo->getFilePath(), $fileIn);
$task = new Persist($this->entityManager->recordManager);
$task->setObject($lo);
$this->assertTrue($task->execute($this->db));
$this->assertFalse($lo->isNew());
$this->assertFalse($lo->isChanged());
$this->assertFalse($lo->isDeleted());
$this->assertNull($lo->getFilePath());
// the task has been inserted correctly
$this->assertTrue(is_numeric($lo->getOid()));
$this->db->query(new PgQuery('BEGIN'));
$fileOut = tempnam(sys_get_temp_dir(), 'PgOidOut');
pg_lo_export($this->db->resource->get(), $lo->getOid(), $fileOut);
$this->db->query(new PgQuery('COMMIT'));
$this->assertFileEquals($fileIn, $fileOut);
pg_lo_unlink($this->db->resource->get(), $lo->getOid());
}
示例2: DB_lo_unlink
function DB_lo_unlink($c, $id)
{
if (strcmp(phpversion(), '4.2.0') < 0) {
return pg_lounlink($id, $c);
} else {
return pg_lo_unlink($c, $id);
}
}
示例3: deleteblob
public function deleteblob($oid)
{
$this->query = pg_query($this->dbhandle, "begin");
$blob = pg_lo_unlink($this->dbhandle, $oid);
pg_query($this->dbhandle, "commit");
return $blob;
//TODO: kontola, ali je bil query ok izveden!
}
示例4: exclusao
/**
* Exclui um objeto oid do Banco de dados
* @param integer $iOid
*
* Caso de Uso: Ao excluir um registro de uma tabela e eo campo for do tipo oid,
* Deve-se excluir o objeto do banco utilizando este método
*/
public static function exclusao($iOid)
{
$lTransacaoInterna = false;
global $conn;
if (!db_utils::inTransaction()) {
throw new Exception("Sem transação Ativa.");
}
return pg_lo_unlink($conn, $iOid);
}
示例5: deleteOID
/**
* delete an OID
*
* @param integer $OID
* @return mixed MDB2_OK on success or MDB2 Error Object on failure
* @access public
*/
function deleteOID($OID)
{
$db =& $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
$connection = $db->getConnection();
if (PEAR::isError($connection)) {
return $connection;
}
if (!@pg_lo_unlink($connection, $OID)) {
return $db->raiseError(null, null, null, 'Unable to unlink OID: ' . $OID, __FUNCTION__);
}
return MDB2_OK;
}
示例6: execute
public function execute(Pg $pg, $simulate = false)
{
if ($this->object->isNew()) {
return true;
}
// IMPORTANT: pg_lo fn's don't work outside a transaction
$pg->query(new Query('BEGIN'));
if (!($response = pg_lo_unlink($pg->resource->get(), $this->object->getOid()))) {
throw new QueryException("Unable to delete PgLargeObject {$this->object->getOid()}");
}
// IMPORTANT: pg_lo_import/export DO NOT WORK without a transaction!
$pg->query(new Query('COMMIT'));
$this->object->markDeleted();
return true;
}
示例7: pgsqlLOBUnlink
public function pgsqlLOBUnlink($oid)
{
return pg_lo_unlink($this->link, $oid);
}
示例8: loUnlink
public function loUnlink($oid)
{
assert('is_string($pathname)');
assert('is_int($oid)');
return pg_lo_unlink($this->_pg, $oid);
}
示例9: large_object_delete
function large_object_delete($oid)
{
trigger_before('large_object_delete', $this, $this);
$return = false;
#$result = pg_query($this->conn,"SELECT $field FROM $table WHERE $pkfield = '$pkvalue'");
#if (!$result) { trigger_error("Error in select file OID", E_USER_ERROR ); }
#$oid = pg_result($result,0,$field);
#if (!$oid) { trigger_error("Error in file OID result", E_USER_ERROR ); }
$result = @pg_query($this->conn, "BEGIN");
if (!$result) {
trigger_error("error starting l_o_d transaction: " . @pg_last_error($this->conn), E_USER_ERROR);
}
$result = @pg_lo_unlink($this->conn, $oid);
if (!$result) {
trigger_error("error in l_o_unlink: " . @pg_last_error($this->conn), E_USER_ERROR);
}
$result = @pg_query($this->conn, "COMMIT");
if (!$result) {
trigger_error("error committing l_o_d transaction: " . @pg_last_error($this->conn), E_USER_ERROR);
} else {
$return = true;
}
return $return;
}
示例10: dump
$req = $_POST['r'.$rn];
if( $req == 'connect' ) {
dump( 0 );
dump( 0 );
dump( 0 );
} elseif( substr($req,0,11) == 'blob_create' ) {
list($oid) = sscanf( $req, 'blob_create %u' );
pg_free_result( pg_query( $commit ? 'COMMIT' : 'ROLLBACK' ) );
pg_free_result( pg_query( 'BEGIN' ) );
$oid = pg_lo_create() or pgerr('lo_create failed');
pg_free_result( pg_query( 'COMMIT' ) );
pg_free_result( pg_query( 'BEGIN' ) );
dump($oid);
} elseif( substr($req,0,11) == 'blob_delete' ) {
list($oid) = sscanf( $req, 'blob_delete %u' );
$oid = pg_lo_unlink($oid) or pgerr('lo_unlink failed');
} elseif( substr($req,0,10) == 'blob_write' ) {
list($oid) = sscanf( $req, 'blob_write %s ' );
$bin = substr($req,12+strlen($oid));
$obj = pg_lo_open($oid,'w') or pgerr( 'lo_open failed' );
$res = pg_lo_write($obj,$bin) or pgerr( 'lo_write failed' );
pg_lo_close($obj);
dump($res);
} elseif( substr($req,0,9) == 'blob_read' ) {
list($oid) = sscanf( $req, 'blob_read %u' );
$obj = pg_lo_open($oid,'r') or pgerr( 'lo_open failed' );
pg_lo_seek($obj,0,PGSQL_SEEK_END);
$len = pg_lo_tell($obj);
pg_lo_seek($obj,0,PGSQL_SEEK_SET);
$res = pg_lo_read($obj,$len) or pgerr( 'lo_read failed' );
pg_lo_close($obj);
示例11: Unlink
function Unlink()
{
if (version_compare(phpversion(), "4.2.0", "ge") > 0) {
pg_lo_unlink($this->dbconnect, $this->oid);
}
}
示例12: lo_unlink
function lo_unlink($p_oid)
{
return pg_lo_unlink($this->db, $p_oid);
}
示例13: pg_lo_unlink
if (!$oid) {
echo "pg_lo_import() error\n";
}
if ($oid != 21003) {
echo "pg_lo_import() wrong id\n";
}
pg_lo_unlink($db, $oid);
pg_exec($db, 'commit');
echo "import LO from string\n";
pg_exec($db, 'begin');
$oid = pg_lo_import($db, __FILE__, "21004");
if (!$oid) {
echo "pg_lo_import() error\n";
}
if ($oid != 21004) {
echo "pg_lo_import() wrong id\n";
}
pg_lo_unlink($db, $oid);
pg_exec($db, 'commit');
echo "import LO using default connection\n";
pg_exec('begin');
$oid = pg_lo_import($db, __FILE__, 21005);
if (!$oid) {
echo "pg_lo_import() error\n";
}
if ($oid != 21005) {
echo "pg_lo_import() wrong id\n";
}
pg_lo_unlink($oid);
pg_exec('commit');
echo "OK";
示例14: lo_unlink
/**
*
*/
function lo_unlink($oid)
{
return pg_lo_unlink($this->connection, $oid);
}
示例15: BlobDelete
function BlobDelete($blob)
{
pg_query($this->_connectionID, 'begin');
$result = @pg_lo_unlink($blob);
pg_query($this->_connectionID, 'commit');
return $result;
}