Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Initial documentation |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
79aad68b11c8dd973041d5587c2a48ec |
User & Date: | murphy 2018-08-20 21:13:50.648 |
Context
2018-08-20
| ||
22:04 | Simplified and corrected database->alist check-in: d177d483aa user: murphy tags: trunk | |
21:13 | Initial documentation check-in: 79aad68b11 user: murphy tags: trunk | |
21:13 | Conversions between databases and association lists check-in: 6ef9d5e1d4 user: murphy tags: trunk | |
Changes
Added lmdb.wiki.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 | <h1>LMDB API</h1> This CHICKEN binding for LMDB consists of a single module in a shared library of the same name. You can load the library and import the module using <verbatim> (import lmdb) </verbatim> <h2>Database Environments</h2> <verbatim> current-database-environment </verbatim> A parameter holding the current database environment pointer or <tt>#f</tt>. <verbatim> (database-environment? OBJECT) => BOOLEAN </verbatim> Type predicate for database environments. <verbatim> (open-database-environment PATH [#:mode MODE] [#:max-databases MAXDBS] [#:max-readers MAXREADERS] [#:max-size MAPSIZE] [#:fixed-map] [#:no-subdirectory] [#:read-only] [#:write-map] [#:no-meta-sync] [#:no-sync] [#:map-async] [#:no-lock] [#:no-read-ahead]) => ENVIRONMENT </verbatim> Creates a database environment and configures various settings through setup methods and the open method. Unless <tt>#:no-subdirectory</tt> is specified or the given <tt>PATH</tt> already exists, <tt>PATH</tt> is created as a directory to contain the database environment. Sets <tt>current-database-environment</tt> to the newly created environment. <verbatim> (close-database-environment [ENVIRONMENT]) => VOID </verbatim> Closes a database environment and destroys the handle. If no <tt>ENVIRONMENT</tt> is specified explicitly, closes the current environment and sets <tt>current-database-environment</tt> to <tt>#f</tt>. <verbatim> (copy-database-environment PATH [ENVIRONMENT] [#:compact]) => VOID </verbatim> Copies a database environment to a new <tt>PATH</tt>, optionally compacting the data. If no <tt>ENVIRONMENT</tt> is specified explicitly, the current environment is copied. <verbatim> (with-transaction THUNK [#:read-only]) => (values ...) </verbatim> Wraps a call to <tt>THUNK</tt> in a transaction. Returns whatever <tt>(THUNK)</tt> returns. The transaction can optionally be configured as read-only. Read-only transactions may be nested. All database operations below have to be executed within a transaction. The transaction is committed upon normal return from <tt>(THUNK)</tt> and aborted if <tt>(THUNK)</tt> throws an exception. <h2>Databases</h2> <verbatim> (database? OBJECT) => BOOLEAN </verbatim> Type predicate for databases. <verbatim> (open-database [NAME] [#:reverse-key] [#:duplicate-sort] [#:integer-key] [#:duplicate-fixed] [#:integer-duplicate] [#:reverse-duplicate] [#:create]) => DATABASE </verbatim> Opens a database and configures various flags. The name of the database can be omitted if the environment was opened without <tt>#:max-databases</tt> and consists of only a single default database. If a named database does not exist, <tt>#:create</tt> must be specified when it is first opened. <verbatim> (close-database DATABASE [ENVIRONMENT]) => VOID </verbatim> Closes a database. If the <tt>ENVIRONMENT</tt> containing the database is not specified explicitly, the current environment is assumed. <verbatim> (database-ref DATABASE KEY [DEFAULT]) => VALUE </verbatim> Extracts a record with the given <tt>KEY</tt> from the database. If no record is found and <tt>DEFAULT</tt> is given, it is invoked in case it is a procedure and returned otherwise. An error is signalled if no record is found and <tt>DEFAULT</tt> is not given. Database keys can be strings or blobs. Values extracted from the database are returned as strings. <verbatim> (database-set! DATABASE KEY VALUE [#:no-duplicate] [#:no-overwrite] [#:append] [#:append/duplicate]) => VOID (set! (database-ref DATABASE KEY) VALUE) => VOID </verbatim> Stores a record in the database with several optional flags modifying the behaviour. For databases configured with support for multiple values per key, new values are normally added to the set of existing ones. For databases with one value per key, existing records are replaced. Database keys and values can be strings or blobs. <verbatim> (database-exists? DATABASE KEY) => BOOLEAN </verbatim> Checks whether a key exists in the database. Database keys can be strings or blobs. <verbatim> (database-delete! DATABASE KEY [VALUE]) => VOID </verbatim> Deletes a record from the database. An error is signalled if no record is found. For databases configured with support for multiple values per key, the <tt>VALUE</tt> to delete can be specified explicitly. For databases with one value per key, <tt>VALUE</tt> is ignored. Database keys and values can be strings or blobs. <verbatim> (database-fold PROC SEED DATABASE [#:from START] [#:to< | #:to<= LIMIT]) => (PROC KEY VALUE (... (PROC KEY VALUE SEED))) </verbatim> Folds over the records in the database. If <tt>START</tt> is given, only fold over the records with keys greater or equal to <tt>START</tt>. If <tt>LIMIT</tt> is given, only fold over the records with keys less than (or equal) to <tt>LIMIT</tt>. <verbatim> (database-walk PROC DATABASE [#:from START] [#:to< | #:to<= LIMIT]) => VOID </verbatim> Like <tt>database-fold</tt>, but discarding the result. <verbatim> (database->alist DATABASE [#:from START] [#:to< | #:to<= LIMIT] [#:duplicate-list]) => ALIST </verbatim> Convert the records in the database to an association list. If <tt>START</tt> is given, only list the records with keys greater or equal to <tt>START</tt>. If <tt>LIMIT</tt> is given, only list the records with keys less than (or equal) to <tt>LIMIT</tt>. Optionally, multiple values for the same key may be folded into lists rather than producing multiple pairs with the same key in the association list. <verbatim> (alist->database ALIST [NAME] [#:reverse-key] [#:duplicate-sort] [#:integer-key] [#:duplicate-fixed] [#:integer-duplicate] [#:reverse-duplicate] [#:create] [#:no-duplicate] [#:no-overwrite] [#:append] [#:append/duplicate]) => DATABASE </verbatim> Convert an association list into records in a database. The procedure accepts the combined flag arguments of <tt>open-database</tt> and <tt>database-set!</tt>. The procedure returns a new handle to the database indicated by the given <tt>NAME</tt> or to the default database. <tt>ALIST</tt> must contain pairs of keys and values. Keys can be strings or blobs. Values can be strings, blobs or lists of strings and blobs. If a value is a list, all its elements are inserted into the database with the same key. If <tt>ALIST</tt> was generated by <tt>database->alist</tt>, it is safe to pass <tt>#:append</tt> or <tt>#:append/duplicate</tt> to this procedure. |