I was thinking of developing a module that allows people to query data. For example if you have a table with names and address you could use it to create a form that allows people to query all the people who live in Melbourne. In effect it'd be like the webform but instead of fields for submitting data it'd be for querying data.
In the query modules you'd be able to specify an SQL query such as:
SELECT s.sid, s.submitted, s.remote_addr, sd.cid, sd.no, sd.data
FROM webform_submissions as s
LEFT JOIN webform_submitted_data as sd on (sd.sid = s.sid)
WHERE sd.nid = 202 and sd.data="!suburb"
and query form would display a suburb field and a user could query on suburb.
Another example is:
select name, surname from tf_people where country="!city" and country="!country"
where a user could query people based upon city and country.
It'd also include something like the webform module field editor where you could specify the format of the fields. For example if 'city' or 'country' is a textfield or date etc.
I'd also include some configuration for the output of the results of the query.
I thought at first it'd be best to integrate this into the webforms module but the advantage of keeping it separate is that you could use on any tables.
I am wondering what peoples thoughts are about such a module.
Comments
this is pretty much what
this is pretty much what http://drupal.org/project/views does with exposed filters....
I had a look at the views
I had a look at the views module but don't see anything that lets you enter your own SQL. Seems to work only on Drupal content. I dont think you could use it to query webform data or your own non drupal tables.
There is one thing that
There is one thing that should be kept in mind: This module should abstract the Query Language or it is almost useless. User of module should be able to change the database -from MySQL to SQLite, for example- without -almost- any changes in queries.
still sounds more like some
still sounds more like some great features for views than an independent module that duplicates much of what views does but adds a couple of things. but as with any open source project, you're free to code whatever you like-- usage will show whether or not anyone else needed the functionality.
Query module idea
Just curious ... have you had a go at this? I could readily use what you're talking about ... seems like it would be a tremendously useful way to quickly open structured data to mining through the web. I could use it today on three different sites!
I'm new to Drupal, but haven't seen anything in my reading of the modules that does what you describe and what I need. Seems like one might be able to adapt some of the mysqlquery code to this purpose, or am I naive or just stupid?
Bob