No subject


Thu Oct 18 11:42:58 CEST 2007


thought about your patch is that it would be very cumbersome to have the
result sets coming out of the "server" object. They should be coming out of
the "query" object, as that is the object that is handling that particular
result set. I kind of envision that once someone has finished with creating
the SQL queries, that they would then create the processing code to handle
each query. That is something that is specific to the query, and not the
"server" object. The way that you have this, we would still need to create =
a
separate "query" and "server" object for each query. That would make
swapping the "server" object in and out very difficult, as it would require
replacing ALL of the "server" objects for each query.

Just to let you know, I need to clean up some more stuff, but I will post m=
y
latest version of the "server" and "query" objects tomorrow. I have not don=
e
a whole lot of testing, but I am able to insert SQL and make the queries,
and get results out. It also handles errors and most recent insert row id
stuff...

Mike


On Dec 22, 2007 1:27 AM, Hans-Christoph Steiner <hans at eds.org> wrote:

>
> 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 obje=
ct
> arguments and creates inlets.  Other than that, the only thing it current=
ly
> does is crash :).
>
>
> http://pure-data.cvs.sourceforge.net/pure-data/externals/hcs/sql_query-he=
lp.pd
> http://pure-data.cvs.sourceforge.net/pure-data/externals/hcs/sql_query.c
>
> .hc
>
> On Dec 21, 2007, at 1:36 PM, Mike McGonagle wrote:
>
>
>
> On 12/21/07, Mathieu Bouchard <matju at artengine.ca> wrote:
> >
> > On Tue, 18 Dec 2007, Mike McGonagle wrote:
> >
> > > [query <srv_id> insert into mytable (id, name, token) values
> > (?f,'?s','?s')]
> > > In this example, the first placeholder would expect a Float, with the
> > next
> > > two expecting a Symbol (just think of this as a variation on the
> > printf
> > > string substitutions).
> >
> > It looks more like the types of [t] [pack] [unpack] [expr] etc.
>
>
>
> Yes, they are PD types.
>
>
> You don't really need to type your data. SQL is largely typeless: at leas=
t
> >
> > at the level of what you can put in one table cell, anything is a
> > string.
> > It becomes typed (but auto-cast) when put in the cell, but rebecomes
> > untyped when taken out of the cell.
>
>
>
> 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 a=
ny
> type, as there are functions for the various datatypes.
>
> http://www.sqlite.org/c3ref/bind_blob.html
>
> This link shows all the different functions used to bind the data to the
> statement placeholders.
>
> http://dev.mysql.com/doc/refman/5.0/en/c-api-prepared-statement-datatypes=
.html
>
>
> 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 tha=
t
> gets passed into the bind function.
>
> Also, from looking at libdbi, it appears that they don't even bother with
> placeholders at all.
>
> This is not an issue of how the user sees these things, it is how the C
> code interfaces with the database.
>
> 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.
>
> > but considering that the databases need to know the specific data types
> > > for each placeholder,
> >
> > heh? do they?
>
>
>
> 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.
>
> Mike
>
>
>   _ _ __ ___ _____ ________ _____________ _____________________ ...
> > | Mathieu Bouchard - t=E9l:+1.514.383.3801, Montr=E9al QC Canada
>
>
>
>
> --
> Peace may sound simple=97one beautiful word=97 but it requires everything=
 we
> have, every quality, every strength, every dream, every high ideal.
> =97Yehudi Menuhin (1916=961999), musician
> _______________________________________________
> PD-list at iem.at mailing list
> UNSUBSCRIBE and account-management ->
> http://lists.puredata.info/listinfo/pd-list
>
>
>
>
>
>
> -------------------------------------------------------------------------=
---
>
>                             kill your television
>
>
>


--=20
Peace may sound simple=97one beautiful word=97 but it requires everything w=
e
have, every quality, every strength, every dream, every high ideal.
=97Yehudi Menuhin (1916=961999), musician

