This is the cl-mysql Reference Manual, version 0.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Sep 15 04:15:41 2024 GMT+0.
The main system appears first, followed by any subsystem dependency.
cl-mysql
Common Lisp MySQL library bindings
Steve Knight <stkni@yahoo.com>
Steve Knight <stkni@yahoo.com>
MIT
0.1
cffi
(system).
system.lisp
(file).
thread.lisp
(file).
connection.lisp
(file).
pool.lisp
(file).
mysql.lisp
(file).
prepare.lisp
(file).
package.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
cl-mysql/cl-mysql.asd
cl-mysql/system.lisp
cl-mysql/thread.lisp
cl-mysql/connection.lisp
cl-mysql/pool.lisp
cl-mysql/mysql.lisp
cl-mysql/prepare.lisp
cl-mysql/package.lisp
cl-mysql/system.lisp
cl-mysql
(system).
+client-compress+
(constant).
+client-found-rows+
(constant).
+client-ignore-sigpipe+
(constant).
+client-ignore-space+
(constant).
+client-interactive+
(constant).
+client-local-files+
(constant).
+client-multi-results+
(constant).
+client-multi-statements+
(constant).
+client-no-schema+
(constant).
+client-remember-options+
(constant).
+client-ssl+
(constant).
mysql-error
(function).
*generate-alt-fns*
(special variable).
*mysql-dev-api-url*
(special variable).
+cant-read-charset+
(constant).
+commands-out-of-sync+
(constant).
+conn-host-error+
(constant).
+conn-unknow-protocol+
(constant).
+connection-error+
(constant).
+data-truncated+
(constant).
+embedded-connection+
(constant).
+error-first+
(constant).
+fetch-canceled+
(constant).
+field-auto-increment+
(constant).
+field-binary+
(constant).
+field-blob+
(constant).
+field-enum+
(constant).
+field-multiple-key+
(constant).
+field-no-default+
(constant).
+field-not-null+
(constant).
+field-num+
(constant).
+field-primary-key+
(constant).
+field-set+
(constant).
+field-timestamp+
(constant).
+field-unique-key+
(constant).
+field-unsigned+
(constant).
+field-zerofill+
(constant).
+invalid-buffer-use+
(constant).
+invalid-conn-handle+
(constant).
+invalid-parameter-no+
(constant).
+ipsock-error+
(constant).
+localhost-connection+
(constant).
+malformed-packet+
(constant).
+namedpipe-connection+
(constant).
+namedpipeopen-error+
(constant).
+namedpipesetstate-error+
(constant).
+namedpipewait-error+
(constant).
+net-packet-too-large+
(constant).
+no-data+
(constant).
+no-parameters-exists+
(constant).
+no-prepare-stmt+
(constant).
+no-result-set+
(constant).
+no-stmt-metadata+
(constant).
+not-implemented+
(constant).
+null-pointer+
(constant).
+out-of-memory+
(constant).
+params-not-bound+
(constant).
+probe-master-connect+
(constant).
+probe-slave-connect+
(constant).
+probe-slave-hosts+
(constant).
+probe-slave-status+
(constant).
+secure-auth+
(constant).
+server-gone-error+
(constant).
+server-handshake-err+
(constant).
+server-lost+
(constant).
+server-lost-extended+
(constant).
+shared-memory-connect-abandoned-error+
(constant).
+shared-memory-connect-answer-error+
(constant).
+shared-memory-connect-file-map-error+
(constant).
+shared-memory-connect-map-error+
(constant).
+shared-memory-connect-request-error+
(constant).
+shared-memory-connect-set-error+
(constant).
+shared-memory-connection+
(constant).
+shared-memory-event-error+
(constant).
+shared-memory-file-map-error+
(constant).
+shared-memory-map-error+
(constant).
+socket-create-error+
(constant).
+ssl-connection-error+
(constant).
+tcp-connection+
(constant).
+unknown-error+
(constant).
+unknown-host+
(constant).
+unsupported-param-type+
(constant).
+version-error+
(constant).
+wrong-host-info+
(constant).
+wrong-license+
(constant).
character-set-tclass
(class).
defmysqlfun
(macro).
mysql-affected-rows
(function).
mysql-bind-tclass
(class).
mysql-character-set-name
(function).
mysql-close
(function).
mysql-errno
(function).
mysql-escape-string
(function).
mysql-fetch-field
(function).
mysql-fetch-fields
(function).
mysql-fetch-lengths
(function).
mysql-fetch-row
(function).
mysql-field-count
(function).
mysql-field-tclass
(class).
mysql-free-result
(function).
mysql-get-character-set-info
(function).
mysql-get-client-version
(function).
mysql-get-server-version
(function).
mysql-init
(function).
mysql-list-dbs
(function).
mysql-list-fields
(function).
mysql-list-processes
(function).
mysql-list-tables
(function).
mysql-next-result
(function).
mysql-num-fields
(function).
mysql-num-rows
(function).
mysql-options
(function).
mysql-ping
(function).
mysql-query
(function).
mysql-real-connect
(function).
mysql-real-escape-string
(function).
mysql-select-db
(function).
mysql-set-character-set
(function).
mysql-stmt-affected-rows
(function).
mysql-stmt-bind-param
(function).
mysql-stmt-close
(function).
mysql-stmt-errno
(function).
mysql-stmt-error
(function).
mysql-stmt-execute
(function).
mysql-stmt-init
(function).
mysql-stmt-param-count
(function).
mysql-stmt-prepare
(function).
mysql-stmt-sqlstate
(function).
mysql-store-result
(function).
mysql-use-result
(function).
cl-mysql/thread.lisp
system.lisp
(file).
cl-mysql
(system).
make-lock
(function).
start-thread-in-nsecs
(function).
wait-on-threads
(function).
with-lock
(macro).
*sleep-period*
(constant).
make-wait-resource
(function).
pool-notify
(function).
pool-wait
(function).
thread-alive-p
(function).
cl-mysql/connection.lisp
thread.lisp
(file).
cl-mysql
(system).
*type-map*
(special variable).
available
(method).
connected
(method).
connection
(class).
connection-equal
(method).
connection-equal
(method).
in-use
(reader method).
(setf in-use)
(writer method).
next-result-set
(method).
next-row
(method).
pointer
(reader method).
(setf pointer)
(writer method).
process-result-set
(method).
release
(generic function).
result-set
(reader method).
(setf result-set)
(writer method).
result-set-fields
(reader method).
(setf result-set-fields)
(writer method).
acquire
(generic function).
connectable
(class).
owner-pool
(reader method).
result-data
(method).
set-field-names-and-types
(method).
toggle
(method).
use-query-active
(reader method).
(setf use-query-active)
(writer method).
cl-mysql/pool.lisp
connection.lisp
(file).
cl-mysql
(system).
*last-database*
(special variable).
aquire
(method).
aquire
(method).
aquire
(method).
available-connections
(reader method).
(setf available-connections)
(writer method).
can-aquire
(method).
connect
(function).
connection-pool
(class).
connections
(reader method).
(setf connections)
(writer method).
contains
(method).
count-connections
(method).
disconnect
(function).
initialize-instance
(method).
max-connections
(reader method).
(setf max-connections)
(method).
min-connections
(reader method).
(setf min-connections)
(method).
pool-lock
(reader method).
(setf pool-lock)
(writer method).
release
(method).
release
(method).
*debug*
(special variable).
add-connection
(method).
can-aquire-lock
(method).
clean-connections
(method).
connect-to-server
(method).
connect-upto-minimum
(method).
consume-unused-results
(method).
database
(reader method).
disconnect-all
(method).
disconnect-from-server
(method).
disconnect-from-server
(method).
flags
(reader method).
hostname
(reader method).
password
(reader method).
port
(reader method).
remove-connection-from-array
(method).
return-or-close
(method).
return-to-available
(method).
return-to-available
(method).
socket
(reader method).
take-first
(method).
username
(reader method).
wait-queue
(reader method).
(setf wait-queue)
(writer method).
wait-queue-lock
(reader method).
(setf wait-queue-lock)
(writer method).
cl-mysql/mysql.lisp
pool.lisp
(file).
cl-mysql
(system).
cffi-utf8-length
(function).
cl-mysql-error
(condition).
client-version
(function).
escape-string
(function).
extract-field
(function).
list-dbs
(function).
list-fields
(function).
list-processes
(function).
list-tables
(function).
mysql-error
(condition).
nth-row
(function).
option
(function).
ping
(function).
query
(function).
server-version
(function).
string-to-date
(function).
string-to-float
(function).
string-to-integer
(function).
string-to-ratio
(function).
string-to-seconds
(function).
string-to-universal-time
(function).
use
(function).
with-rows
(macro).
%set-int-option
(function).
%set-string-option
(function).
*binary-types*
(special variable).
cl-mysql-error-message
(reader method).
decode-version
(function).
error-if-non-zero
(function).
error-if-null
(function).
error-if-null-with-fields
(function).
error-if-set
(function).
force-kill
(function).
get-character-set-info
(function).
get-field
(function).
mysql-error-errno
(reader method).
mysql-error-message
(reader method).
process-row
(function).
set-character-set
(function).
single-result-set
(function).
with-connection
(macro).
cl-mysql/prepare.lisp
mysql.lisp
(file).
cl-mysql
(system).
bind
(method).
bind-arg
(method).
bound-map
(reader method).
(setf bound-map)
(writer method).
configure-bindings
(method).
next-index
(method).
pointer
(reader method).
statement
(class).
*default-sequence-length*
(special variable).
*stmt-ctype-map*
(special variable).
args
(reader method).
(setf args)
(writer method).
assign-bound-argument
(method).
bound-parameter-p
(method).
bound-unbound-to-string
(method).
close-statement
(method).
database
(reader method).
execute
(method).
fully-bound
(reader method).
(setf fully-bound)
(writer method).
nargs
(reader method).
(setf nargs)
(writer method).
param-count
(method).
prepare
(function).
release-binding
(method).
repeat-char
(function).
sqlstate
(method).
cl-mysql/package.lisp
prepare.lisp
(file).
cl-mysql
(system).
Packages are listed by definition order.
com.hackinghat.cl-mysql-system
cl-mysql-system
cffi
.
common-lisp
.
*last-database*
(special variable).
*type-map*
(special variable).
+client-compress+
(constant).
+client-found-rows+
(constant).
+client-ignore-sigpipe+
(constant).
+client-ignore-space+
(constant).
+client-interactive+
(constant).
+client-local-files+
(constant).
+client-multi-results+
(constant).
+client-multi-statements+
(constant).
+client-no-schema+
(constant).
+client-remember-options+
(constant).
+client-ssl+
(constant).
aquire
(generic function).
available
(generic function).
available-connections
(generic reader).
(setf available-connections)
(generic writer).
bind
(generic function).
bind-arg
(generic function).
bound-map
(generic reader).
(setf bound-map)
(generic writer).
can-aquire
(generic function).
cffi-utf8-length
(function).
cl-mysql-error
(condition).
client-version
(function).
configure-bindings
(generic function).
connect
(function).
connected
(generic function).
connection
(class).
connection-equal
(generic function).
connection-pool
(class).
connections
(generic reader).
(setf connections)
(generic writer).
contains
(generic function).
count-connections
(generic function).
disconnect
(function).
escape-string
(function).
extract-field
(function).
in-use
(generic reader).
(setf in-use)
(generic writer).
list-dbs
(function).
list-fields
(function).
list-processes
(function).
list-tables
(function).
make-lock
(function).
max-connections
(generic reader).
(setf max-connections)
(generic function).
min-connections
(generic reader).
(setf min-connections)
(generic function).
mysql-error
(function).
mysql-error
(condition).
next-index
(generic function).
next-result-set
(generic function).
next-row
(generic function).
nth-row
(function).
option
(function).
ping
(function).
pointer
(generic reader).
(setf pointer)
(generic writer).
pool-lock
(generic reader).
(setf pool-lock)
(generic writer).
process-result-set
(generic function).
query
(function).
release
(generic function).
result-set
(generic reader).
(setf result-set)
(generic writer).
result-set-fields
(generic reader).
(setf result-set-fields)
(generic writer).
server-version
(function).
start-thread-in-nsecs
(function).
statement
(class).
string-to-date
(function).
string-to-float
(function).
string-to-integer
(function).
string-to-ratio
(function).
string-to-seconds
(function).
string-to-universal-time
(function).
use
(function).
wait-on-threads
(function).
with-lock
(macro).
with-rows
(macro).
%set-int-option
(function).
%set-string-option
(function).
*binary-types*
(special variable).
*debug*
(special variable).
*default-sequence-length*
(special variable).
*generate-alt-fns*
(special variable).
*mysql-dev-api-url*
(special variable).
*sleep-period*
(constant).
*stmt-ctype-map*
(special variable).
+cant-read-charset+
(constant).
+commands-out-of-sync+
(constant).
+conn-host-error+
(constant).
+conn-unknow-protocol+
(constant).
+connection-error+
(constant).
+data-truncated+
(constant).
+embedded-connection+
(constant).
+error-first+
(constant).
+fetch-canceled+
(constant).
+field-auto-increment+
(constant).
+field-binary+
(constant).
+field-blob+
(constant).
+field-enum+
(constant).
+field-multiple-key+
(constant).
+field-no-default+
(constant).
+field-not-null+
(constant).
+field-num+
(constant).
+field-primary-key+
(constant).
+field-set+
(constant).
+field-timestamp+
(constant).
+field-unique-key+
(constant).
+field-unsigned+
(constant).
+field-zerofill+
(constant).
+invalid-buffer-use+
(constant).
+invalid-conn-handle+
(constant).
+invalid-parameter-no+
(constant).
+ipsock-error+
(constant).
+localhost-connection+
(constant).
+malformed-packet+
(constant).
+namedpipe-connection+
(constant).
+namedpipeopen-error+
(constant).
+namedpipesetstate-error+
(constant).
+namedpipewait-error+
(constant).
+net-packet-too-large+
(constant).
+no-data+
(constant).
+no-parameters-exists+
(constant).
+no-prepare-stmt+
(constant).
+no-result-set+
(constant).
+no-stmt-metadata+
(constant).
+not-implemented+
(constant).
+null-pointer+
(constant).
+out-of-memory+
(constant).
+params-not-bound+
(constant).
+probe-master-connect+
(constant).
+probe-slave-connect+
(constant).
+probe-slave-hosts+
(constant).
+probe-slave-status+
(constant).
+secure-auth+
(constant).
+server-gone-error+
(constant).
+server-handshake-err+
(constant).
+server-lost+
(constant).
+server-lost-extended+
(constant).
+shared-memory-connect-abandoned-error+
(constant).
+shared-memory-connect-answer-error+
(constant).
+shared-memory-connect-file-map-error+
(constant).
+shared-memory-connect-map-error+
(constant).
+shared-memory-connect-request-error+
(constant).
+shared-memory-connect-set-error+
(constant).
+shared-memory-connection+
(constant).
+shared-memory-event-error+
(constant).
+shared-memory-file-map-error+
(constant).
+shared-memory-map-error+
(constant).
+socket-create-error+
(constant).
+ssl-connection-error+
(constant).
+tcp-connection+
(constant).
+unknown-error+
(constant).
+unknown-host+
(constant).
+unsupported-param-type+
(constant).
+version-error+
(constant).
+wrong-host-info+
(constant).
+wrong-license+
(constant).
acquire
(generic function).
add-connection
(generic function).
args
(generic reader).
(setf args)
(generic writer).
assign-bound-argument
(generic function).
bound-parameter-p
(generic function).
bound-unbound-to-string
(generic function).
can-aquire-lock
(generic function).
character-set-tclass
(class).
cl-mysql-error-message
(generic reader).
clean-connections
(generic function).
close-statement
(generic function).
connect-to-server
(generic function).
connect-upto-minimum
(generic function).
connectable
(class).
consume-unused-results
(generic function).
database
(generic reader).
decode-version
(function).
defmysqlfun
(macro).
disconnect-all
(generic function).
disconnect-from-server
(generic function).
error-if-non-zero
(function).
error-if-null
(function).
error-if-null-with-fields
(function).
error-if-set
(function).
execute
(generic function).
flags
(generic reader).
force-kill
(function).
fully-bound
(generic reader).
(setf fully-bound)
(generic writer).
get-character-set-info
(function).
get-field
(function).
hostname
(generic reader).
make-wait-resource
(function).
mysql-affected-rows
(function).
mysql-bind-tclass
(class).
mysql-character-set-name
(function).
mysql-close
(function).
mysql-errno
(function).
mysql-error-errno
(generic reader).
mysql-error-message
(generic reader).
mysql-escape-string
(function).
mysql-fetch-field
(function).
mysql-fetch-fields
(function).
mysql-fetch-lengths
(function).
mysql-fetch-row
(function).
mysql-field-count
(function).
mysql-field-tclass
(class).
mysql-free-result
(function).
mysql-get-character-set-info
(function).
mysql-get-client-version
(function).
mysql-get-server-version
(function).
mysql-init
(function).
mysql-list-dbs
(function).
mysql-list-fields
(function).
mysql-list-processes
(function).
mysql-list-tables
(function).
mysql-next-result
(function).
mysql-num-fields
(function).
mysql-num-rows
(function).
mysql-options
(function).
mysql-ping
(function).
mysql-query
(function).
mysql-real-connect
(function).
mysql-real-escape-string
(function).
mysql-select-db
(function).
mysql-set-character-set
(function).
mysql-stmt-affected-rows
(function).
mysql-stmt-bind-param
(function).
mysql-stmt-close
(function).
mysql-stmt-errno
(function).
mysql-stmt-error
(function).
mysql-stmt-execute
(function).
mysql-stmt-init
(function).
mysql-stmt-param-count
(function).
mysql-stmt-prepare
(function).
mysql-stmt-sqlstate
(function).
mysql-store-result
(function).
mysql-use-result
(function).
nargs
(generic reader).
(setf nargs)
(generic writer).
owner-pool
(generic reader).
param-count
(generic function).
password
(generic reader).
pool-notify
(function).
pool-wait
(function).
port
(generic reader).
prepare
(function).
process-row
(function).
release-binding
(generic function).
remove-connection-from-array
(generic function).
repeat-char
(function).
result-data
(generic function).
return-or-close
(generic function).
return-to-available
(generic function).
set-character-set
(function).
set-field-names-and-types
(generic function).
single-result-set
(function).
socket
(generic reader).
sqlstate
(generic function).
take-first
(generic function).
thread-alive-p
(function).
toggle
(generic function).
use-query-active
(generic reader).
(setf use-query-active)
(generic writer).
username
(generic reader).
wait-queue
(generic reader).
(setf wait-queue)
(generic writer).
wait-queue-lock
(generic reader).
(setf wait-queue-lock)
(generic writer).
with-connection
(macro).
Definitions are sorted by export status, category, package, and then by lexicographic order.
The last allocated connection-pool. Note that this special is a default argument to a lot of the higher level API functions.
Takes a query-string and iterates over the result sets assigning var-row to each individual row. If you supply var-result it will hold the result set sequence number. This macro generates code that does not store the complete result so should be suitable for working with very large data sets.
We need this function because mysql_real_escape_string requires the length of the from string in bytes (not characters)
Returns a three part list containing the decoded client version information
Connect will present to MySQL sensible defaults for all the connection items.
The following code will attach you to a MySQL instance running on localhost,
as the current user with no password. It will automatically turn on
compression between client-and-server and also enable multiple-result sets
if possible.
<pre><code>CL-USER> (connect)</code></pre>
If unsuccesful connect will raise a <strong>CL-MYSQL-ERROR</strong>, otherwise it will place
the connection into a pool, note that all connections are pool-able,
a single connection is simply the special case of a pool with only one
connection.
The pool has two slots, <strong>min-connections</strong> and <srong>max-connections</strong>. There will
always be min-connections available in the pool. If you are using all
min-connections and max-connections is greater than min-connections,
the pool will continue to allocate connections until max-connections are
used. After this an attempt to aquire more connections from the pool
should block (if your implementation supports it). When a connection is
released (this is done automatically unless you explicity disable it) the
connection to the server is closed if we have allocated more connections
than min-connections.
The last allocated pool object is placed into a special variable
<strong>*last-database*</strong> which is defaulted from the higher level API functions.
This method will disconnect all the connections in the pool. Note that if you attempt to use the pool again after calling this method it will re-allocate upto min-connections before servicing your request.
Given a string, encode it appropriately. This function relies on the fact that the character set encoding was set to UTF-8 when the connection is made.
Returns either a string or an unsigned byte array for known binary types. The designation of binary types per the C API seems a bit weird. Basically, BIT, BINARY and VARBINARY are binary and so are BLOBs with the binary flag set. It seems that other fields also have the binary flag set that are not binary and the BIT type, whilst binary doesn’t have the flag set. Bizarre-o.
http://dev.mysql.com/doc/refman/5.0/en/mysql-error.html
Return the nth-row of the nth-result set.
Use this to set a client specific connection option. CL-USER> (option :opt-reconnect 1)
Check whether a connection is established or not. If :opt-reconnect is set and there is no connection then MySQL’s C API attempts a reconnection.
For a SELECT query or stored procedure that returns data, query will return
a list of result sets. Each result set will have 1 or more sublists
where the first sublist contains the column names and the remaining lists
represent the rows of the result set. If the query does not return a result
set (for example if the query is an INSERT, UPDATE) the return value is the
number of rows affected. Because cl-mysql supports multiple-statements
you can execute code like the following:
<pre><code>CL-MYSQL-SYSTEM> (query "CREATE TABLE a(a INT);
INSERT INTO a (a) VALUES (1); DELETE FROM a; DROP TABLE a")
((0) (1) (1) (0))</code></pre>
The type-map, if set will alter the decoding into CL types. If you set
this to nil it will have the effect of disabling all CL type conversions
and return either character or binary data only.
This might be useful for performance reasons, (cl-mysql
is much faster when it doesn’t need to translate types) but it also might
be all you need. Consider for instance if you’re displaying a lot of
numerics on a web-page. If you do not need to convert the data into
floats/integers before displaying them on a page then raw could be useful
here too. cl-mysql attempts to convert all numeric types to their closest
CL representation. For very large numerics, or numerics that have very
high precision this might not be what you want. In this case you could
attempt to write your own conversion routine and inject it into cl-mysql
through the type-map.
The currented supported conversions are as follows (MySQL type -> CL type):
<ul><li><strong>DECIMAL/NUMERIC</strong> -> RATIO</li>
<li><strong>INT/TINYINT/SMALLINT/MEDIUMINT/BIGINT/YEAR</strong> -> INTEGER</li>
<li><strong>FLOAT/REAL/DOUBLE PRECISION</strong> -> DOUBLE-FLOAT</li>
<li><strong>DATE/DATETIME/TIMESTAMP</strong> -> INTEGER (Universal time)</li>
<li><strong>TIME</strong> -> INTEGER (Seconds)</li>
<li><strong>CHAR/VARCHAR/TEXT/TINYTEXT/MEDIUMTEXT/LONGTEXT</strong> -> STRING</li>
<li><strong>BIT/BLOB/MEDIUMBLOB/LONGBLOB/TINYBLOB/GEOMETRY</strong> -> SIMPLE-ARRAY ’(UNSIGNED-BYTE 8 )</li>
</ul>
If :store is T query returns a list of result sets. Each result set is a
list with the first element set to the data and the second elements set to
the column data. Since this structure can be a little awkward to handle
you can use nth-row to manipulate the structure more sanely.
If :store is NIL query returns the allocated connection object. You should
use next-result-set and next-row to step through the results.
Returns a three part list containing the decoded server version information
Convert a MySQL float representation into a double. Note that we could do better on DECIMAL/NUMERICs that have 0 places after the decimal.
Fairly ugly function to turn MySQL TIME duration into an integer representation.
It’s complicated because of ... well, read this: http://dev.mysql.com/doc/refman/5.0/en/time.html
Equivalent to running: CL-USER> (query "USE <name>")
connection
) block) ¶connection-pool
) block) ¶Aquire from the pool a single connection object that can be passed to higher
level API functions like QUERY.
On implementations that support threading this method will block if :block is T, and available connections is 0 and there are already max-connections. On implementations that do not support threading this method will always return NIL.
connection
)) ¶connection-pool
)) ¶automatically generated reader method
connection-pool
)) ¶automatically generated writer method
connection-pool
)) ¶Returns true if a call to aquire would result in a connection being allocated
connection
)) ¶connection
) (other connection
)) ¶Two connections are equal if they point to the same memory location.
connection-pool
)) ¶automatically generated reader method
connection-pool
)) ¶automatically generated writer method
connection-pool
) array conn) ¶connection-pool
)) ¶Count the number of connections in the pool. If you are dynamically changing the size of the pool after it is created this number could be greater or less than max/min connections. Set :available-only if you only want to know how many connections are currently ready to use.
connection
)) ¶automatically generated reader method
connection
)) ¶automatically generated writer method
connection-pool
)) ¶automatically generated reader method
connection-pool
)) ¶Change the maximum number of connections available in the pool. Note that you can change this value whilst the pool is waiting for a connection to become available.
connection-pool
)) ¶automatically generated reader method
connection-pool
)) ¶Change the minimum number of connections available in the pool. Note that you can change this value whilst the pool is waiting for a connection to become available.
connection
) &key dont-release store) ¶Position for the the next result set. Returns T if there is a result
set to process and NIL when the last result set has been passed.
sets. Use this method with (query "SELECT" :store NIL). Call
next-result-set to position on the first result set then use next-row
to fetch all the individual rows.
Use dont-release if you don’t want cl-mysql to release all the resources
when the last result set has been processed. This might be useful, for
instance, if you need access to the fields through result-set-fields after
the result set has been processed.
You can, if you wish elect to not process each individual row of a result
set by setting :store T. However, you cannot then use next-row because
you must process the entire result set in one go.
<pre><code>CL-USER> (query "SELECT ..." :store nil)
CL-USER> (next-result-set *)
T
CL-USER> (next-row **)
...</code></pre>
connection
) &key type-map) ¶Retrieve and decode (according to the type map) the next row in the query. This function will return NIL when the last row has been retrieved.
statement
)) ¶automatically generated reader method
connection
)) ¶automatically generated reader method
connection
)) ¶automatically generated writer method
connection-pool
)) ¶automatically generated reader method
connection-pool
)) ¶automatically generated writer method
connection
) type-map) ¶Returns a CONS of all the data in the result set. Note that this method should only be called by the client if you originally sent :store NIL to query but then set :store to T when calling next-result-set.
Calling release will place the connection back into the pool. If the pool has more connections than max-connections then releasing the connection will close it and deallocate it.
connection-pool
) &optional conn) ¶Release a connection back into the pool.
connection
) &optional conn) ¶Convenience method to allow the release to be done with a connection
connection
)) ¶automatically generated reader method
connection
)) ¶connection
)) ¶automatically generated reader method
connection
)) ¶automatically generated writer method
connection-pool
) &rest initargs) ¶The connection arrays need to be set-up after the pool is created.
error
.
:message
This slot is read-only.
The slots necessary to manage a MySQL database connection.
add-connection
.
aquire
.
available
.
connected
.
connection-equal
.
consume-unused-results
.
disconnect-from-server
.
disconnect-from-server
.
(setf in-use)
.
in-use
.
next-result-set
.
next-row
.
owner-pool
.
(setf pointer)
.
pointer
.
process-result-set
.
release
.
result-data
.
(setf result-set)
.
result-set
.
(setf result-set-fields)
.
result-set-fields
.
return-or-close
.
return-to-available
.
set-field-names-and-types
.
toggle
.
(setf use-query-active)
.
use-query-active
.
(cffi-sys:null-pointer)
:pointer
(cffi-sys:null-pointer)
(or null t)
:in-use
:owner-pool
This slot is read-only.
list
(or null t)
All connections are initiated through a pool.
add-connection
.
aquire
.
(setf available-connections)
.
available-connections
.
can-aquire
.
can-aquire-lock
.
clean-connections
.
connect-to-server
.
connect-upto-minimum
.
(setf connections)
.
connections
.
contains
.
count-connections
.
database
.
disconnect-all
.
disconnect-from-server
.
flags
.
hostname
.
initialize-instance
.
(setf max-connections)
.
max-connections
.
(setf min-connections)
.
min-connections
.
password
.
(setf pool-lock)
.
pool-lock
.
port
.
release
.
remove-connection-from-array
.
return-or-close
.
return-to-available
.
socket
.
take-first
.
username
.
(setf wait-queue)
.
wait-queue
.
(setf wait-queue-lock)
.
wait-queue-lock
.
1
:min-connections
This slot is read-only.
1
:max-connections
This slot is read-only.
(or array null)
(or array null)
(com.hackinghat.cl-mysql-system:make-lock "pool lock")
(com.hackinghat.cl-mysql-system:make-lock "queue lock")
(com.hackinghat.cl-mysql-system::make-wait-resource)
A holder for a MYSQL_STMT structure
(setf args)
.
args
.
assign-bound-argument
.
bind
.
bind-arg
.
(setf bound-map)
.
bound-map
.
bound-parameter-p
.
bound-unbound-to-string
.
close-statement
.
configure-bindings
.
database
.
execute
.
(setf fully-bound)
.
fully-bound
.
(setf nargs)
.
nargs
.
next-index
.
param-count
.
pointer
.
release-binding
.
sqlstate
.
(cffi-sys:null-pointer)
:pointer
This slot is read-only.
:nargs
:bound-map
Field is auto increment
Field is binary
Field is a blob
Field is an enum
Field is part of a key
Field doesn’t have a default value
Field can’t be null
Field is num
Field is part of a primary key
Field is a set
Field is a timestamp
Field is part of a unique key
Field is unsigned
Field is zerofill
This is the maximum length that a sequence sent as a bound parameter can be
It’s a bit lame really. How it should really work is that ’bind’ gives you
a binding and re-binds (if that’s possible) when the buffer is too small.
In practice, though, I doubt it matters very much.
Compile the library with this value equal to T to get the indirection facility. For more performance (because there is no wrapper around the CFFI wrapper!) set this value to NIL
MySQL uses a standard page naming convention that matches our function names!
Takes a mysql function name as a string and registers the
appropriate CFFI function as internal-name.
If *generate-alt-fns* is T internal-name that denotes T a wrapper function
that sits around the function lib<internal-name>.
This function will call the lib<internal-name>, unless there is an ’alt-fn
property set on the function’s symbol. If such a function exists it is called
instead.
e.g.
CL-USER> (connect)
CL-USER> (setf (get ’mysql-close ’alt-fn) (lambda (db)
(print "Closing! ")
(libmysql-close db)))
CL-USER> (disconnect)
Closing!
Return a list of version details <major> <release> <version>
Internal convenience function to clean up connections
Returns the character set information for the connection as a sequence: (collation name number state)
Returns the correct element in the sequence from the row that matches the column-name
http://dev.mysql.com/doc/refman/5.0/en/mysql-affected-rows.html
http://dev.mysql.com/doc/refman/5.0/en/mysql-character-set-name.html
http://dev.mysql.com/doc/refman/5.0/en/mysql-close.html
http://dev.mysql.com/doc/refman/5.0/en/mysql-errno.html
http://dev.mysql.com/doc/refman/5.0/en/mysql-escape-string.html
http://dev.mysql.com/doc/refman/5.0/en/mysql-fetch-field.html
http://dev.mysql.com/doc/refman/5.0/en/mysql-fetch-fields.html
http://dev.mysql.com/doc/refman/5.0/en/mysql-fetch-lengths.html
http://dev.mysql.com/doc/refman/5.0/en/mysql-fetch-row.html
http://dev.mysql.com/doc/refman/5.0/en/mysql-field-count.html
http://dev.mysql.com/doc/refman/5.0/en/mysql-free-result.html
http://dev.mysql.com/doc/refman/5.0/en/mysql-get-character-set-info.html
http://dev.mysql.com/doc/refman/5.0/en/mysql-get-client-version.html
http://dev.mysql.com/doc/refman/5.0/en/mysql-get-server-version.html
http://dev.mysql.com/doc/refman/5.0/en/mysql-init.html
http://dev.mysql.com/doc/refman/5.0/en/mysql-list-dbs.html
http://dev.mysql.com/doc/refman/5.0/en/mysql-list-fields.html
http://dev.mysql.com/doc/refman/5.0/en/mysql-list-processes.html
http://dev.mysql.com/doc/refman/5.0/en/mysql-list-tables.html
http://dev.mysql.com/doc/refman/5.0/en/mysql-next-result.html
http://dev.mysql.com/doc/refman/5.0/en/mysql-num-fields.html
http://dev.mysql.com/doc/refman/5.0/en/mysql-num-rows.html
http://dev.mysql.com/doc/refman/5.0/en/mysql-options.html
http://dev.mysql.com/doc/refman/5.0/en/mysql-ping.html
http://dev.mysql.com/doc/refman/5.0/en/mysql-query.html
http://dev.mysql.com/doc/refman/5.0/en/mysql-real-connect.html
http://dev.mysql.com/doc/refman/5.0/en/mysql-real-escape-string.html
http://dev.mysql.com/doc/refman/5.0/en/mysql-select-db.html
http://dev.mysql.com/doc/refman/5.0/en/mysql-set-character-set.html
http://dev.mysql.com/doc/refman/5.0/en/mysql-stmt-affected-rows.html
http://dev.mysql.com/doc/refman/5.0/en/mysql-stmt-bind-param.html
http://dev.mysql.com/doc/refman/5.0/en/mysql-stmt-close.html
http://dev.mysql.com/doc/refman/5.0/en/mysql-stmt-errno.html
http://dev.mysql.com/doc/refman/5.0/en/mysql-stmt-error.html
http://dev.mysql.com/doc/refman/5.0/en/mysql-stmt-execute.html
http://dev.mysql.com/doc/refman/5.0/en/mysql-stmt-init.html
http://dev.mysql.com/doc/refman/5.0/en/mysql-stmt-param-count.html
http://dev.mysql.com/doc/refman/5.0/en/mysql-stmt-prepare.html
http://dev.mysql.com/doc/refman/5.0/en/mysql-stmt-sqlstate.html
http://dev.mysql.com/doc/refman/5.0/en/mysql-store-result.html
http://dev.mysql.com/doc/refman/5.0/en/mysql-use-result.html
Prepare a query and return a statement object. Use execute to access it
MySQL provides a class of functions that just process a single result set. Note that we won’t explicity free the result set because return-or-close will do the cleanup for us.
Calling aquire on a single connection returns itself, on a connection-pool it will return
the first available connection. Note that the pool implementation of this method could block
connection-pool
) (conn connection
)) ¶Add a connection into the pool.
connection-pool
)) ¶cl-mysql-error
)) ¶connection-pool
) array) ¶Housekeeping to remove null connections from the end of the connections array. Pool should be locked.
connection-pool
)) ¶Create a new single connection and add it to the pool.
connection-pool
) n min) ¶We use this method to allocate up to the minimum number of connections.
It is called once after initialize-instance and will be called again every
time a connection is acquired from the pool.
connection
)) ¶If a client attempts to release a connection without consuming all the results then we take care of that for them. Because we are probably being called from release don’t also auto-release when we reach the last result!
statement
)) ¶automatically generated reader method
connection-pool
)) ¶automatically generated reader method
connection-pool
)) ¶Disconnects all the connections in the pool from the database.
connection-pool
) (conn connection
)) ¶Internal method. Pool should be locked before-hand.
connection
) conn) ¶connection-pool
)) ¶automatically generated reader method
connection-pool
)) ¶automatically generated reader method
mysql-error
)) ¶mysql-error
)) ¶connection
)) ¶automatically generated reader method
connection-pool
)) ¶automatically generated reader method
connection-pool
)) ¶automatically generated reader method
connection-pool
) array conn) ¶Returns a new array with the given connection object removed (set to NIL) The pool should be locked before this method is called.
connection
) type-map) ¶Internal function that processes a result set and returns all the data. If field-names-and-types is NIL the raw (string) data is returned
connection-pool
) (conn connection
)) ¶Given a pool and a connection, close it if there are more than min-connections or return it to the pool if we have less than or equal to min-connections
connection-pool
) &optional conn) ¶If the connection is not in the expected state raise an error.
connection
) &optional conn) ¶connection
)) ¶Retrieve from a MYSQL_RES a list of cons ((<field name> <field type>)*)
connection-pool
)) ¶automatically generated reader method
connection-pool
)) ¶Take the first available connection from the pool. If there are none, NIL is returned.
connection
)) ¶connection
)) ¶automatically generated reader method
connection
)) ¶automatically generated writer method
connection-pool
)) ¶automatically generated reader method
connection-pool
)) ¶automatically generated reader method
connection-pool
)) ¶automatically generated writer method
connection-pool
)) ¶automatically generated reader method
connection-pool
)) ¶automatically generated writer method
foreign-struct-type
.
translatable-foreign-type
.
The base class of connectability. CL-MYSQL functions operate on a
connectable which is then subclassed into a single connection and a connection pool.
Note that the connectable itself has no state.
foreign-struct-type
.
translatable-foreign-type
.
foreign-struct-type
.
translatable-foreign-type
.
Jump to: | %
(
A B C D E F G H I L M N O P Q R S T U W |
---|
Jump to: | %
(
A B C D E F G H I L M N O P Q R S T U W |
---|
Jump to: | *
+
A B C D E F H I M N O P R S U W |
---|
Jump to: | *
+
A B C D E F H I M N O P R S U W |
---|
Jump to: | C F M P S T |
---|
Jump to: | C F M P S T |
---|