Hi!
> Editing a field when you have NOT done "select *" but rather
> "select column1, column2, ..." has a very large chance of
> updating the wrong columns. It'll do it if:
> - Not all the primary key columns have been selected
> - Not all of the multi-key columns have been selected
> - Not all the fields have been selected (if there are no
> primary/multi keys)
This can be fixed by storing all the keys for a particular table in a
QStringList using the following function:
CMySQLQuery::ColumnQuery(QStringList &list, CMySQLConnection *m, const
QString &qry)
This could be done is by executing a "SHOW KEYS FROM Table1, Table2,
TableN" if SELECT * FROM Table was not the executed query.
We would probably need a QPtrList of QStringLists if several tables are
detected in the query.
This will add one more query for each table in the FROM statement, but
it shouldn't matter much performance wise since SHOW KEYS works really
fast!
Regards,
Jorge
--
For technical support contracts, visit https://order.mysql.com/
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Mr. Jorge del Conde <jorge@stripped>
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Full-Time Developer
/_/ /_/\_, /___/\___\_\___/ Mexico City, Mexico
<___/ www.mysql.com
> -----Original Message-----
> From: Adam Hooper [mailto:adamh@stripped]
> Sent: Friday, April 19, 2002 5:41 AM
> To: mycc@stripped
> Subject: Bug in inline editing: only keys by visible values
>
>
> Editing a field when you have NOT done "select *" but rather
> "select column1, column2, ..." has a very large chance of
> updating the wrong columns. It'll do it if:
> - Not all the primary key columns have been selected
> - Not all of the multi-key columns have been selected
> - Not all the fields have been selected (if there are no
> primary/multi keys)
>
> Also, just about any query that selects from more than one
> table will fail. Maybe once in a while freaky results would
> show up if two tables have all the same field names, but it's
> not likely.
>
> The solution to both these problems: Disable inline editing
> when it won't work. The second case shouldn't be too hard -
> maybe simply parsing the query for "JOIN" and making sure
> there's only one table after "FROM", maybe? For the first, (I
> think) the CSqlTable::exec() query would need to know table
> information. That's well beyond my skill :).
>
> Hope this helps,
>
> ---------------
> Adam Hooper
> adamh@stripped
>
> ---------------------------------------------------------------------
> Before posting please check:
> http://www.mysql.com/products/mycc/index.html
> posting. To
> request this thread, email mycc-thread103@stripped
>
> To unsubscribe, send a message to the address shown in the
> List-Unsubscribe header of this message. If you cannot see
> it, email mycc-unsubscribe@stripped instead.
>