Changeset 15526 in project


Ignore:
Timestamp:
08/21/09 00:46:31 (10 years ago)
Author:
Thomas Chust
bzr:base-revision:
chust@web.de-20090820184406-u0ro6bryr6rw5qy1
bzr:committer:
Thomas Chust <chust@web.de>
bzr:file-ids:

demo.scm demo.scm-20090820155252-p2ti8ziw8jpygxh9-1
doc.scm doc.scm-20090807105733-xckh9kh901i74p1k-2
pandora-postgresql.scm pandorapostgresql.sc-20090808201827-2ehfdzdm1lijsubu-1
pandora.html pandora.html-20090807105733-xckh9kh901i74p1k-4
pandora.scm pandora.scm-20090807105733-xckh9kh901i74p1k-6
bzr:mapping-version:
v4
bzr:merge:

chust@web.de-20090820230048-29kvoumype6lrkrr
bzr:repository-uuid:
fca3e652-9b03-0410-8d7b-ac86a6ce46c4
bzr:revision-id:
chust@web.de-20090820230315-pr8lg5otokc7wgf2
bzr:revno:
7
bzr:revprop:branch-nick:
release/4/pandora/trunk
bzr:root:
release/4/pandora/trunk
bzr:text-parents:

demo.scm chust@web.de-20090820184406-u0ro6bryr6rw5qy1 chust@web.de-20090820211906-g6hp2koev7l8xyhn
doc.scm chust@web.de-20090820183427-pcd9dz7v7253y28w chust@web.de-20090820230048-29kvoumype6lrkrr
pandora-postgresql.scm chust@web.de-20090820183427-pcd9dz7v7253y28w chust@web.de-20090820211934-ejulp0sj3x272s8u
pandora.html chust@web.de-20090820184406-u0ro6bryr6rw5qy1 chust@web.de-20090820230048-29kvoumype6lrkrr
pandora.scm chust@web.de-20090820183427-pcd9dz7v7253y28w chust@web.de-20090820211934-ejulp0sj3x272s8u
bzr:timestamp:
2009-08-21 01:03:15.492000103 +0200
bzr:user-agent:
bzr1.17+bzr-svn0.6.3
svn:original-date:
2009-08-20T23:03:15.492000Z
Message:

[pandora] PostgreSQL specific fixes and documentation tweaks.

Location:
release/4/pandora/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • release/4/pandora/trunk/demo.scm

    r15525 r15526  
    1717     ")")
    1818    ("CREATE TABLE IF NOT EXISTS Tags ("
    19      "  id INTEGER, name INTEGER,"
     19     "  id INTEGER, name TEXT,"
    2020     "  PRIMARY KEY (id),"
    2121     "  UNIQUE (name)"
  • release/4/pandora/trunk/doc.scm

    r15524 r15526  
    4444          (p (tt "URI") " may be a string or a " (tt "uri-generic") " record, but is always passed to the connection prototype's " (tt "clone") " method as a record.")
    4545          (p "The drivers bundled with pandora will handle the URI schemes " (tt "sqlite3") " or " (tt "memory") " for access to SQLite3 databases (the latter always creates a database in memory) and " (tt "postgresql") " or " (tt "psql") " for access to PostgreSQL databases.")
     46          (p "The SQLite3 driver also supports a URI parameter " (tt "cache") " that determines the size of the prepared statement cache, which defaults to 64.")
    4647          (p "Before using a backend, it must be loaded, but it doesn't have to be imported.")
    4748          (pre #<<EOD
     
    4950(require-extension pandora)
    5051(require-library pandora-sqlite3)
    51 (define store (*sql-datastore* 'connect "sqlite3:test.db"))
     52(define store (*sql-datastore* 'connect "sqlite3:test.db?cache=16"))
    5253
    5354;; Example using PostgreSQL:
  • release/4/pandora/trunk/pandora-postgresql.scm

    r15524 r15526  
    2121
    2222(define-object *postgresql-datastore* (*sql-datastore*)
    23   [db set-db! #f])
     23  [db set-db! #f]
     24  [sql-gensym-serial set-sql-gensym-serial! 0])
    2425
    2526(define-method (*postgresql-datastore* 'clone self resend uri)
     
    120121  (with-transaction (self 'db) thunk))
    121122
     123(define-method (*postgresql-datastore* 'sql-gensym self resend #!optional [prefix "g"])
     124  (let ([serial (self 'sql-gensym-serial)])
     125    (let ([id
     126            (self 'escape-sql-identifier
     127              (string-append prefix (number->string serial)))]
     128          [serial
     129            (+ serial 1)])
     130      (self 'set-sql-gensym-serial! (if (positive? serial) serial 0))
     131      id)))
     132
    122133(for-each
    123134  (cut *sql-datastore* 'add-connection-prototype! <> *postgresql-datastore*)
  • release/4/pandora/trunk/pandora.html

    r15525 r15526  
    190190<p><tt>URI</tt> may be a string or a <tt>uri-generic</tt> record, but is always passed to the connection prototype's <tt>clone</tt> method as a record.</p>
    191191<p>The drivers bundled with pandora will handle the URI schemes <tt>sqlite3</tt> or <tt>memory</tt> for access to SQLite3 databases (the latter always creates a database in memory) and <tt>postgresql</tt> or <tt>psql</tt> for access to PostgreSQL databases.</p>
     192<p>The SQLite3 driver also supports a URI parameter <tt>cache</tt> that determines the size of the prepared statement cache, which defaults to 64.</p>
    192193<p>Before using a backend, it must be loaded, but it doesn't have to be imported.</p>
    193194<pre>;; Example using SQLite3:
    194195(require-extension pandora)
    195196(require-library pandora-sqlite3)
    196 (define store (*sql-datastore* 'connect &quot;sqlite3:test.db&quot;))
     197(define store (*sql-datastore* 'connect &quot;sqlite3:test.db?cache=16&quot;))
    197198
    198199;; Example using PostgreSQL:
     
    402403     <b><font color="#BC8F8F">")"</font></b>)
    403404    (<b><font color="#BC8F8F">"CREATE TABLE IF NOT EXISTS Tags ("</font></b>
    404      <b><font color="#BC8F8F">"  id INTEGER, name INTEGER,"</font></b>
     405     <b><font color="#BC8F8F">"  id INTEGER, name TEXT,"</font></b>
    405406     <b><font color="#BC8F8F">"  PRIMARY KEY (id),"</font></b>
    406407     <b><font color="#BC8F8F">"  UNIQUE (name)"</font></b>
  • release/4/pandora/trunk/pandora.scm

    r15524 r15526  
    111111    id
    112112    (error-argument-type 'escape-sql-identifier id "string escapable as an SQL identifier")))
     113
     114(define-method (*sql-datastore* 'sql-gensym self resend #!optional [prefix "g"])
     115  #f)
    113116
    114117(define-method (*sql-datastore* 'name->table-clause self resend name)
     
    231234                       '()
    232235                       `(" WHERE " ,@filter-expression))
    233                    ")")
     236                   ")"
     237                   ,@(cond
     238                       [(store 'sql-gensym "VT") => (cut list " AS " <>)]
     239                       [else '()]))
    234240                 (append
    235241                   column-params table-params filter-params order-params)))]
Note: See TracChangeset for help on using the changeset viewer.