Use of Query Builder questions

Creating desktop or client-server database solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
BattleWolf
Posts: 5
Joined: Wed Oct 21, 2009 3:53 am

Use of Query Builder questions

Post by BattleWolf » Tue Nov 17, 2009 8:35 pm

Hi,

I am trying to update records in a SQLite table that I link to in a Query Builder automatic query in Rev4.0 (described in the http://downloads.runrev.com/userguide/userguide.pdf PDF on pages 280 and onwards). I am able to view records and move between them.

1) the "Save options" (pg 285 point 8.5.3 in the PDF) are not available in the field properties, "database" page where I link the field to the Query. So I cannot edit the records. Any ideas?

2) How do I have a button to delete the current record and a second button to add a new record. I can do "Next", "Previous", "First" and "Last" but there is no entry for either "Delete" or "Add new". Again, any ideas of what I should pursue?

Thanks!

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Location: Aalst, Belgium
Contact:

Post by Janschenkel » Tue Nov 17, 2009 11:47 pm

BattleWofl wrote:1) the "Save options" (pg 285 point 8.5.3 in the PDF) are not available in the field properties, "database" page where I link the field to the Query. So I cannot edit the records. Any ideas?
Interesting, it seems that someone at RunRev HQ decided to not completely remove these, but moved them off-screen instead. Perhaps they have plans to revise the database linked control system, but this is odd, indeed. The underlying code to update the database is still there...

While you can patch this, with a bit of patience, it's probably best to file this as a bug report in the Quality Control Center - that way, the team can either acknow<ledge that this is obsolete, or put it back in the next release.
BattleWofl wrote:2) How do I have a button to delete the current record and a second button to add a new record. I can do "Next", "Previous", "First" and "Last" but there is no entry for either "Delete" or "Add new". Again, any ideas of what I should pursue?
This is a tricky topic, which comes back regularly. If your query is only fetching items from a single table, this is relatively straightforward:
  • deleting a record could be done, if you entered the primary key in the query builder and any related records are automatically deleted in cascade at the database level
  • creating a new record, however, is a different matter, as rev can't really determine how to fill in the fields that make up the primary key
And the water gets even murkier when the query involves multiple tables:
  • should it try and delete records from all the tables, and how can it determine the where clause for those related deletes?
  • again, how should it create a new record, one for each table, and how should it fill in the primary and foreign keys
All these things require at least database schema knowledge and are highly dependent on the business logic of the application.

But you can script the necessary create and delete queries yourself: by using the revConnectionOfQuery("<query name>") function to get the underlying database connection, and then using this connection in calls to the revExecuteSql <connection id>, <sql query> command.

Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

martin
Posts: 1
Joined: Sat Dec 19, 2009 12:58 am

Re: Use of Query Builder questions

Post by martin » Sat Dec 19, 2009 1:28 am

Janschenkel wrote:Interesting, it seems that someone at RunRev HQ decided to not completely remove these, but moved them off-screen instead. Perhaps they have plans to revise the database linked control system, but this is odd, indeed. The underlying code to update the database is still there...

While you can patch this, with a bit of patience, it's probably best to file this as a bug report in the Quality Control Center - that way, the team can either acknow<ledge that this is obsolete, or put it back in the next release.
I see that this issue was recorded in the Quality Control Centre (Report #8485) on 4th December. The issue was logged against software version 4.0.0 RC1 however I can confirm that this is also the case with version 4.0.0. Is there any feedback available? Alternatively should this be logged as a bug in the User Manual? Perhaps Jan could explain the patch in the meantime?

Thanks very much,
Martin

Post Reply

Return to “Databases”