My favorites | Sign in
Project Home Source
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 1212: editable user queries
  Back to list
Status:  Duplicate
Owner:  ----
Closed:  Jun 2009


Sign in to add a comment
 
Reported by rosenfie...@gmail.com, Jun 10, 2009
What is the problem that needs to be solved (required)?
After doing a custom SELECT query, it is not possible to alter the contents
of the result set and have the updates posted back to the server.

What is the idea in abstract terms (optional)?
To begin with, add support for editing result sets that relate to a single
table only.  Should be somewhat feasible, since this is how Zeos already
updates records - based on the primary key of a single table.

Updating multiple tables is a much harder problem.  The problem is already
solved in the server, by the way: if you prepend the select query with
"CREATE VIEW ... AS", and then browse the newly created view in the data
grid, you will be able to edit even more complex result sets.

Example workflow using the new feature (optional)?
1) Create a table with a primary key.
2) Execute "SELECT x, y FROM c".
3) Edit a field value in the result grid.
4) Click apply.

What is a practical way to implement this idea (optional)?
When the server returns a result set, for each column it also returns:
 - the original table it came from
 - the original column it came from

Except of course for derivated columns, literals, etc.

So in theory it is possible, after executing a query:

 * for each column
   * check that they are from the same original table, otherwise abort

 * for each original table
   * query information_schema for a a list of primary (and unique
all-not-null keys)
   * for each of the candidate keys found
     * compare the list of columns comprising the candidate key with the
original columns in the result set
     * if all columns of the candidate key are present in the result set,
select the key and note the details of the key for use in later UPDATE
statements

When updating,

 * use the noted key to update the result set.

Jun 10, 2009
#1 rosenfie...@gmail.com
Duplicate of #723.
Status: Duplicate
Mergedinto: 723
Sign in to add a comment

Powered by Google Project Hosting