<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,&#39;?s&#39;,&#39;?s&#39;)]<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>&nbsp;</div><br><blockquote class="gmail_quote" style="margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex">You don&#39;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.&nbsp;
</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&#39;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. &nbsp;
</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&#39;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,&nbsp;despite&nbsp;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">
&nbsp;&nbsp;_ _ __ ___ _____ ________ _____________ _____________________ ...<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