- make this class usable, mostly by fixing typos
authorMichael Wallner <mike@php.net>
Mon, 27 Mar 2006 17:41:25 +0000 (17:41 +0000)
committerMichael Wallner <mike@php.net>
Mon, 27 Mar 2006 17:41:25 +0000 (17:41 +0000)
lib/PgLobStream.php

index b6927bf4574be33773e7cdd0b1f34797f1fd5233..d0506130e7ebe0bb26bb7d9d653d9090f34380e4 100644 (file)
@@ -8,7 +8,7 @@
  * <code>
  * // GET /image.php?image=1234
  * if (PgLobStream::$loId = (int) $_GET['image']) {
- *     if ($lob = fopen('pglob: dbname=database user=mike', 'r')) {
+ *     if ($lob = fopen('pglob://dbname=database user=mike', 'r')) {
  *         HttpResponse::setContentType('image/jpeg');
  *         HttpResponse::setStream($lob);
  *         HttpResponse::send();
@@ -32,7 +32,7 @@ class PgLobStream
 
     function stream_open($path, $mode)
     {
-        $path = trim(parse_url($path, URL_PATH));
+        $path = trim(parse_url($path, PHP_URL_HOST));
         
         if ($path) {
             if ($this->dbh = pg_connect($path)) {
@@ -40,7 +40,7 @@ class PgLobStream
                     if (is_resource($this->loh = pg_lo_open($this->dbh, $this->lon = self::$loId, $mode))) {
                         pg_lo_seek($this->loh, 0, PGSQL_SEEK_END);
                         $this->size = (int) pg_lo_tell($this->loh);
-                        pg_lo_seek($this->loh, 0, PGSSQL_SEEK_SET);
+                        pg_lo_seek($this->loh, 0, PGSQL_SEEK_SET);
                         return true;
                     }
                 }
@@ -54,7 +54,7 @@ class PgLobStream
         return pg_lo_read($this->loh, $length);
     }
     
-    function stream_seek($offset, $whence = SEEK_SET)
+    function stream_seek($offset, $whence = PGSQL_SEEK_SET)
     {
         return pg_lo_seek($this->loh, $offset, $whence);
     }