Loading ...
Sorry, an error occurred while loading the content.

1247Expressing SQL queries in JSON

Expand Messages
  • Guillaume Filion
    Apr 29, 2009
    • 0 Attachment
      Hi,

      I'm developing a web front-end to our student database and I'd like to
      let the users specify what fields they want in their view and be able to
      filter and sort the data.

      After some thinking I figured out that this all can be expressed by an
      SQL query -- and it will end up generating an SQL query on the server.

      So I made a JSON syntax like this:
      {
      "fields":["std_id","code","lastname","firstname"],
      "filters":[{"prog":["200A0","200A1"]},{"decision":["A%"]}],
      "sort":[{"cote_mix":"desc"}]
      }
      which would generate an SQL query like this:
      SELECT std_id, code, lastname, firstname FROM students
      WHERE prog IN ('200A0','200A1') AND decision LIKE 'A%'
      ORDER BY cote_mix DESC

      But I feel like I'm re-inventing the wheel here...
      Is there already a specification for expressing an SQL query in JSON?

      Thanks,
      GFK's
      --
      Guillaume Filion
      http://guillaume.filion.org/



      [Non-text portions of this message have been removed]
    • Show all 4 messages in this topic