in reply to Re: search data structures using SQL
in thread search data structures using SQL

Thanks. I can give you more details when I get back to the office on Monday. But there's no point in talking about my boss's involvement in any of this, because he has none. This is a tool I'm building only for myself (and my successor, jah forbid).

I've written a bletcherous framework in Plain Ol' Perl, for threading through table relations and such, and I just feel like it would be cleaner to replace all that with SQL. But I'm willing to concede that I may have asked an XY question. :-)

Replies are listed 'Best First'.
Re^3: search data structures using SQL
by einhverfr (Friar) on Nov 17, 2013 at 05:05 UTC

    If you are going to do that, why not just skip SQL, take what is good from SQL, and apply Perlisms to it?

    I.e. instead of SELECT foo FROM bar WHERE baz is not true; why not come up with an SQL-inspired interface that avoids the parsing issues, something like:

    select( columns => ['foo'], start_table => 'bar', condition => '? or !defined ?', bind => ['baz', 'baz'] );

    This would avoid the parsing problems, allow you to add joins, cte's, inline views, and more if you ever need it. It would avoid the hard problems while giving you something where you and your successor could leverage sql knowledge. That means essentially passing in the parse tree rather than the declarative statement to the function, and as such it also avoids the possibility of sql injection.

      Good point; but it's not the interface I care about. I'm not insisting that it be SQL. What I'm looking for is a replacement for the bletcherous blob of an engine I wrote. I assume (yeah, I know) that an engine that implements an SQL interface will be able to do what I want. If I can get the engine without the SQL, that's fine too.