Changeset 7943 in project for release/3/mysql/tags/1.31/mysql.html


Ignore:
Timestamp:
01/26/08 20:49:29 (12 years ago)
Author:
Kon Lovett
Message:

Chgd fetch row body to handle binary blob/string.

Location:
release/3/mysql/tags/1.31
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • release/3/mysql/tags/1.31/mysql.html

    r7902 r7943  
    158158<h3>Version</h3>
    159159<ul>
    160 <li>1.3 Additional functions [Kon Lovett].</li>
    161 <li>1.2 Fix for ticket #297 [Mario Domenech Goulart].</li>
     160<li>1.31 Additional functions &amp; special handling of binary column. [Kon Lovett]</li>
     161<li>1.3 Additional functions. [Kon Lovett]</li>
     162<li>1.2 Fix for ticket #297. [Mario Domenech Goulart]</li>
    162163<li>1.1 Cross-platform compilation fixes, et al.</li>
    163164<li>1.0 Initial release</li></ul></div>
     
    172173<div class="section">
    173174<h3>Documentation</h3>
    174 <p>The MySQL egg provides (most of) the functions offered by the MySQL C API (the <tt>foreign-mysql-*</tt> functions). It also maps those to a set of slightly more convenient Scheme functions (the <tt>mysql-*</tt> functions). Finally, a few extra functions are provided for easy of use.</p>
     175<p>The MySQL egg provides (most of) the functions offered by the MySQL C API (the <tt>foreign-mysql-*</tt> functions). It also provides a set of slightly more convenient Scheme functions (the <tt>mysql-*</tt> functions). Finally, a few extra functions are provided for easy of use.</p>
    175176<p>Only the most often used MySQL functions are described in this document. If you really want to see the full listing, consult the <a href="mysql-mole.html">mole documentation</a>.</p>
    176177<p>Please send bug reports and suggestions to <a href="mailto:toby@butzon.com">toby@butzon.com</a>.</p>
    177178<div class="subsection">
     179<h4>Exceptions</h4>
     180<p>Conditions of the kind <code>(exn mysql)</code> are signaled for error situations.<table class="symbol-table">Properties
     181<tr>
     182<td class="symbol">location</td>
     183<td>Where the error occured - usually a procedure name.</td></tr>
     184<tr>
     185<td class="symbol">arguments</td>
     186<td>Values that contributed to the error.</td></tr>
     187<tr>
     188<td class="symbol">message</td>
     189<td>Error message.</td></tr></table></p></div>
     190<div class="subsection">
    178191<h4>Connections</h4>
    179192<dt class="definition"><strong>procedure:</strong> (mysql-connect [KEYWORDS])</dt>
    180193<dd>
    181194<p>Connect to a MySQL server.</p>
    182 <p>Returns a MySQL connection object suitable for passing to the other MySQL functions. This object is referred to as <tt>DB</tt> when passed by all the other MySQL functions. Returns <tt>#f</tt> when the connection fails.</p>
     195<p>Returns a MySQL connection object suitable for passing to the other MySQL functions. This object is referred to as <tt>CONN</tt> when passed by all the other MySQL functions. Signals an exception when the connection fails.</p>
    183196<p>Any number of the following <tt>KEYWORDS</tt> may be included:
    184197<ul>
    185 <li>host</li>
    186 <li>user</li>
    187 <li>passwd</li>
    188 <li>db</li>
    189 <li>port</li>
    190 <li>unix-socket</li>
    191 <li>client-flag</li></ul></p>
     198<li><tt>host</tt></li>
     199<li><tt>user</tt></li>
     200<li><tt>passwd</tt></li>
     201<li><tt>db</tt></li>
     202<li><tt>port</tt></li>
     203<li><tt>unix-socket</tt></li>
     204<li><tt>client-flag</tt></li>
     205<li><tt>ssl</tt> - A <code>mysql-ssl</code> record object.</li>
     206<li><tt>options</tt> - An association list of <code>(&lt;mysql-option&gt; . &lt;object&gt;)</code>.</li></ul></p>
    192207<p>Note that default values are available for all of these arguments. (Consult the <a href="http://dev.mysql.com/doc/mysql/en/c.html">MySQL C API</a> for details on how these defaults are determined.)</p></dd>
    193 <dt class="definition"><strong>procedure:</strong> (mysql-close DB)</dt>
    194 <dd>
    195 <p>Closes the connection to <tt>DB</tt>. This frees any remaining MySQL resources from memory, but invalidates the MySQL connection object (<tt>DB</tt>) so that it may no longer be used.</p></dd></div>
    196 <div class="subsection">
    197 <h4>Basic Operations</h4>
    198 <dt class="definition"><strong>procedure:</strong> (mysql-query DB SQL-STRING)</dt>
    199 <dd>
    200 <p>Executes <tt>SQL-STRING</tt> on the MySQL server and stores the result in memory. Generates an error (calls <tt>error</tt>) if the query fails.</p></dd>
    201 <dt class="definition"><strong>procedure:</strong> (mysql-fetch-row DB)</dt>
     208<dt class="definition"><strong>procedure:</strong> (mysql-connection? OBJECT)</dt>
     209<dd>
     210<p>Is the <tt>OBJECT</tt> a <code>mysql-connection</code>? Referred to as a <tt>CONN</tt>.</p></dd>
     211<dt class="definition"><strong>procedure:</strong> (mysql-close CONN)</dt>
     212<dd>
     213<p>Closes the connection to <tt>CONN</tt>. This frees any remaining MySQL resources from memory, but invalidates the MySQL connection object (<tt>CONN</tt>) so that it may no longer be used.</p></dd>
     214<div class="subsubsection">
     215<h5>Connect Parameter Constructors</h5>
     216<dt class="definition"><strong>procedure:</strong> (make-mysql-options OPTION-FLAG OPTION-VALUE ...)</dt>
     217<dd>
     218<p>Returns an object suitable as the <tt>options</tt> parameter for <code>mysql-connect</code>.</p>
     219<p>The type of the <tt>OPTION-VALUE</tt> is dependent on the <tt>OPTION-FLAG</tt>.</p></dd>
     220<dt class="definition"><strong>procedure:</strong> (make-mysql-ssl [KEYWORD ...])</dt>
     221<dd>
     222<p>Returns a <code>mysql-ssl</code> record.</p>
     223<p>Any number of the following <tt>KEYWORD ...</tt> may be included:
     224<ul>
     225<li><tt>key</tt> - pathname of key file.</li>
     226<li><tt>certificate</tt> - pathname of certificate file.</li>
     227<li><tt>certificate-authority</tt> - pathname of certificate authority file.</li>
     228<li><tt>trusted-certificates</tt> - pathname of trusted certificates directory.</li>
     229<li><tt>ciphers</tt> - See <a href="http://www.openssl.org/docs/apps/ciphers.html">OpenSSL Ciphers Man Page</a></li></ul></p></dd>
     230<dt class="definition"><strong>procedure:</strong> (mysql-ssl? OBJECT)</dt>
     231<dd>
     232<p>Is the <tt>OBJECT</tt> an <code>mysql-ssl</code> record?</p></dd>
     233<dt class="definition"><strong>procedure:</strong> (mysql-ssl-key-pathname MYSQL-SSL)</dt>
     234<dd>
     235<p>Returns a <code>string</code>.</p></dd>
     236<dt class="definition"><strong>procedure:</strong> (mysql-ssl-certificate-pathname MYSQL-SSL)</dt>
     237<dd>
     238<p>Returns a <code>string</code>.</p></dd>
     239<dt class="definition"><strong>procedure:</strong> (mysql-ssl-certificate-authority-pathname MYSQL-SSL)</dt>
     240<dd>
     241<p>Returns a <code>string</code>.</p></dd>
     242<dt class="definition"><strong>procedure:</strong> (mysql-ssl-trusted-certificates-pathname MYSQL-SSL)</dt>
     243<dd>
     244<p>Returns a <code>string</code>.</p></dd>
     245<dt class="definition"><strong>procedure:</strong> (mysql-ssl-ciphers MYSQL-SSL)</dt>
     246<dd>
     247<p>Returns a <code>string</code>.</p></dd></div></div>
     248<div class="subsection">
     249<h4>Basic Query Operations</h4>
     250<dt class="definition"><strong>procedure:</strong> (mysql-query CONN SQL-STRING)</dt>
     251<dd>
     252<p>Executes <tt>SQL-STRING</tt> on the MySQL server and stores the result in memory. Signals an exception if the query fails.</p></dd>
     253<dt class="definition"><strong>procedure:</strong> (mysql-fetch-row CONN)</dt>
    202254<dd>
    203255<p>Fetches a row from the result set returned by the most recent call to <tt>mysql-query</tt>. If the last query failed, or if there are no more rows left in the result set, returns <tt>#f</tt>; otherwise returns a row object.</p><a name='rowobj'></a>
    204256<p>A row object is defined as a function that takes a single argument. If the argument is a number, the function returns the value of the field for which that number is the index, or <tt>#f</tt> if the index is out of range. Otherwise, the argument must be a symbol or string, in which case the function returns the value of the field for which that string (or symbol converted into a string) is the field/column name. If no such field exists, returns <tt>#f</tt>.</p></dd>
    205 <dt class="definition"><strong>procedure:</strong> (mysql-rewind DB)</dt>
     257<dt class="definition"><strong>procedure:</strong> (mysql-field-count CONN)</dt>
     258<dd>
     259<p>Returns the number of columns for the most recent query.</p></dd>
     260<dt class="definition"><strong>procedure:</strong> (mysql-fetch-lengths CONN)</dt>
     261<dd>
     262<p>Returns a <code>u32vector</code> of the lengths of the columns of the current row.</p></dd>
     263<dt class="definition"><strong>procedure:</strong> (mysql-rewind CONN)</dt>
    206264<dd>
    207265<p>Rewinds the result set; that is, resets the pointer used by <tt>mysql-fetch-row</tt> so that the next call to it will return the first row of the result set. If there is no current result set, does nothing.</p></dd>
    208 <dt class="definition"><strong>procedure:</strong> (mysql-num-rows DB)</dt>
    209 <dd>
    210 <p>Returns the number of rows in the current result set. If no result set exists, returns <tt>#f</tt>.</p></dd></div>
     266<dt class="definition"><strong>procedure:</strong> (mysql-num-rows CONN)</dt>
     267<dd>
     268<p>Returns the number of rows in the current result set. If no result set exists, returns <tt>#f</tt>.</p></dd>
     269<dt class="definition"><strong>procedure:</strong> (mysql-num-fields CONN)</dt>
     270<dd>
     271<p>Returns the number of fields in the current result set. If no result set exists, returns <tt>#f</tt>.</p></dd>
     272<dt class="definition"><strong>procedure:</strong> (mysql-affected-rows CONN)</dt>
     273<dd>
     274<p>Returns the number of rows affected by the current query.</p></dd></div>
    211275<div class="subsection">
    212276<h4>Row Mapping</h4>
    213 <dt class="definition"><strong>procedure:</strong> (mysql-row-fold DB PROC INIT)</dt>
     277<dt class="definition"><strong>procedure:</strong> (mysql-row-fold CONN PROC INIT)</dt>
    214278<dd>
    215279<p>Iterates over the entire result set (regardless of any rows that may have already been returned by <tt>mysql-fetch-row</tt>), calling <tt>PROC</tt> on each row.</p>
    216280<p>Returns the final accumulated value.</p>
    217 <p><tt>PROC</tt> must take three arguments: the row (as <a href="#rowobj">described</a>) for <tt>mysql-fetch-row</tt>, the index of that row in the result set, starting with <tt>1</tt> and ending with <tt>(mysql-num-rows DB)</tt>, and the current accumulated value (initially <tt>INIT</tt>).</p>
     281<p><tt>PROC</tt> must take three arguments: the row (as <a href="#rowobj">described</a>) for <tt>mysql-fetch-row</tt>, the index of that row in the result set, starting with <tt>1</tt> and ending with <tt>(mysql-num-rows CONN)</tt>, and the current accumulated value (initially <tt>INIT</tt>).</p>
    218282<p><tt>PROC</tt> must return a value.</p></dd>
    219 <dt class="definition"><strong>procedure:</strong> (mysql-row-for-each DB PROC)</dt>
     283<dt class="definition"><strong>procedure:</strong> (mysql-row-for-each CONN PROC)</dt>
    220284<dd>
    221285<p>Iterates over the entire result set (regardless of any rows that may have already been returned by <tt>mysql-fetch-row</tt>), calling <tt>PROC</tt> on each row.</p>
    222 <p><tt>PROC</tt> must take three arguments: the row (as <a href="#rowobj">described</a>) for <tt>mysql-fetch-row</tt>, and the index of that row in the result set, starting with <tt>1</tt> and ending with <tt>(mysql-num-rows DB)</tt>.</p></dd>
    223 <dt class="definition"><strong>procedure:</strong> (mysql-row-map DB PROC)</dt>
     286<p><tt>PROC</tt> must take three arguments: the row (as <a href="#rowobj">described</a>) for <tt>mysql-fetch-row</tt>, and the index of that row in the result set, starting with <tt>1</tt> and ending with <tt>(mysql-num-rows CONN)</tt>.</p></dd>
     287<dt class="definition"><strong>procedure:</strong> (mysql-row-map CONN PROC)</dt>
    224288<dd>
    225289<p>Iterates over the entire result set (regardless of any rows that may have already been returned by <tt>mysql-fetch-row</tt>), calling <tt>PROC</tt> on each row.</p>
    226290<p>Returns the list of results of the <tt>PROC</tt> invocations.</p>
    227 <p><tt>PROC</tt> must take three arguments: the row (as <a href="#rowobj">described</a>) for <tt>mysql-fetch-row</tt>, and the index of that row in the result set, starting with <tt>1</tt> and ending with <tt>(mysql-num-rows DB)</tt>.</p>
     291<p><tt>PROC</tt> must take three arguments: the row (as <a href="#rowobj">described</a>) for <tt>mysql-fetch-row</tt>, and the index of that row in the result set, starting with <tt>1</tt> and ending with <tt>(mysql-num-rows CONN)</tt>.</p>
    228292<p><tt>PROC</tt> must return a value.</p></dd>
    229 <dt class="definition"><strong>procedure:</strong> (mysql-query-fold DB QUERY PROC INIT)</dt>
     293<dt class="definition"><strong>procedure:</strong> (mysql-query-fold CONN QUERY PROC INIT)</dt>
    230294<dd>
    231295<p>Combines <tt>mysql-query</tt> and <tt>mysql-row-fold</tt>.</p></dd>
    232 <dt class="definition"><strong>procedure:</strong> (mysql-query-for-each DB QUERY PROC)</dt>
     296<dt class="definition"><strong>procedure:</strong> (mysql-query-for-each CONN QUERY PROC)</dt>
    233297<dd>
    234298<p>Combines <tt>mysql-query</tt> and <tt>mysql-row-for-each</tt>.</p></dd>
    235 <dt class="definition"><strong>procedure:</strong> (mysql-query-map DB QUERY PROC)</dt>
     299<dt class="definition"><strong>procedure:</strong> (mysql-query-map CONN QUERY PROC)</dt>
    236300<dd>
    237301<p>Combines <tt>mysql-query</tt> and <tt>mysql-row-map</tt>.</p></dd>
    238 <dt class="definition"><strong>procedure:</strong> (mysql-foreach-row DB BODY)</dt>
     302<dt class="definition"><strong>procedure:</strong> (mysql-foreach-row CONN BODY)</dt>
    239303<dd>
    240304<p>Synonym for <code>mysql-row-for-each</code>.</p></dd>
    241 <dt class="definition"><strong>procedure:</strong> (mysql-query-foreach DB QUERY BODY)</dt>
     305<dt class="definition"><strong>procedure:</strong> (mysql-query-foreach CONN QUERY BODY)</dt>
    242306<dd>
    243307<p>Synonym for <code>mysql-query-for-each</code>.</p></dd></div>
    244308<div class="subsection">
    245 <h4>Field Access</h4>
     309<h4>MYSQL_FIELD Access</h4>
     310<dt class="definition"><strong>procedure:</strong> (mysql-fetch-field CONN)</dt>
     311<dd>
     312<p>Returns a <code>mysql-field-ptr</code> to the next field, or <code>#f</code>.</p></dd>
     313<dt class="definition"><strong>procedure:</strong> (mysql-fetch-fields CONN)</dt>
     314<dd>
     315<p>Returns a <code>mysql-field-ptr</code> to the first field, or <code>#f</code>.</p></dd>
     316<dt class="definition"><strong>procedure:</strong> (mysql-fetch-field-direct CONN MYSQL-FIELD-NUMBER)</dt>
     317<dd>
     318<p>Returns a <code>mysql-field-ptr</code> to a specific field, or <code>#f</code>.</p></dd>
     319<dt class="definition"><strong>procedure:</strong> (mysql-field-slots MYSQL-FIELD-POINTER MYSQL-FIELD-GETTER ...)</dt>
     320<dd>
     321<p>Returns a list of MYSQL_FIELD entry values, from each <tt>MYSQL-FIELD-GETTER</tt>.</p>
     322<p><tt>MYSQL-FIELD-POINTER</tt> is a pointer to a MYSQL_FIELD, or <code>#f</code>. <tt>MYSQL-FIELD-GETTER</tt> is a <code>mysql-field-*</code> reference function.</p></dd>
     323<dt class="definition"><strong>procedure:</strong> (mysql-fetch-field-slot-direct CONN FIELD-NUMBER MYSQL-FIELD-GETTER)</dt>
     324<dd>
     325<p>Returns a field slot value. Combines <code>mysql-fetch-field-direct</code> and <code>mysql-field-slots</code>.</p></dd>
     326<dt class="definition"><strong>procedure:</strong> (mysql-fetch-field-slot CONN MYSQL-FIELD-GETTER)</dt>
     327<dd>
     328<p>Returns a field slot value. Combines <code>mysql-fetch-field</code> and <code>mysql-field-slots</code>.</p></dd>
     329<dt class="definition"><strong>procedure:</strong> (mysql-fetch-field-slots-direct CONN FIELD-NUMBER MYSQL-FIELD-GETTER ...)</dt>
     330<dd>
     331<p>Returns a list of field slot values. Combines <code>mysql-fetch-field-direct</code> and <code>mysql-field-slots</code>.</p></dd>
     332<dt class="definition"><strong>procedure:</strong> (mysql-fetch-field-slots CONN MYSQL-FIELD-GETTER ...)</dt>
     333<dd>
     334<p>Returns a list of field slot values. Combines <code>mysql-fetch-field</code> and <code>mysql-field-slots</code>.</p></dd>
    246335<div class="subsubsection">
    247 <h5>Field Set Access</h5>
    248 <dt class="definition"><strong>procedure:</strong> (mysql-fetch-field-items DB MYSQL-FIELD-GETTER ...)</dt>
    249 <dd>
    250 <p>Returns a list of lists of MYSQL_FIELD entry values, a list for each <tt>MYSQL-FIELD-GETTER</tt>.</p>
    251 <p><tt>MYSQL-FIELD-GETTER</tt> is a <code>mysql-field-*</code> reference function.</p></dd>
    252 <dt class="definition"><strong>procedure:</strong> (*mysql-fetch-field-item MYSQL-FIELD-POINTER FIELD-COUNT MYSQL-FIELD-GETTER)</dt>
    253 <dd>
    254 <p>Returns a <tt>FIELD-COUNT</tt> length list of MYSQL_FIELD entry (object).</p>
    255 <p><tt>MYSQL-FIELD-POINTER</tt> is a pointer to a vector of MYSQL_FIELD. <tt>FIELD-COUNT</tt> is the number of entries in the vector. <tt>MYSQL-FIELD-GETTER</tt> is a <code>mysql-field-*</code> reference function.</p></dd></div>
    256 <div class="subsubsection">
    257 <h5>Field Entry Access</h5>
     336<h5>Slot Getters</h5>
    258337<dt class="definition"><strong>procedure:</strong> (mysql-field-org-name MYSQL-FIELD-POINTER)</dt>
    259338<dd>
     
    270349<dt class="definition"><strong>procedure:</strong> (mysql-field-db MYSQL-FIELD-POINTER)</dt>
    271350<dd>
    272 <p>Returns <code>pointer -&gt; ?</code>.</p></dd>
     351<p>Returns <code>string</code>.</p></dd>
    273352<dt class="definition"><strong>procedure:</strong> (mysql-field-catalog MYSQL-FIELD-POINTER)</dt>
    274353<dd>
    275 <p>Returns <code>pointer -&gt; ?</code>.</p></dd>
     354<p>Returns <code>string</code>.</p></dd>
    276355<dt class="definition"><strong>procedure:</strong> (mysql-field-def MYSQL-FIELD-POINTER)</dt>
    277356<dd>
    278 <p>Returns <code>pointer -&gt; ?</code>.</p></dd>
     357<p>Returns <code>string</code>.</p></dd>
    279358<dt class="definition"><strong>procedure:</strong> (mysql-field-table MYSQL-FIELD-POINTER)</dt>
    280359<dd>
    281 <p>Returns <code>pointer -&gt; ?</code>.</p></dd>
     360<p>Returns <code>string</code>.</p></dd>
    282361<dt class="definition"><strong>procedure:</strong> (mysql-field-type MYSQL-FIELD-POINTER)</dt>
    283362<dd>
     
    320399<p>Returns <code>unsigned-integer</code>.</p></dd></div></div>
    321400<div class="subsection">
    322 <h4>Enumeration Values</h4><table class="symbol-table">enum enum_mysql_set_option
     401<h4>Field Flag Testing</h4>
     402<dt class="definition"><strong>procedure:</strong> (mysql-field-flags-on? MYSQL-FIELD-POINTER MYSQL-FIELD-FLAG ...)</dt>
     403<dd>
     404<p>Does the field, <tt>MYSQL-FIELD-POINTER</tt>, have all of the <tt>MYSQL-FIELD-FLAG ...</tt> set?</p></dd>
     405<dt class="definition"><strong>procedure:</strong> (mysql-field-flags-off? MYSQL-FIELD-POINTER MYSQL-FIELD-FLAG ...)</dt>
     406<dd>
     407<p>Does the field, <tt>MYSQL-FIELD-POINTER</tt>, have all of the <tt>MYSQL-FIELD-FLAG ...</tt> not set?</p></dd>
     408<dt class="definition"><strong>procedure:</strong> (mysql-field-primary-key? MYSQL-FIELD-POINTER)</dt>
     409<dd>
     410<p>Is the field, <tt>MYSQL-FIELD-POINTER</tt>, a primary key?</p></dd>
     411<dt class="definition"><strong>procedure:</strong> (mysql-field-not-null? MYSQL-FIELD-POINTER)</dt>
     412<dd>
     413<p>Is the field, <tt>MYSQL-FIELD-POINTER</tt>, not null?</p></dd>
     414<dt class="definition"><strong>procedure:</strong> (mysql-field-binary? MYSQL-FIELD-POINTER)</dt>
     415<dd>
     416<p>Is the field, <tt>MYSQL-FIELD-POINTER</tt>, binary?</p></dd>
     417<dt class="definition"><strong>procedure:</strong> (mysql-field-numeric? MYSQL-FIELD-POINTER)</dt>
     418<dd>
     419<p>Is the field, <tt>MYSQL-FIELD-POINTER</tt>, numeric?</p></dd></div>
     420<div class="subsection">
     421<h4>Field Type Testing</h4>
     422<dt class="definition"><strong>procedure:</strong> (mysql-field-type-any? MYSQL-FIELD-POINTER MYSQL-TYPE ...)</dt>
     423<dd>
     424<p>Is the field, <tt>MYSQL-FIELD-POINTER</tt>, type any of <tt>MYSQL-TYPE ...</tt>?</p></dd>
     425<dt class="definition"><strong>procedure:</strong> (mysql-field-type=? MYSQL-FIELD-POINTER MYSQL-TYPE)</dt>
     426<dd>
     427<p>Is the field, <tt>MYSQL-FIELD-POINTER</tt>, <tt>MYSQL-TYPE</tt>?</p></dd>
     428<dt class="definition"><strong>procedure:</strong> (mysql-field-type-clock? MYSQL-FIELD-POINTER)</dt>
     429<dd>
     430<p>Is the field, <tt>MYSQL-FIELD-POINTER</tt>, type time or date related?</p></dd>
     431<dt class="definition"><strong>procedure:</strong> (mysql-field-type-number? MYSQL-FIELD-POINTER)</dt>
     432<dd>
     433<p>Is the field, <tt>MYSQL-FIELD-POINTER</tt>, type a number?</p></dd>
     434<dt class="definition"><strong>procedure:</strong> (mysql-field-type-blob? MYSQL-FIELD-POINTER)</dt>
     435<dd>
     436<p>Is the field, <tt>MYSQL-FIELD-POINTER</tt>, type some kind of blob?</p></dd>
     437<dt class="definition"><strong>procedure:</strong> (mysql-field-type-string? MYSQL-FIELD-POINTER)</dt>
     438<dd>
     439<p>Is the field, <tt>MYSQL-FIELD-POINTER</tt>, type some kind of string?</p></dd>
     440<dt class="definition"><strong>procedure:</strong> (mysql-field-type-magnitude? MYSQL-FIELD-POINTER)</dt>
     441<dd>
     442<p>Is the field, <tt>MYSQL-FIELD-POINTER</tt>, type some kind of number?</p></dd>
     443<dt class="definition"><strong>procedure:</strong> (mysql-field-type-binary? MYSQL-FIELD-POINTER)</dt>
     444<dd>
     445<p>Is the field, <tt>MYSQL-FIELD-POINTER</tt>, type some kind of binary string or blob?</p></dd>
     446<dt class="definition"><strong>procedure:</strong> (mysql-field-type-text? MYSQL-FIELD-POINTER)</dt>
     447<dd>
     448<p>Is the field, <tt>MYSQL-FIELD-POINTER</tt>, type some kind of non-binary string or blob?</p></dd></div>
     449<div class="subsection">
     450<h4>Character Set Access</h4>
     451<dt class="definition"><strong>procedure:</strong> (mysql-set-character-set CONN CHARACTER-SET-NAME)</dt>
     452<dd>
     453<p>Sets the current character set.</p></dd>
     454<dt class="definition"><strong>procedure:</strong> (mysql-character-set-name CONN)</dt>
     455<dd>
     456<p>Returns a <tt>string</tt>.</p></dd>
     457<dt class="definition"><strong>procedure:</strong> (mysql-get-character-set-info CONN)</dt>
     458<dd>
     459<p>Returns a <tt>MY-CHARSET-INFO-POINTER</tt>.</p></dd>
     460<div class="subsubsection">
     461<h5>Slot Getters</h5>
     462<dt class="definition"><strong>procedure:</strong> (my-charset-info-name MY-CHARSET-INFO-POINTER)</dt>
     463<dd>
     464<p>Return a <code>string</code>.</p></dd>
     465<dt class="definition"><strong>procedure:</strong> (my-charset-info-csname MY-CHARSET-INFO-POINTER)</dt>
     466<dd>
     467<p>Return a <code>string</code>.</p></dd>
     468<dt class="definition"><strong>procedure:</strong> (my-charset-info-comment MY-CHARSET-INFO-POINTER)</dt>
     469<dd>
     470<p>Return a <code>string</code>.</p></dd>
     471<dt class="definition"><strong>procedure:</strong> (my-charset-info-dir MY-CHARSET-INFO-POINTER)</dt>
     472<dd>
     473<p>Return a <code>string</code>.</p></dd>
     474<dt class="definition"><strong>procedure:</strong> (my-charset-info-mbminlen MY-CHARSET-INFO-POINTER)</dt>
     475<dd>
     476<p>Return a <code>number</code>.</p></dd>
     477<dt class="definition"><strong>procedure:</strong> (my-charset-info-mbmaxlen MY-CHARSET-INFO-POINTER)</dt>
     478<dd>
     479<p>Return a <code>number</code>.</p></dd></div></div>
     480<div class="subsection">
     481<h4>Miscellaneous Procedures</h4>
     482<dt class="definition"><strong>procedure:</strong> (mysql-change-user CONN [KEYWORD ...])</dt>
     483<dd>
     484<p>Changes the user identity.</p>
     485<p>Any number of the following <tt>KEYWORD ...</tt> may be included:
     486<ul>
     487<li><tt>user</tt></li>
     488<li><tt>passwd</tt></li>
     489<li><tt>db</tt></li></ul></p></dd>
     490<dt class="definition"><strong>procedure:</strong> (mysql-debug DEBUG)</dt>
     491<dd>
     492<p>.</p></dd>
     493<dt class="definition"><strong>procedure:</strong> (mysql-dump-debug-info CONN)</dt>
     494<dd>
     495<p>.</p></dd>
     496<dt class="definition"><strong>procedure:</strong> (mysql-errno CONN)</dt>
     497<dd>
     498<p>.</p></dd>
     499<dt class="definition"><strong>procedure:</strong> (mysql-error CONN)</dt>
     500<dd>
     501<p>Returns a string describing the last mysql error, or #f if no error has occurred.</p></dd>
     502<dt class="definition"><strong>procedure:</strong> (mysql-escape-string CONN SQL)</dt>
     503<dd>
     504<p>Returns an escape encoded form of the <tt>SQL</tt> string.</p></dd>
     505<dt class="definition"><strong>procedure:</strong> (mysql-free-result CONN)</dt>
     506<dd>
     507<p>.</p></dd>
     508<dt class="definition"><strong>procedure:</strong> (mysql-get-client-info)</dt>
     509<dd>
     510<p>.</p></dd>
     511<dt class="definition"><strong>procedure:</strong> (mysql-get-client-version)</dt>
     512<dd>
     513<p>.</p></dd>
     514<dt class="definition"><strong>procedure:</strong> (mysql-get-host-info CONN)</dt>
     515<dd>
     516<p>.</p></dd>
     517<dt class="definition"><strong>procedure:</strong> (mysql-get-proto-info CONN)</dt>
     518<dd>
     519<p>.</p></dd>
     520<dt class="definition"><strong>procedure:</strong> (mysql-get-server-info CONN)</dt>
     521<dd>
     522<p>.</p></dd>
     523<dt class="definition"><strong>procedure:</strong> (mysql-get-server-version CONN)</dt>
     524<dd>
     525<p>.</p></dd>
     526<dt class="definition"><strong>procedure:</strong> (mysql-info CONN)</dt>
     527<dd>
     528<p>.</p></dd>
     529<dt class="definition"><strong>procedure:</strong> (mysql-insert-id CONN)</dt>
     530<dd>
     531<p>.</p></dd>
     532<dt class="definition"><strong>procedure:</strong> (mysql-kill CONN PID)</dt>
     533<dd>
     534<p>.</p></dd>
     535<dt class="definition"><strong>procedure:</strong> (mysql-list-dbs CONN LIKE)</dt>
     536<dd>
     537<p>.</p></dd>
     538<dt class="definition"><strong>procedure:</strong> (mysql-list-fields CONN TABLE WILD)</dt>
     539<dd>
     540<p>.</p></dd>
     541<dt class="definition"><strong>procedure:</strong> (mysql-list-processes CONN)</dt>
     542<dd>
     543<p>.</p></dd>
     544<dt class="definition"><strong>procedure:</strong> (mysql-list-tables CONN WILD)</dt>
     545<dd>
     546<p>.</p></dd>
     547<dt class="definition"><strong>procedure:</strong> (mysql-num-fields CONN)</dt>
     548<dd>
     549<p>.</p></dd>
     550<dt class="definition"><strong>procedure:</strong> (mysql-num-rows CONN)</dt>
     551<dd>
     552<p>.</p></dd>
     553<dt class="definition"><strong>procedure:</strong> (mysql-ping CONN)</dt>
     554<dd>
     555<p>.</p></dd>
     556<dt class="definition"><strong>procedure:</strong> (mysql-select-db CONN DB)</dt>
     557<dd>
     558<p>Returns <code>#t</code> if the select was successful, signals exception otherwise.</p></dd>
     559<dt class="definition"><strong>procedure:</strong> (mysql-stat CONN)</dt>
     560<dd>
     561<p>.</p></dd>
     562<dt class="definition"><strong>procedure:</strong> (mysql-store-result CONN)</dt>
     563<dd>
     564<p>.</p></dd>
     565<dt class="definition"><strong>procedure:</strong> (mysql-thread-id CONN)</dt>
     566<dd>
     567<p>.</p></dd></div>
     568<div class="subsection">
     569<h4>Enumerations &amp; Flags</h4>
     570<div class="subsubsection">
     571<h5>Client Flags</h5>
     572<p><table class="symbol-table">Symbolic Value
     573<tr>
     574<td class="symbol">client-compress</td>
     575<td>CLIENT_COMPRESS</td></tr>
     576<tr>
     577<td class="symbol">client-found-rows</td>
     578<td>CLIENT_FOUND_ROWS</td></tr>
     579<tr>
     580<td class="symbol">client-ignore-sigpipe</td>
     581<td>CLIENT_IGNORE_SIGPIPE</td></tr>
     582<tr>
     583<td class="symbol">client-ignore-space</td>
     584<td>CLIENT_IGNORE_SPACE</td></tr>
     585<tr>
     586<td class="symbol">client-interactive</td>
     587<td>CLIENT_INTERACTIVE</td></tr>
     588<tr>
     589<td class="symbol">client-local-files</td>
     590<td>CLIENT_LOCAL_FILES</td></tr>
     591<tr>
     592<td class="symbol">client-multi-results</td>
     593<td>CLIENT_MULTI_RESULTS</td></tr>
     594<tr>
     595<td class="symbol">client-multi-statements</td>
     596<td>CLIENT_MULTI_STATEMENTS</td></tr>
     597<tr>
     598<td class="symbol">client-no-schema</td>
     599<td>CLIENT_NO_SCHEMA</td></tr>
     600<tr>
     601<td class="symbol">client-odbc</td>
     602<td>CLIENT_ODBC</td></tr>
     603<tr>
     604<td class="symbol">client-ssl</td>
     605<td>CLIENT_SSL</td></tr></table></p>
     606<dt class="definition"><strong>procedure:</strong> (mysql-client-flags-value SYMBOL ...)</dt>
     607<dd>
     608<p>Returns the or'ed value of the <tt>SYMBOL ...</tt> values.</p></dd>
     609<dt class="definition"><strong>procedure:</strong> (mysql-client-flags-symbol NUMBER)</dt>
     610<dd>
     611<p>Returns the symbol for the <tt>NUMBER</tt>.</p></dd></div>
     612<div class="subsubsection">
     613<h5>enum enum_mysql_set_option</h5>
     614<p><table class="symbol-table">Symbolic Value
    323615<tr>
    324616<td class="symbol">mysql-option-multi-statements-on</td>
    325 <td></td></tr>
     617<td>MYSQL_OPTION_MULTI_STATEMENTS_ON</td></tr>
    326618<tr>
    327619<td class="symbol">mysql-option-multi-statements-off</td>
    328 <td></td></tr></table><table class="symbol-table">enum mysql_option
     620<td>MYSQL_OPTION_MULTI_STATEMENTS_OFF</td></tr></table></p>
     621<dt class="definition"><strong>procedure:</strong> (mysql-server-option-value SYMBOL ...)</dt>
     622<dd>
     623<p>Returns the or'ed value of the <tt>SYMBOL ...</tt> values.</p></dd>
     624<dt class="definition"><strong>procedure:</strong> (mysql-server-option-symbol NUMBER)</dt>
     625<dd>
     626<p>Returns the symbol for the <tt>NUMBER</tt>.</p></dd></div>
     627<div class="subsubsection">
     628<h5>enum mysql_option</h5>
     629<p><table class="symbol-table">Symbolic Value
    329630<tr>
    330631<td class="symbol">mysql-opt-connect-timeout</td>
    331 <td></td></tr>
     632<td>MYSQL_OPT_CONNECT_TIMEOUT</td></tr>
    332633<tr>
    333634<td class="symbol">mysql-opt-compress</td>
    334 <td></td></tr>
     635<td>MYSQL_OPT_COMPRESS</td></tr>
    335636<tr>
    336637<td class="symbol">mysql-opt-named-pipe</td>
    337 <td></td></tr>
     638<td>MYSQL_OPT_NAMED_PIPE</td></tr>
    338639<tr>
    339640<td class="symbol">mysql-init-command</td>
    340 <td></td></tr>
     641<td>MYSQL_INIT_COMMAND</td></tr>
    341642<tr>
    342643<td class="symbol">mysql-read-default-file</td>
    343 <td></td></tr>
     644<td>MYSQL_READ_DEFAULT_FILE</td></tr>
    344645<tr>
    345646<td class="symbol">mysql-read-default-group</td>
    346 <td></td></tr>
     647<td>MYSQL_READ_DEFAULT_GROUP</td></tr>
    347648<tr>
    348649<td class="symbol">mysql-set-charset-dir</td>
    349 <td></td></tr>
     650<td>MYSQL_SET_CHARSET_DIR</td></tr>
    350651<tr>
    351652<td class="symbol">mysql-set-charset-name</td>
    352 <td></td></tr>
     653<td>MYSQL_SET_CHARSET_NAME</td></tr>
    353654<tr>
    354655<td class="symbol">mysql-opt-local-infile</td>
    355 <td></td></tr>
     656<td>MYSQL_OPT_LOCAL_INFILE</td></tr>
    356657<tr>
    357658<td class="symbol">mysql-opt-protocol</td>
    358 <td></td></tr>
     659<td>MYSQL_OPT_PROTOCOL</td></tr>
    359660<tr>
    360661<td class="symbol">mysql-shared-memory-base-name</td>
    361 <td></td></tr>
     662<td>MYSQL_SHARED_MEMORY_BASE_NAME</td></tr>
    362663<tr>
    363664<td class="symbol">mysql-opt-read-timeout</td>
    364 <td></td></tr>
     665<td>MYSQL_OPT_READ_TIMEOUT</td></tr>
    365666<tr>
    366667<td class="symbol">mysql-opt-write-timeout</td>
    367 <td></td></tr>
     668<td>MYSQL_OPT_WRITE_TIMEOUT</td></tr>
    368669<tr>
    369670<td class="symbol">mysql-opt-use-result</td>
    370 <td></td></tr>
     671<td>MYSQL_OPT_USE_RESULT</td></tr>
    371672<tr>
    372673<td class="symbol">mysql-opt-use-remote-connection</td>
    373 <td></td></tr>
     674<td>MYSQL_OPT_USE_REMOTE_CONNECTION</td></tr>
    374675<tr>
    375676<td class="symbol">mysql-opt-use-embedded-connection</td>
    376 <td></td></tr>
     677<td>MYSQL_OPT_USE_EMBEDDED_CONNECTION</td></tr>
    377678<tr>
    378679<td class="symbol">mysql-opt-guess-connection</td>
    379 <td></td></tr>
     680<td>MYSQL_OPT_GUESS_CONNECTION</td></tr>
    380681<tr>
    381682<td class="symbol">mysql-set-client-ip</td>
    382 <td></td></tr>
     683<td>MYSQL_SET_CLIENT_IP</td></tr>
    383684<tr>
    384685<td class="symbol">mysql-secure-auth</td>
    385 <td></td></tr>
     686<td>MYSQL_SECURE_AUTH</td></tr>
    386687<tr>
    387688<td class="symbol">mysql-report-data-truncation</td>
    388 <td></td></tr></table><table class="symbol-table">enum enum_field_types
     689<td>MYSQL_REPORT_DATA_TRUNCATION</td></tr></table></p>
     690<dt class="definition"><strong>procedure:</strong> (mysql-option-value SYMBOL ...)</dt>
     691<dd>
     692<p>Returns the or'ed value of the <tt>SYMBOL ...</tt> values.</p></dd>
     693<dt class="definition"><strong>procedure:</strong> (mysql-option-symbol NUMBER)</dt>
     694<dd>
     695<p>Returns the symbol for the <tt>NUMBER</tt>.</p></dd></div>
     696<div class="subsubsection">
     697<h5>enum enum_field_types</h5>
     698<p><table class="symbol-table">Symbolic Value
    389699<tr>
    390700<td class="symbol">mysql-type-decimal</td>
    391 <td></td></tr>
     701<td>MYSQL_TYPE_DECIMAL</td></tr>
    392702<tr>
    393703<td class="symbol">mysql-type-tiny</td>
    394 <td></td></tr>
     704<td>MYSQL_TYPE_TINY</td></tr>
    395705<tr>
    396706<td class="symbol">mysql-type-short</td>
    397 <td></td></tr>
     707<td>MYSQL_TYPE_SHORT</td></tr>
    398708<tr>
    399709<td class="symbol">mysql-type-long</td>
    400 <td></td></tr>
     710<td>MYSQL_TYPE_LONG</td></tr>
    401711<tr>
    402712<td class="symbol">mysql-type-float</td>
    403 <td></td></tr>
     713<td>MYSQL_TYPE_FLOAT</td></tr>
    404714<tr>
    405715<td class="symbol">mysql-type-double</td>
    406 <td></td></tr>
     716<td>MYSQL_TYPE_DOUBLE</td></tr>
    407717<tr>
    408718<td class="symbol">mysql-type-null</td>
    409 <td></td></tr>
     719<td>MYSQL_TYPE_NULL</td></tr>
    410720<tr>
    411721<td class="symbol">mysql-type-timestamp</td>
    412 <td></td></tr>
     722<td>MYSQL_TYPE_TIMESTAMP</td></tr>
    413723<tr>
    414724<td class="symbol">mysql-type-longlong</td>
    415 <td></td></tr>
     725<td>MYSQL_TYPE_LONGLONG</td></tr>
    416726<tr>
    417727<td class="symbol">mysql-type-int24</td>
    418 <td></td></tr>
     728<td>MYSQL_TYPE_INT24</td></tr>
    419729<tr>
    420730<td class="symbol">mysql-type-date</td>
    421 <td></td></tr>
     731<td>MYSQL_TYPE_DATE</td></tr>
    422732<tr>
    423733<td class="symbol">mysql-type-time</td>
    424 <td></td></tr>
     734<td>MYSQL_TYPE_TIME</td></tr>
    425735<tr>
    426736<td class="symbol">mysql-type-datetime</td>
    427 <td></td></tr>
     737<td>MYSQL_TYPE_DATETIME</td></tr>
    428738<tr>
    429739<td class="symbol">mysql-type-year</td>
    430 <td></td></tr>
     740<td>MYSQL_TYPE_YEAR</td></tr>
    431741<tr>
    432742<td class="symbol">mysql-type-newdate</td>
    433 <td></td></tr>
     743<td>MYSQL_TYPE_NEWDATE</td></tr>
    434744<tr>
    435745<td class="symbol">mysql-type-varchar</td>
    436 <td></td></tr>
     746<td>MYSQL_TYPE_VARCHAR</td></tr>
    437747<tr>
    438748<td class="symbol">mysql-type-bit</td>
    439 <td></td></tr>
     749<td>MYSQL_TYPE_BIT</td></tr>
    440750<tr>
    441751<td class="symbol">mysql-type-newdecimal</td>
    442 <td></td></tr>
     752<td>MYSQL_TYPE_NEWDECIMAL</td></tr>
    443753<tr>
    444754<td class="symbol">mysql-type-enum</td>
    445 <td></td></tr>
     755<td>MYSQL_TYPE_ENUM</td></tr>
    446756<tr>
    447757<td class="symbol">mysql-type-set</td>
    448 <td></td></tr>
     758<td>MYSQL_TYPE_SET</td></tr>
    449759<tr>
    450760<td class="symbol">mysql-type-tiny-blob</td>
    451 <td></td></tr>
     761<td>MYSQL_TYPE_TINY_BLOB</td></tr>
    452762<tr>
    453763<td class="symbol">mysql-type-medium-blob</td>
    454 <td></td></tr>
     764<td>MYSQL_TYPE_MEDIUM_BLOB</td></tr>
    455765<tr>
    456766<td class="symbol">mysql-type-long-blob</td>
    457 <td></td></tr>
     767<td>MYSQL_TYPE_LONG_BLOB</td></tr>
    458768<tr>
    459769<td class="symbol">mysql-type-blob</td>
    460 <td></td></tr>
     770<td>MYSQL_TYPE_BLOB</td></tr>
    461771<tr>
    462772<td class="symbol">mysql-type-var-string</td>
    463 <td></td></tr>
     773<td>MYSQL_TYPE_VAR_STRING</td></tr>
    464774<tr>
    465775<td class="symbol">mysql-type-string</td>
    466 <td></td></tr>
     776<td>MYSQL_TYPE_STRING</td></tr>
    467777<tr>
    468778<td class="symbol">mysql-type-geometry</td>
    469 <td></td></tr></table></div></div>
     779<td>MYSQL_TYPE_GEOMETRY</td></tr></table></p>
     780<dt class="definition"><strong>procedure:</strong> (mysql-type-value SYMBOL ...)</dt>
     781<dd>
     782<p>Returns the or'ed value of the <tt>SYMBOL ...</tt> values.</p></dd>
     783<dt class="definition"><strong>procedure:</strong> (mysql-type-symbol NUMBER)</dt>
     784<dd>
     785<p>Returns the symbol for the <tt>NUMBER</tt>.</p></dd></div>
     786<div class="subsubsection">
     787<h5>MYSQL_FIELD.flags Flags</h5>
     788<p><table class="symbol-table">Symbolic Value
     789<tr>
     790<td class="symbol">not-null-flag</td>
     791<td>NOT-NULL-FLAG</td></tr>
     792<tr>
     793<td class="symbol">pri-key-flag</td>
     794<td>PRI-KEY-FLAG</td></tr>
     795<tr>
     796<td class="symbol">unique-key-flag</td>
     797<td>UNIQUE-KEY-FLAG</td></tr>
     798<tr>
     799<td class="symbol">multiple-key-flag</td>
     800<td>MULTIPLE-KEY-FLAG</td></tr>
     801<tr>
     802<td class="symbol">unsigned-flag</td>
     803<td>UNSIGNED-FLAG</td></tr>
     804<tr>
     805<td class="symbol">zerofill-flag</td>
     806<td>ZEROFILL-FLAG</td></tr>
     807<tr>
     808<td class="symbol">binary-flag</td>
     809<td>BINARY-FLAG</td></tr>
     810<tr>
     811<td class="symbol">auto-increment-flag</td>
     812<td>AUTO-INCREMENT-FLAG</td></tr>
     813<tr>
     814<td class="symbol">no-default-value-flag</td>
     815<td>NO-DEFAULT-VALUE-FLAG</td></tr></table></p>
     816<dt class="definition"><strong>procedure:</strong> (mysql-field-flags-value SYMBOL ...)</dt>
     817<dd>
     818<p>Returns the or'ed value of the <tt>SYMBOL ...</tt> values.</p></dd>
     819<dt class="definition"><strong>procedure:</strong> (mysql-field-flags-symbol NUMBER)</dt>
     820<dd>
     821<p>Returns the symbol for the <tt>NUMBER</tt>.</p></dd></div></div></div>
    470822<div class="section">
    471823<h3>Examples</h3>
     
    476828(let [(db (mysql-connect host: &quot;mysql.example.com&quot; user: &quot;example&quot;
    477829                         passwd: &quot;secret&quot;))]
    478   (if (not db) (error (conc &quot;MySQL connection failed: &quot; (mysql-error db))))
    479830  (mysql-query db &quot;SHOW DATABASES&quot;)
    480831  (do [(row (mysql-fetch-row db) (mysql-fetch-row db))]
     
    487838(let [(db (mysql-connect host: &quot;mysql.example.com&quot; user: &quot;example&quot;
    488839                         passwd: &quot;secret&quot;))]
    489   (if (not db) (error (conc &quot;MySQL connection failed: &quot; (mysql-error db))))
    490840  (mysql-query-foreach db &quot;SHOW DATABASES&quot;
    491841                       (lambda (row idx)
     
    494844<div class="section">
    495845<h3>Data Type Conversion</h3>
    496 <p>All MySQL result data (except NULL) are returned as Scheme strings. The NULL value is represented by <tt>#f</tt>. Booleans are expressed as Scheme strings <tt>&quot;1&quot;</tt> and <tt>&quot;0&quot;</tt>. All remaining types, including numeric types and strings are returned as Scheme strings.</p></div>
     846<p>All MySQL result data (except NULL) are returned as Scheme strings.</p>
     847<p>The NULL value is represented by <tt>#f</tt>.</p>
     848<p>Booleans are expressed as the Scheme strings <tt>&quot;1&quot;</tt> and <tt>&quot;0&quot;</tt>.</p>
     849<p>All remaining types, including numeric types, blobs, and strings are returned as Scheme strings.</p></div>
    497850<div class="section">
    498851<h3>Bugs</h3>
     852<p>No prepared statement support.</p>
    499853<p>This is alpha quality software. Only very basic functionality has been tested so far. I look forward to providing a more complete test suite (and probably a slew of bugfixes) with the next release.</p>
    500 <p>Does not return native types.</p>
    501854<p><tt>mysql-escape-string</tt> is broken when it's used for binary data.</p>
    502 <p>Not yet sure how to handle <tt>unsigned long *</tt> for <tt>foreign-mysql-fetch-lengths</tt>.</p>
    503 <p><tt>foreign-mysql-get-charset-info</tt> isn't yet supported.</p>
    504855<p>I need to nail down the supported libmysqlclient versions. Right now there are some functions I've put off because they may or may not be supported in my target range. We'll see, soon...</p></div>
    505856<div class="section">
Note: See TracChangeset for help on using the changeset viewer.