Changeset 9103 in project


Ignore:
Timestamp:
02/28/08 21:59:04 (12 years ago)
Author:
svnwiki
Message:

Changes applied for Ozzi Lee (65.103.63.81) through svnwiki:

Mucking about with the proposed interface.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/dbi

    r9101 r9103  
    22
    33=== Proposed Interface
     4
     5==== Core Functionality
     6
     7These functions should be optimized for speed.
    48
    59; <procedure>(dbi:connect TYPE #!key FILE PORT USER PASS etc)</procedure> : Connect to a database. TYPE is a symbol, like mysql, postgres, sqlite, etc. Returns a connection object.
     
    1317; <procedure>(dbi:fetch-row CONNECTION)</procedure> : Return the next row (see mysql).
    1418
     19; <procedure>(dbi:insert-id CONNECTION)</procedure> : Returns the ID generated by the last insert statement.
     20
     21''I'd like to see support for prepared statements. Especially in transactional environments, on some
     22DBMSs they can result in big performance wins. And a DBMS that doesn't support them can easily
     23implement stubs (e.g., prepare creating a record that holds the original string). Also, another vote for streams. -- vincent''
     24
     25==== Convenience Functions
     26
     27These functions should be optimized for convenience in i.e. quick and dirty scripts. Perhaps these types of functions should be their own library on top of DBI? Perhaps there are even more convenient functions we could have?
     28
     29; <procedure>(dbi:query-list CONNECTION SQL)</procedure> : Returns a list of result rows.
     30
    1531; <procedure>(dbi:query-fold CONNECTION PROC SQL SEED)</procedure> : fold
    1632
     
    1935; <procedure>(dbi:query-for-each CONNECTION PROC SQL SEED)</procedure> : for-each
    2036
    21 ; <procedure>(dbi:insert-id CONNECTION)</procedure> : Returns the ID generated by the last insert statement.
     37==== Stream Functions
     38
     39; <procedure>(dbi:query-stream CONNECTION SQL)</procedure> : Return an SRFI-40/SRFI-41 stream of rows.
    2240
    2341
    24 ''Instead of the query-fold, query-map and query-for-each procedures I'd prefer just returning a SRFI-40/SRFI-41 stream using promises that advance the cursor when forced. This way you don't restrict the user to these three procedures, but he can use the full stream library to iterate over the result set.'' -- [[Peter Bex]]
    25 
    26 ''I'd like to see support for prepared statements. Especially in transactional environments, on some
    27 DBMSs they can result in big performance wins. And a DBMS that doesn't support them can easily
    28 implement stubs (e.g., prepare creating a record that holds the original string). Also, another vote for streams. -- vincent''
    2942
    3043=== Open issues
Note: See TracChangeset for help on using the changeset viewer.