<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>Since both the current Pd-SQL devs (Mike and Jamie :) have posted to this thread, I want to bring up the interface again.  What do you guys think about the two inlet interface for SQL objects?  I just find the sql/sqlend thing very strange, and it could end up being difficult to work with.  I see the interface like this: the hot inlet is for meta commands, like "open", "close", "export", "connect", etc.  Then the second, cold inlet is for building SQL queries.  Having a cold inlet devoted to building SQL queries would mean that you would not need any special "sql/sqlend" style tags at all.</div><div><br class="webkit-block-placeholder"></div><div>Instead, you'd just send messages to the cold inlet, those messages would be appended to the existing SQL message buffer.  Then when the query is ready to be sent, send a "submit" or "run" or whatever to the hot inlet, and it would run the buffer from the cold inlet and clear it.  There would also be a "clear" command to just clear the buffer without sending it.</div><div><br class="webkit-block-placeholder"></div><div>This would allow for the comma trick, etc. and I think it would fit better into Pd's message processing.  In addition, there could be a single line message for the hot inlet, like this:</div><div><br class="webkit-block-placeholder"></div><div>"submit insert into mine (name) values ('the_text')" </div><div><br class="webkit-block-placeholder"></div><div>I'll help implement this if you want.  I just have a strong aversion to the "sqlend" stuff since I think it could end up being strange to use within Pd.  Plus I think these are very valuable objects to have, so I think it's important to get the interface right.  Basically, I am thinking of something along the lines of the [textfile] interface, as much as possible. Here's a sketch:</div><div><br class="webkit-block-placeholder"></div><div>__hot inlet__</div><div>[open $1(</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" style="font: 12.0px Helvetica">[close(</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" style="font: 12.0px Helvetica">[export $1(   - this could be used to export the database to a .sql file</font></div><div><br class="webkit-block-placeholder"></div><div>[clear (</div><div>[submit (</div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" style="font: 12.0px Helvetica">[submit insert into mytable (name) values ('$1') (</font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br class="webkit-block-placeholder"></div></div><div><br class="webkit-block-placeholder"></div><div>__cold inlet__</div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" style="font: 12.0px Helvetica">[insert into mytable (name) values ('$1') (</font></div></div><div>[CREATE TABLE datatable(id INTEGER, duration FLOAT, type VARCHAR, datetime DATETIME)  (</div><div>[SELECT id, ABS((duration - 1500)/1500) AS error FROM datatable ORDER BY error LIMIT 1(</div><div><br class="webkit-block-placeholder"></div><div>Also, on a different note, I think it could be useful to have various status and meta data queries output on the second inlet.  Currently in [psql], there is just a bang on complete.  But there could be things information about the database that aren't available via SQL.</div><div><br class="webkit-block-placeholder"></div><div>Finally, there is the source code for the Max/MSP mysql external, so I think it should be pretty easy to make a mysql version of this interface as well.  Then we'll have a nice trio of SQL options: embedded, PGSQL, and MySQL.</div><div><br class="webkit-block-placeholder"></div><div><a href="http://www.publicbeta.cx/maxx/">http://www.publicbeta.cx/maxx/</a></div><div><br class="webkit-block-placeholder"></div><div>.hc</div><div><br class="webkit-block-placeholder"></div><div><br class="webkit-block-placeholder"></div><div><div>On Dec 7, 2007, at 4:32 PM, Mike McGonagle wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Andy, have you had a chance to check out the SQLite external yet? You can get a copy of it here ( <a href="http://puredata.info/Members/mjmogo">http://puredata.info/Members/mjmogo</a> ), the latest version is 0.13. While this is still under developement, it is based on the work of Jamie (and others), as far as how the SQL is handled. They are not exactly the same, but I would like to make that one of the goals so that these things can be interchangeable. <div><br class="webkit-block-placeholder"></div><div>One thing that I have not done yet is implement any kind of Blob data types. It appears that SQLite3 (not the external, but the database) handles Blobs as binary strings. I still don't know quite how this would work in PD though. I would like to get some feedback from others about how to do this. </div><div><br class="webkit-block-placeholder"></div><div>As SQLite3 stores its database in a file, rather than a server, there is no need to set up anything for the database (other than designing the tables). Also, if you need to, you can use the tools from SQLite3 to work with the same database file. </div><div><br class="webkit-block-placeholder"></div><div>I work on the Mac, so the Makefile is setup to build a Universal Binary (thanks to Hans). If you are on another platform, it shouldn't be difficult to compile these things, as SQLite3 is pure ANSI C. When I compile it, there are a lot of warnings generated, but everything works fine. I guess I should turn off all the warnings for that part of the compile. </div><div><br class="webkit-block-placeholder"></div><div>But, let me know if you try this. I am eager to see how it works for others.</div><div><br class="webkit-block-placeholder"></div><div>Thanks,</div><div><br class="webkit-block-placeholder"> </div><div>Mike McGonagle</div><div><br><br><div><span class="gmail_quote">On 12/7/07, <b class="gmail_sendername"><a href="mailto:andy.graybeal@casanueva.com">andy.graybeal@casanueva.com</a></b> &lt;<a href="mailto:andy.graybeal@casanueva.com"> andy.graybeal@casanueva.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex">i installed postgresql, and got it running, created a user for myself, <br>compiled [psql] from postlude (i'm using pd-extended from cvs).<br><br>i opened up the psql-help file and started with the first instruction, and<br>it created the database fine, i moved to the second command and get this <br>error:<br>psql: Action failed. PQresultStatus is PGRES_FATAL_ERROR<br><br>i'm wondering where i can look for more information about what is going<br>wrong, and what i can do to fix it.<br><br>i think it would be wonderful if i could start using a database to store <br>values :)<br><br>-andy<br><br><br>_______________________________________________<br><a href="mailto:PD-list@iem.at">PD-list@iem.at</a> mailing list<br>UNSUBSCRIBE and account-management -&gt; <a href="http://lists.puredata.info/listinfo/pd-list"> http://lists.puredata.info/listinfo/pd-list</a><br></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><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></div><div>----------------------------------------------------------------------------</div><div><br></div><div>If you are not part of the solution, you are part of the problem.</div><br class="Apple-interchange-newline"></span> </div><br></body></html>