コード例 #1
0
    } else {
        echo "Something weird happened: " . $e->getMessage() . " (errcode=" . $e->getCode() . ")\n";
    }
    exit(1);
}
echo "Document retrieved: " . print_r($doc, true) . "\n";
/**
* Finally, deleting a document is achieved using deleteDoc
*
*
*
*/
echo "#### Deleting document \"some_doc\"\n";
echo "delete using previous \$doc object : \$client->deleteDoc(\$doc)\n";
try {
    $result = $client->deleteDoc($doc);
} catch (Exception $e) {
    echo "Something weird happened: " . $e->getMessage() . " (errcode=" . $e->getCode() . ")\n";
    exit(1);
}
echo "Doc deleted, CouchDB response body: " . print_r($result, true) . "\n";
/**
* Finally delete database
*
*
*
*/
try {
    $result = $client->deleteDatabase();
} catch (Exception $e) {
    echo "Something weird happened: " . $e->getMessage() . " (errcode=" . $e->getCode() . ")\n";
コード例 #2
0
ファイル: cabinet.php プロジェクト: klawd-prime/stack
 /**
  * Delete a file
  *
  * @param File $file
  */
 public function deleteFile(File $file)
 {
     $this->client->deleteDoc($file->getDocument());
 }
コード例 #3
0
ファイル: delete.php プロジェクト: T-TEL/TelBel
<?php

session_start();
include "../secure/talk2db.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title></title>
<?php 
if (isset($_GET['resid'])) {
    global $couchUrl;
    global $facilityId;
    $resources = new couchClient($couchUrl, "ttel_resources");
    $doc = $resources->getDoc($_GET['resid']);
    $resources->deleteDoc($doc);
    echo '<script type="text/javascript">alert("Successfully Deleted");</script>';
}
?>
</head>

<body>
</body>
</html>
コード例 #4
0
	/**
	* Permanently removes a CouchDB User
	*
	*
	* @param string $login user login
	* @return stdClass CouchDB server response
	*/
	public function deleteUser ( $login ) {
		if ( strlen($login) < 1 ) {
			throw new InvalidArgumentException("Login can't be empty");
		}
		$client = new couchClient( $this->client->dsn() , $this->usersdb);
		$doc = $client->getDoc("org.couchdb.user:".$login);
		return $client->deleteDoc($doc);
	}
コード例 #5
0
\t\t\t\t\t\t</select>
\t\t\t\t\t</td>
\t\t\t\t</tr>
\t\t\t\t<tr>
\t\t\t\t\t<td></td>
\t\t\t\t\t<td><input type="submit" name="update" value="Update"></td>
\t\t\t\t<tr>
\t\t\t</table>
\t\t\t</form>
table;
            break;
        case 'delete':
            // delete doc
            if (isset($_GET['docid'])) {
                $doc = $client->getDoc($_GET['docid']);
                if ($client->deleteDoc($doc)) {
                    header('Location:index.php');
                }
            }
            break;
        case 'create':
            // insert doc
            if (isset($_POST['submit'])) {
                $d = new stdClass();
                $d->title = $_POST['title'];
                $d->body = $_POST['body'];
                $d->category = $_POST['category'];
                $d->created_at = time();
                $d_res = (object) $d;
                $client->storeDoc($d_res);
                header('Location:index.php');