From: Spaceman Spiff on
I don't know Tcl but I'm interested in using SQLite for undo/redo as
demonstrated with Tcl code here: <http://www.sqlite.org/cvstrac/wiki?
p=UndoRedo>. But my program is in C/C++. I wish there was a C/C++
example, or a Tcl to C/C++ translator. Does anyone have any advice for
a C/C++ programmer on what to do with this Tcl code?
From: Spam on
On Wed, 19 May 2010, Spaceman Spiff wrote:

> Date: Wed, 19 May 2010 14:37:41 -0700 (PDT)
> From: Spaceman Spiff <michael.j.kennard(a)gmail.com>
> Newsgroups: comp.lang.tcl
> Subject: Translate TCL to C/C++ for SQLite example
>
> I don't know Tcl but I'm interested in using SQLite for undo/redo as
> demonstrated with Tcl code here: <http://www.sqlite.org/cvstrac/wiki?
> p=UndoRedo>. But my program is in C/C++. I wish there was a C/C++
> example, or a Tcl to C/C++ translator. Does anyone have any advice for
> a C/C++ programmer on what to do with this Tcl code?
>

(I was tempted to ignore this question, as most reasonable people would, I
wade in anyways to teach a lesson, but *NOT* the one you asked for ..)

Run it? Seriously, if you really are a C/C++ programmer as you claim, and
can't figure out how to run a Tcl script then no-one here will be able to
help you.

You have basically stated:

- You don't understand SQLite databases, and don't care
to learn.
- You don't really understand the undo/redo problem
you're actually trying to solve, and don't want to put
in the effort to do so.
- You see that it *HAS* been solved, but only in Tcl, and
you can't be bothered to learn enough Tcl to figure out
how you might approach the problem in C, or even C++

Go back to Space Spiff ... and learn how to ask a proper question on a
usenet news group ... Oh, and while you're at it, learn how to use SQLite
using the very simple API (and DDL/SQL and database design etc), learn
Tcl, and learn the undo/redo problem domain ... then come back and make an
announcement that you've finished the job, and released it as open source.

Sheesh!
Rob Sciuk
From: Spaceman Spiff on
On May 19, 4:37 pm, S...(a)ControlQ.com wrote:
> On Wed, 19 May 2010, Spaceman Spiff wrote:
> > Date: Wed, 19 May 2010 14:37:41 -0700 (PDT)
> > From: Spaceman Spiff <michael.j.kenn...(a)gmail.com>
> > Newsgroups: comp.lang.tcl
> > Subject: Translate TCL to C/C++ for SQLite example
>
> > I don't know Tcl but I'm interested in using SQLite for undo/redo as
> > demonstrated with Tcl code here: <http://www.sqlite.org/cvstrac/wiki?
> > p=UndoRedo>. But my program is in C/C++. I wish there was a C/C++
> > example, or a Tcl to C/C++ translator. Does anyone have any advice for
> > a C/C++ programmer on what to do with this Tcl code?
>
> (I was tempted to ignore this question, as most reasonable people would, I
> wade in anyways to teach a lesson, but *NOT* the one you asked for ..)
>
> Run it?  Seriously, if you really are a C/C++ programmer as you claim, and
> can't figure out how to run a Tcl script then no-one here will be able to
> help you.
>
> You have basically stated:
>
>         - You don't understand SQLite databases, and don't care
>           to learn.
>         - You don't really understand the undo/redo problem
>           you're actually trying to solve, and don't want to put
>           in the effort to do so.
>         - You see that it *HAS* been solved, but only in Tcl, and
>           you can't be bothered to learn enough Tcl to figure out
>           how you might approach the problem in C, or even C++
>
> Go back to Space Spiff ... and learn how to ask a proper question on a
> usenet news group ... Oh, and while you're at it, learn how to use SQLite
> using the very simple API (and DDL/SQL and database design etc), learn
> Tcl, and learn the undo/redo problem domain ... then come back and make an
> announcement that you've finished the job, and released it as open source..
>
> Sheesh!
> Rob Sciuk

Wow. Ironically I found this newsgroup from this page <http://
www.tcl.tk/man/tcl8.5/tutorial/Tcl0.html> which says "The Tcl
community is an exceedingly friendly one." Maybe not?

>         - You don't understand SQLite databases, and don't care
>           to learn.

I'm no SQLite expert but I've written some SQLite related code and am
learning. I'm not sure why you would say I don't care to learn.

>         - You don't really understand the undo/redo problem
>           you're actually trying to solve, and don't want to put
>           in the effort to do so.

It seems you've made some assumptions or jumped to a conclusion. I
think I understand the problem. The SQLite page says "This page
demonstrates how to use triggers to implement undo/redo logic for an
application that uses SQLite as its primary data structure." That's
me. I do want to put in the effort but if someone has already done it
in C/C++ I don't want to reinvent the wheel.

>         - You see that it *HAS* been solved, but only in Tcl, and
>           you can't be bothered to learn enough Tcl to figure out
>           how you might approach the problem in C, or even C++

Well, I am learning it, going through the examples and tutorials at
the URL I mentioned above. It seems kinda neat so far.

> Tcl, and learn the undo/redo problem domain ... then come back and make an
> announcement that you've finished the job, and released it as open source..

I thought this newsgroup might be a source of help for solving
problems, but apparently it's just for announcing finished work?

Seriously dude, lighten up. Life is good.
From: Spam on
On Wed, 19 May 2010, Spaceman Spiff wrote:

