[yunqa.de] Re: [SQLiteSpy] enable modifications on SELECT statements or VIEWS

  • From: Marco NOVARO <marco.novaro@xxxxxxxxx>
  • To: yunqa@xxxxxxxxxxxxx
  • Date: Thu, 28 Oct 2010 16:33:23 +0200

Shouldn't ROWID work for this issue?
For instance,

SELECT ROWID, * FROM "Tickets";

returns a column (ROWID) that is the same as my private ID ("ID" INTEGER
PRIMARY KEY NOT NULL), and the following statement:

UPDATE Tickets SET Assigned = 'MySelf' WHERE ROWID=5

works fine.

Thanks for the answer!
Marco


2010/10/28 Delphi Inspiration <delphi@xxxxxxxx>

> On 27.10.2010 13:55, Marco NOVARO wrote:
>
> > I really like being able to modify data inside a SQLite DB simply by
> > pressing F2.
> >
> > But, sometimes I would like to modify data retrieved via a "SELECT"
> > statement, usually with a filter ("SELECT * FROM Table WHERE ..."); this
> > would be really useful, especially in laaaarge tables.
>
> Yes, I looked into ways to allow arbitrary cell editing when I
> implemented table editing in SQLiteSpy. Unfortunately, there are
> limitations in SQLite which are difficult to overcome.
>
> Cell editing needs to know the INTEGER PRIMARY KEY of a cell in order to
> be able to update. At current, SQLite has no API to retrieve this for
> arbitrary cells like SELECT * FROM t WHERE ... . I posted a request to
> the SQLite mailing list but the developers were not interested in
> implementing it.
>
> > The same (with minor impact on my side) should also be possible on
> > views, but this would require a proper trigger (INSTEAD OF) set up in
> > the view itself.
>
> The problem with VIEWs is just the same as with SELECTs. For both,
> SQLiteSpy could parse and rewrite the SQL to guarantee missing INTEGER
> PRIMARY KEY fields. I have strong doubts that this will work 100% right
> at all times because of the complexity of the SQL grammer. To be on the
> safe side, I dismissed the idea as I do not want SQLiteSpy to risk data
> corruption. ;-)
>
> Ralf
> _______________________________________________
> Delphi Inspiration mailing list
> yunqa@xxxxxxxxxxxxx
> //www.freelists.org/list/yunqa
>
>
>
>

Other related posts: