<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
<div><br class="webkit-block-placeholder"></div><div>I just committed my first stabs at a sketch for the [sql_query] object.  It doesn't do anything yet, but it does recognize ? placeholders as object arguments and creates inlets.  Other than that, the only thing it currently does is crash :).</div><div><br class="webkit-block-placeholder"></div><div><a href="http://pure-data.cvs.sourceforge.net/pure-data/externals/hcs/sql_query-help.pd">http://pure-data.cvs.sourceforge.net/pure-data/externals/hcs/sql_query-help.pd</a></div><div><a href="http://pure-data.cvs.sourceforge.net/pure-data/externals/hcs/sql_query.c">http://pure-data.cvs.sourceforge.net/pure-data/externals/hcs/sql_query.c</a></div><div><br class="webkit-block-placeholder"></div><div>.hc</div><br><div><div>On Dec 21, 2007, at 1:36 PM, Mike McGonagle wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><br><br><div><span class="gmail_quote">On 12/21/07, <b class="gmail_sendername">Mathieu Bouchard</b> &lt;<a href="mailto:matju@artengine.ca">matju@artengine.ca</a>&gt; wrote:</span><blockquote class="gmail_quote" style="margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"> On Tue, 18 Dec 2007, Mike McGonagle wrote:<br><br>&gt; [query &lt;srv_id&gt; insert into mytable (id, name, token) values (?f,'?s','?s')]<br>&gt; In this example, the first placeholder would expect a Float, with the next <br>&gt; two expecting a Symbol (just think of this as a variation on the printf<br>&gt; string substitutions).<br><br>It looks more like the types of [t] [pack] [unpack] [expr] etc.</blockquote><div><br class="webkit-block-placeholder"> </div><div><br class="webkit-block-placeholder"></div><div>Yes, they are PD types.</div></div></blockquote><br><blockquote type="cite"><div><blockquote class="gmail_quote" style="margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex">You don't really need to type your data. SQL is largely typeless: at least <br>at the level of what you can put in one table cell, anything is a string.<br>It becomes typed (but auto-cast) when put in the cell, but rebecomes<br>untyped when taken out of the cell.</blockquote><div><br class="webkit-block-placeholder"> </div><div><br class="webkit-block-placeholder"></div><div>Yes, I know that these things can be stored in a typeless manner, but the functions that bind the SQL statement with their placeholders can be of any type, as there are functions for the various datatypes.  </div><div><br class="webkit-block-placeholder"></div><div><a href="http://www.sqlite.org/c3ref/bind_blob.html">http://www.sqlite.org/c3ref/bind_blob.html</a></div><div><br class="webkit-block-placeholder"></div><div>This link shows all the different functions used to bind the data to the statement placeholders. </div><div><br class="webkit-block-placeholder"></div><div><a href="http://dev.mysql.com/doc/refman/5.0/en/c-api-prepared-statement-datatypes.html">http://dev.mysql.com/doc/refman/5.0/en/c-api-prepared-statement-datatypes.html </a></div><div><br class="webkit-block-placeholder"></div><div>And if you look at how MySQL does this, while they only provide a single bind function, it does have the datatypes for the data in a structure that gets passed into the bind function. </div><div><br class="webkit-block-placeholder"></div><div>Also, from looking at libdbi, it appears that they don't even bother with placeholders at all.</div><div><br class="webkit-block-placeholder"></div><div>This is not an issue of how the user sees these things, it is how the C code interfaces with the database.   </div><div><br class="webkit-block-placeholder"></div><div>So, just how do we do this in a consistent manner when all the different interfaces don't support these things, AND if they do, they do them differently.</div> <br><blockquote class="gmail_quote" style="margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex">&gt; but considering that the databases need to know the specific data types<br>&gt; for each placeholder, <br><br>heh? do they?</blockquote><div><br class="webkit-block-placeholder"></div><div><br class="webkit-block-placeholder"></div><div>SQLite does. MySQL appears to as well. And yes, it is possible to just force everything to be a string/c-string and be done with it. SQLite actually stores everything as a string anyway, despite the defined types in the create statement. </div><div><br class="webkit-block-placeholder"></div><div>Mike</div><div><br class="webkit-block-placeholder"></div><br><blockquote class="gmail_quote" style="margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex">   _ _ __ ___ _____ ________ _____________ _____________________ ...<br>| Mathieu Bouchard - tél:+1.514.383.3801, Montréal QC Canada</blockquote></div><br><br clear="all"><br>-- <br>Peace may sound simple—one beautiful word— but it requires everything we have, every quality, every strength, every dream, every high ideal. <br>—Yehudi Menuhin (1916–1999), musician <div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">_______________________________________________</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><a href="mailto:PD-list@iem.at">PD-list@iem.at</a> mailing list</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">UNSUBSCRIBE and account-management -&gt; <a href="http://lists.puredata.info/listinfo/pd-list">http://lists.puredata.info/listinfo/pd-list</a></div> </blockquote></div><br><div> <span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><br class="Apple-interchange-newline"><div><br class="khtml-block-placeholder"></div><div><br></div><div>----------------------------------------------------------------------------<br></div><div><br class="khtml-block-placeholder"></div><div>                            kill your television</div><br class="Apple-interchange-newline"></span> </div><br></body></html>