views:

525

answers:

5

So, I need to construct a front-facing query builder for a database, but I'm having trouble finding existing code for what I can't imagine is a rare requirement.

Basically, I have non-SQL fluent people needing to build queries on the fly and view the results.

I found this: http://plugins.jquery.com/project/SQL_QUERY_BUILDER (Demo: http://ksistem.com/jquery/sqlbuilderdemo.htm)

But it requires that the database schema be hardcoded, rather than be dynamically generated.

Is there a better solution that dyamically pulls the database schema into a jQuery-like UI for building and executing SELECT queries against a MySQL database?

+2  A: 

Active Query Builder ASP.NET Edition's MS Access-like user interface is based on jQuery. It's a commercial component for ASP.NET 2.0 and higher. It can build SELECT statements for MySQL server.

Product page: http://www.activequerybuilder.com/product_asp.html Demo: http://aspquerybuilder.net

Sergey Smagin
I wish if it was an open source! :(. +1 though
Ismail
A: 

can you give us an example of a non-sql statement that you need to parse? I assume you only want to turn them into standard SQL

Purefan
A: 

Dynamically creating the database schema might be a problem, because of the relations between tables. You could let the users carry the burden of selecting the relations but if i look at the "non-SQL fluent people" around me.. i'd probably not do that..

Other than that, if you want to create/check the structure on the fly, you practically have to create/check it every time the script is called. Generating a maybe huge, not necessary, overhead. I`d probably rather have a script/db-admin generate/update the structure every time someone twiddles with the database.

I doubt that you'll find something that does exactly what your looking for. Maybe pulling the structure out of a YAML file that's kept up to date by the db-admin might be better a better solution.

Kuchen
A: 

You may be interested in MyQuery Builder (PHP/Javascript) http://sourceforge.net/projects/myquerybuilder/

I have not used it yet but it's feature list looks promising.

Chris Jacob
A: 

jQuery plugin link you have given is amazing. I think you can now create some functionality to generate JSON of schema for passing it to the jQuery plugin.

Ismail