<div dir="ltr"><div>But what about stored procedures? I don't seen any examples of calling an SP using DB at all. <br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Feb 16, 2014 at 11:14 AM, Sean McBeth <span dir="ltr"><<a href="mailto:sean.mcbeth@gmail.com" target="_blank">sean.mcbeth@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">aaah, okay, thanks.<br></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">
On Sun, Feb 16, 2014 at 11:13 AM, Ryan Culpepper <span dir="ltr"><<a href="mailto:ryanc@ccs.neu.edu" target="_blank">ryanc@ccs.neu.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>On 02/15/2014 05:11 PM, Sean McBeth wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
All of the examples in the documentation for the db package use either<br>
question-mark placeholders or numbered placeholders, i.e.<br>
"select * from some_table where some_column = ?"<br>
"select * from some_table where some_column = $1"<br>
<br>
The three databases that I use (SQL Server, MySQL, and Postgres) all<br>
support the question mark syntax, but you can only refer to a single<br>
parameter once in a query with the question mark.<br>
<br>
MySQL and Postgres support numbered parameters, but SQL Server does not.<br>
Or at least, not that I'm aware of. I've never seen anyone use it that<br>
way, and I can't find any examples online.<br>
<br>
Regardless, I rather much prefer named parameters, anyway, as it makes<br>
the queries easier to read.<br>
"select * from some_table where some_column = $param1"<br>
<br>
I know MySQL, Postgres, AND SQL Server all can support this style (well,<br>
replacing $ with @ for SQL Server), because I have a boat load of C#<br>
code doing it right now.<br>
<br>
But there is no indication of how to execute such a query in Racket with DB.<br>
</blockquote>
<br></div></div>
The PostgreSQL server itself only supports "$N" parameters. The MySQL server (AFAIK) only supports "?" parameters.<br>
<br>
Support for other parameter syntaxes may be added by the particular library or driver you're using to communicate with the back end. For example, I think ODBC drivers all support "?" placeholders.<br>
<br>
The Racket db library doesn't add support for other parameter syntaxes, and I have no plans to add it. (Not in terms of rewriting strings of SQL code, anyway; possibly from a structured representation of SQL code.)<br>
<br>
You could write the translation(s) using proper tokenizer(s) or regexps that happen to work on the queries in your program and then create a statement wrapper using prop:statement that would run the translator for the appropriate dialect.<span><font color="#888888"><br>
<br>
Ryan<br>
<br>
</font></span></blockquote></div><br></div>
</div></div></blockquote></div><br></div>