------=_Part_12978_18475354.1198693713948
Content-Type: text/html; charset=WINDOWS-1252
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Hans,<div><br class=3D"webkit-block-placeholder"></div><div>From looking at=
 this (I didn&#39;t compile the external yet), but my first thought about y=
our patch is that it would be very cumbersome to have the result sets comin=
g out of the &quot;server&quot; object. They should be coming out of the &q=
uot;query&quot; object, as that is the object that is handling that particu=
lar result set. I kind of envision that once someone has finished with crea=
ting the SQL queries, that they would then create the processing code to ha=
ndle each query. That is something that is specific to the query, and not t=
he &quot;server&quot; object. The way that you have this, we would still ne=
ed to create a separate &quot;query&quot; and &quot;server&quot; object for=
 each query. That would make swapping the &quot;server&quot; object in and =
out very difficult, as it would require replacing ALL of the &quot;server&q=
uot; objects for each query.
</div><div><br class=3D"webkit-block-placeholder"></div><div>Just to let yo=
u know, I need to clean up some more stuff, but I will post my latest versi=
on of the &quot;server&quot; and &quot;query&quot; objects tomorrow. I have=
 not done a whole lot of testing, but I am able to insert SQL and make the =
queries, and get results out. It also handles errors and most recent insert=
 row id stuff...
</div><div><br class=3D"webkit-block-placeholder"></div><div>Mike</div><div=
><br><br><div class=3D"gmail_quote">On Dec 22, 2007 1:27 AM, Hans-Christoph=
 Steiner &lt;<a href=3D"mailto:hans at eds.org">hans at eds.org</a>&gt; wrote:<br=
><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1=
px #ccc solid;padding-left:1ex;">
<div style=3D"word-wrap:break-word">
<div><br></div><div>I just committed my first stabs at a sketch for the [sq=
l_query] object. &nbsp;It doesn&#39;t do anything yet, but it does recogniz=
e ? placeholders as object arguments and creates inlets. &nbsp;Other than t=
hat, the only thing it currently does is crash :).
</div><div><br></div><div><a href=3D"http://pure-data.cvs.sourceforge.net/p=
ure-data/externals/hcs/sql_query-help.pd" target=3D"_blank">http://pure-dat=
a.cvs.sourceforge.net/pure-data/externals/hcs/sql_query-help.pd</a></div><d=
iv>
<a href=3D"http://pure-data.cvs.sourceforge.net/pure-data/externals/hcs/sql=
_query.c" target=3D"_blank">http://pure-data.cvs.sourceforge.net/pure-data/=
externals/hcs/sql_query.c</a></div><div><br></div><div>.hc</div><br><div><d=
iv class=3D"Ih2E3d">
<div>On Dec 21, 2007, at 1:36 PM, Mike McGonagle wrote:</div><br></div><div=
><div></div><div class=3D"Wj3C7c"><blockquote type=3D"cite"><br><br><div><s=
pan class=3D"gmail_quote">On 12/21/07, <b class=3D"gmail_sendername">Mathie=
u Bouchard
</b> &lt;<a href=3D"mailto:matju at artengine.ca" target=3D"_blank">matju at arte=
ngine.ca</a>&gt; wrote:</span><blockquote class=3D"gmail_quote" style=3D"ma=
rgin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"> On T=
ue, 18 Dec 2007, Mike McGonagle wrote:
<br><br>&gt; [query &lt;srv_id&gt; insert into mytable (id, name, token) va=
lues (?f,&#39;?s&#39;,&#39;?s&#39;)]<br>&gt; In this example, the first pla=
ceholder would expect a Float, with the next <br>&gt; two expecting a Symbo=
l (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> </div><div><br></div><div=
>Yes, they are PD types.</div></div></blockquote><br></div></div><blockquot=
e type=3D"cite">
<div><div></div><div class=3D"Wj3C7c"><div><blockquote class=3D"gmail_quote=
" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-le=
ft:1ex">You don&#39;t really need to type your data. SQL is largely typeles=
s: at least=20
<br>at the level of what you can put in one table cell, anything is a strin=
g.<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> </div><div>
<br></div><div>Yes, I know that these things can be stored in a typeless ma=
nner, 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=
;=20
</div><div><br></div><div><a href=3D"http://www.sqlite.org/c3ref/bind_blob.=
html" target=3D"_blank">http://www.sqlite.org/c3ref/bind_blob.html</a></div=
><div><br></div><div>This link shows all the different functions used to bi=
nd the data to the statement placeholders.=20
</div><div><br></div><div><a href=3D"http://dev.mysql.com/doc/refman/5.0/en=
/c-api-prepared-statement-datatypes.html" target=3D"_blank">http://dev.mysq=
l.com/doc/refman/5.0/en/c-api-prepared-statement-datatypes.html </a></div><=
div>
<br></div><div>And if you look at how MySQL does this, while they only prov=
ide a single bind function, it does have the datatypes for the data in a st=
ructure that gets passed into the bind function. </div><div><br></div><div>
Also, from looking at libdbi, it appears that they don&#39;t even bother wi=
th placeholders at all.</div><div><br></div><div>This is not an issue of ho=
w the user sees these things, it is how the C code interfaces with the data=
base. &nbsp;=20
</div><div><br></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 t=
hey do, they do them differently.</div> <br><blockquote class=3D"gmail_quot=
e" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-l=
eft:1ex">
&gt; but considering that the databases need to know the specific data type=
s<br>&gt; for each placeholder, <br><br>heh? do they?</blockquote><div><br>=
</div><div><br></div><div>SQLite does. MySQL appears to as well. And yes, i=
t 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.=20
</div><div><br></div><div>Mike</div><div><br></div><br><blockquote class=3D=
"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc soli=
d;padding-left:1ex"> &nbsp;&nbsp;_ _ __ ___ _____ ________ _____________ __=
___________________ ...
<br>| Mathieu Bouchard - t=E9l:+1.514.383.3801, Montr=E9al QC Canada</block=
quote></div><br><br clear=3D"all"><br>-- <br>Peace may sound simple=97one b=
eautiful word=97 but it requires everything we have, every quality, every s=
trength, every dream, every high ideal.=20
<br>=97Yehudi Menuhin (1916=961999), musician </div></div><div class=3D"Ih2=
E3d"><div style=3D"margin-top:0px;margin-right:0px;margin-bottom:0px;margin=
-left:0px">_______________________________________________</div><div style=
=3D"margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px">
<a href=3D"mailto:PD-list at iem.at" target=3D"_blank">PD-list at iem.at</a> mail=
ing list</div><div style=3D"margin-top:0px;margin-right:0px;margin-bottom:0=
px;margin-left:0px">UNSUBSCRIBE and account-management -&gt; <a href=3D"htt=
p://lists.puredata.info/listinfo/pd-list" target=3D"_blank">
http://lists.puredata.info/listinfo/pd-list</a></div> </div></blockquote></=
div><br><div> <span style=3D"border-collapse:separate;border-spacing:0px 0p=
x;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:n=
ormal;text-align:auto;text-indent:0px;text-transform:none;white-space:norma=
l;word-spacing:0px">
<br><div><br></div><div><br></div><div>------------------------------------=
----------------------------------------<br></div><div><br></div><div>&nbsp=
;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &n=
bsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;kill your television</div><br></=
span> </div><br>
</div></blockquote></div><br><br clear=3D"all"><br>-- <br>Peace may sound s=
imple=97one beautiful word=97 but it requires everything we have, every qua=
lity, every strength, every dream, every high ideal.<br>=97Yehudi Menuhin (=
1916=961999), musician
</div>

------=_Part_12978_18475354.1198693713948--



More information about the PD-list mailing list