<div>Barry,</div><div><br></div>I think it could be a pretty powerful and cool thing to at least try out with the prototype.   I&#39;m a ex MapInfo user and in MapBasic we were able to call a user defined function in SQL for a update, insert, etc etc.   So you could do:<div>

<br></div><div>Function MyFunction(someStringVar) as String</div><div>   Return &quot;Foo Bar &quot; + someStringVar</div><meta http-equiv="content-type" content="text/html; charset=utf-8"><div>End Function</div><div><br>

</div><div>And then in the SQL statement.</div><div><br></div><div>UPDATE table SET column = MyFunction(&quot;Hello World&quot;) where column &gt; 100</div><div><br></div><div>This would call MyFunction() for each feature and call a update.  However one shortfall of this is that you couldn&#39;t define functions in the interactive Mapbasic shell inside MapInfo, meaning that you had to write a custom script just to do the above.  </div>

<div><br></div><div>If we could do something like this in the python console and pass functions and variables to custom DSLs I think it would be quite handy.  Of course the DSL would have to know how to handle the variables or it would just return a error. </div>

<div><br></div><div>I know it might not be a easy thing to do but I&#39;m willing to give it a go in my prototype to flesh it out. </div><div><br></div><div>Like you said we should just have to find way to say &quot;this is a python variable&quot; and &quot;this is part of the string to send to the DSL&quot;.   You might be able to use something like %%variableName or %%functionName. The console would parse the string that goes to the DSL and build a dictionary with %%variableName = realPythonVariable and then sends the string and the dictionary to the DSL which at that point it&#39;s up it to worry about evaluating and replacing the values and functions.</div>

<div><br></div><div>Thoughts?</div><meta http-equiv="content-type" content="text/html; charset=utf-8"><meta http-equiv="content-type" content="text/html; charset=utf-8"><meta http-equiv="content-type" content="text/html; charset=utf-8"><div>

<br><div class="gmail_quote">On Fri, Jun 17, 2011 at 5:27 PM, Barry Rowlingson <span dir="ltr">&lt;<a href="mailto:b.rowlingson@lancaster.ac.uk">b.rowlingson@lancaster.ac.uk</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div class="im">On Fri, Jun 17, 2011 at 4:36 AM, Nathan Woodrow &lt;<a href="mailto:madmanwoo@gmail.com">madmanwoo@gmail.com</a>&gt; wrote:<br>
<br>
&gt; Well would that be such a bad thing? The DSLs can return a object from the<br>
&gt; evaluated string so why not let them be mixed.  This would mean you can do<br>
&gt; things like:<br>
&gt;<br>
&gt; mypythonVar = (SQL:Select Sum(column) From Table)<br>
&gt; #Some more python code to assign the value to a QgsFeature<br>
<br>
</div> Oh I didnt say it was bad, just tricky! Done right it would be good -<br>
Python in Qgis is getting variable values from C++ all the time.<br>
<br>
 For example, someone might think they can do:<br>
<br>
 &gt; foo = 1 + 2 # python<br>
 &gt; SQL: select * from table where x=foo<br>
<br>
In fact, I&#39;d be quite frustrated if I couldn&#39;t do that in a single<br>
console. So to implement this, you&#39;ve got to have some way of getting<br>
variables from one interpreter into another, so you might end up with:<br>
<br>
 &gt; SQL: select * from table where x=PYTHON:foo<br>
<br>
but now you are parsing everything before it gets to the destination<br>
parser, but that could be ambiguous with the destination language. So<br>
then the console becomes a macro language all of its own...<br>
<font color="#888888"><br>
Barry<br>
</font></blockquote></div><br></div>