My bug.  Fixed in version 1.5 of mysql.plt, which I just uploaded to PLaneT.<br><br>Thanks for the report!<br><br>-Jon<br><br><br><br><br><br><div class="gmail_quote">On Thu, Oct 1, 2009 at 4:46 PM, Scott Hickey <span dir="ltr">&lt;<a href="mailto:sshickey@qwest.net" target="_blank">sshickey@qwest.net</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Using the latest dbi + jazmysql, I get an error trying to insert a null value into column defined as nullable in MySQL.<br>


<br>
Also, I added code that is MySQL specific to return the row id for the row inserted. Is there a database agnostic way to get that id using the dbi module?<br>
<br>
<br>
(define (get-handle) (connect &#39;jazmysql &quot;localhost&quot; 3306 &quot;golfscore&quot; &quot;golfscore&quot; &#39;#:schema &quot;golfscore&quot;))<br>
<br>
<br>
(define-struct hole_played (hole_number par score putts fairway_hit round_played_id [id #:auto] ))<br>
<br>
(define (insert-hole_played hp)<br>
  (let ((a-handle (get-handle)))<br>
    (exec a-handle &quot;insert into hole_played (hole_number, par, score, putts, fairway_hit, round_played_id)<br>
VALUES (?hole_number, ?par, ?score, ?putts, ?fairway_hit, ?round_played_id)&quot;<br>
          `( (hole_number . ,(hole_played-hole_number hp))<br>
             (par . ,(hole_played-par hp))<br>
             (score . ,(hole_played-score hp))<br>
             (putts . ,(hole_played-putts hp))<br>
             (fairway_hit . ,(hole_played-fairway_hit hp))<br>
             (round_played_id . ,(hole_played-round_played_id hp))))<br>
    (caadr (query a-handle &quot;select LAST_INSERT_ID()&quot; &#39;()))))<br>
<br>
(insert-hole_played (make-hole_played 1 4 4 2 null 1))<br>
<br>
<br>
uncaught exception: #&lt;exn:mysql errno=1210 sqlstate=&quot;HY000&quot; message=&quot;Incorrect arguments to mysql_stmt_execute&quot;&gt;<br>
<br>
<br>
Scott Hickey<br>
Senior Consultant<br>
Object Partners, Inc.<br>
<br>
_________________________________________________<br>
  For list-related administrative tasks:<br>
  <a href="http://list.cs.brown.edu/mailman/listinfo/plt-scheme" target="_blank">http://list.cs.brown.edu/mailman/listinfo/plt-scheme</a><br>
</blockquote></div><br>