> Date: Wed, 19 May 2010 16:29:47 -0700 (PDT)
> From: Spaceman Spiff <michael.j.kennard(a)gmail.com>
> Newsgroups: comp.lang.tcl
> Subject: Re: Translate TCL to C/C++ for SQLite example
>
> On May 19, 4:37�pm, S...(a)ControlQ.com wrote:
>> On Wed, 19 May 2010, Spaceman Spiff wrote:
>>> Date: Wed, 19 May 2010 14:37:41 -0700 (PDT)
>>> From: Spaceman Spiff <michael.j.kenn...(a)gmail.com>
>>> Newsgroups: comp.lang.tcl
>>> Subject: Translate TCL to C/C++ for SQLite example
>>
>>> I don't know Tcl but I'm interested in using SQLite for undo/redo as
>>> demonstrated with Tcl code here: <http://www.sqlite.org/cvstrac/wiki?
>>> p=UndoRedo>. But my program is in C/C++. I wish there was a C/C++
>>> example, or a Tcl to C/C++ translator. Does anyone have any advice for
>>> a C/C++ programmer on what to do with this Tcl code?
>>
>> (I was tempted to ignore this question, as most reasonable people would, I
>> wade in anyways to teach a lesson, but *NOT* the one you asked for ..)
>>
>> Run it? �Seriously, if you really are a C/C++ programmer as you claim, and
>> can't figure out how to run a Tcl script then no-one here will be able to
>> help you.
>>
>> You have basically stated:
>>
>> � � � � - You don't understand SQLite databases, and don't care
>> � � � � � to learn.
>> � � � � - You don't really understand the undo/redo problem
>> � � � � � you're actually trying to solve, and don't want to put
>> � � � � � in the effort to do so.
>> � � � � - You see that it *HAS* been solved, but only in Tcl, and
>> � � � � � you can't be bothered to learn enough Tcl to figure out
>> � � � � � how you might approach the problem in C, or even C++
>>
>> Go back to Space Spiff ... and learn how to ask a proper question on a
>> usenet news group ... Oh, and while you're at it, learn how to use SQLite
>> using the very simple API (and DDL/SQL and database design etc), learn
>> Tcl, and learn the undo/redo problem domain ... then come back and make an
>> announcement that you've finished the job, and released it as open source.
>>
>> Sheesh!
>> Rob Sciuk
>
> Wow. Ironically I found this newsgroup from this page <http://
> www.tcl.tk/man/tcl8.5/tutorial/Tcl0.html> which says "The Tcl
> community is an exceedingly friendly one." Maybe not?
>
>> � � � � - You don't understand SQLite databases, and don't care
>> � � � � � to learn.
>
> I'm no SQLite expert but I've written some SQLite related code and am
> learning. I'm not sure why you would say I don't care to learn.
>
>> � � � � - You don't really understand the undo/redo problem
>> � � � � � you're actually trying to solve, and don't want to put
>> � � � � � in the effort to do so.
>
> It seems you've made some assumptions or jumped to a conclusion. I
> think I understand the problem. The SQLite page says "This page
> demonstrates how to use triggers to implement undo/redo logic for an
> application that uses SQLite as its primary data structure." That's
> me. I do want to put in the effort but if someone has already done it
> in C/C++ I don't want to reinvent the wheel.
>
>> � � � � - You see that it *HAS* been solved, but only in Tcl, and
>> � � � � � you can't be bothered to learn enough Tcl to figure out
>> � � � � � how you might approach the problem in C, or even C++
>
> Well, I am learning it, going through the examples and tutorials at
> the URL I mentioned above. It seems kinda neat so far.
>
>> Tcl, and learn the undo/redo problem domain ... then come back and make an
>> announcement that you've finished the job, and released it as open source.
>
> I thought this newsgroup might be a source of help for solving
> problems, but apparently it's just for announcing finished work?
>
> Seriously dude, lighten up. Life is good.
>

Spiff, ask a proper question and you'll get an answer. Ask how to
translate a Tcl application into C so you can understand it, and you might
expect a bit of pushback.

Recent version of SQLite support not only triggers, but as of 3.6.23
(IIRC) it also supports foreign keys. This is a recent addition, and is
relevant to the task at hand. triggers do the work, but foreign key
constraints can be very helpful ...

If you are only concerned about a few tables, then you should manually
code the service ... if not, and this is to be applied repeatedly, it
would be helpful to query the schema, determine the natural keys, and
prepend a datetime stamp to the natural key of the affected tables to
create a shadow table.

Each table with redu/undu would have a shadow table with additional
timestamp keys. If you needed to extend the functionality to a full audit
trail, then additional data (like user id) would be useful as well.

Rob.
From: ZB on
Dnia 19.05.2010 Spaceman Spiff <michael.j.kennard(a)gmail.com> napisa�/a:

> I don't know Tcl but I'm interested in using SQLite for undo/redo as
> demonstrated with Tcl code here: <http://www.sqlite.org/cvstrac/wiki?
> p=UndoRedo>. But my program is in C/C++. I wish there was a C/C++
> example, [..]

....so wouldn't be better idea to go directly to SQLite mailing list?

If you'll try to use Google (search for "sqlite undo/redo"), you'll surely
find find the message:

http://osdir.com/ml/sqlite-users/2009-07/msg00113.html

....which will lead you to the resources, you're looking for:

http://sourceforge.net/projects/sqlite-undo/

--
Zbigniew