Exemplo n.º 1
0
 /**
  * undocumented function
  *
  * @param string $database 
  * @param string $attachment 
  * @param string $document 
  * @param string $revision 
  * @author Adam Venturella
  */
 public function __construct($database, $attachment, $document = null, $revision = null)
 {
     $this->database = $database;
     $this->attachment = $attachment;
     $this->document = $document ? $document : couchdb_generate_id();
     $this->revision = $revision;
 }
Exemplo n.º 2
0
    public function request()
    {
        $content_length = strlen($this->json);
        $batch = null;
        if (!$this->id) {
            $this->id = couchdb_generate_id($this->json);
        }
        if ($this->batch) {
            $batch = "?batch=ok";
        }
        return <<<REQUEST
PUT /{$this->database}/{$this->id}/{$batch} HTTP/1.0
Host: {host}
Connection: Close
Content-Length: {$content_length}
Content-Type: application/json
{authorization}

{$this->json}
REQUEST;
    }