Re: [sqlite] Tcl API docs - clarification

2012-10-23 Thread Fredrik Karlsson
Hi, I think you should have a look here: http://www.sqlite.org/uri.html Hope that helps! Fredrik On Tue, Oct 23, 2012 at 10:48 AM, John Gillespie wrote: > Just spent a while trying to work out how to access sqlite in read-only > mode from Tcl. > There seems to be

Re: [sqlite] (UML) Visualisation of a SQLite schema ?

2011-04-29 Thread Fredrik Karlsson
Hi, Just thought I'd tell you that I went into solving this issue myself. The resulting script is here: https://github.com/dargosch/sqlite2dot * Requires Tcl and the sqlite3 package for Tcl. It generates a .dot file for use with Graphviz. Very simple script, but it solves the issue I wanted to

[sqlite] (UML) Visualisation of a SQLite schema ?

2011-04-15 Thread Fredrik Karlsson
Hi, I'm looking for a tool that would generate a visualisation (UML?) of the SQLite database schema I'm using, with table constraints and references between tables if possible. Is there such a tool (for Mac)? I've looked into SQL::Translator (produces reasonable output, but does not cover the

Re: [sqlite] Feature suggestion for the Tcl interface : ability to use a list variable in combination with IN

2011-02-12 Thread Fredrik Karlsson
Hi, A very nice extension - I'll look into that one for my integer-only lists, for sure. Thank you! /Fredrik 2011/2/10 Alexey Pechnikov <pechni...@mobigroup.ru>: > See > http://sqlite.mobigroup.ru/wiki?name=ext_intarray_tcl > > 09.02.2011 17:49 пользователь "F

Re: [sqlite] Feature suggestion for the Tcl interface : ability to use a list variable in combination with IN

2011-02-12 Thread Fredrik Karlsson
On Wed, Feb 9, 2011 at 6:15 PM, Eric Smith <eas@gmail.com> wrote: > Fredrik Karlsson wrote: > >> package require sqlite3 >> sqlite3 db :memory: >> db eval {create table a (id INTEGER);} >> db eval {insert into a values (1);} >> db eval {insert int

[sqlite] Feature suggestion for the Tcl interface : ability to use a list variable in combination with IN

2011-02-09 Thread Fredrik Karlsson
Dear list, I find the IN operator quite useful for selecting a set number of things. However, I often have a Tcl list with the things I want to match already when I get to the stage there I should issue a SELECT on the database. I then paste all the elements of the list together with ',' or just

[sqlite] Tcl interface to the int sqlite3_open_v2 funtion's SQLITE_OPEN_READONLY flag?

2011-01-10 Thread Fredrik Karlsson
Hi, I notice that the int sqlite3_open_v2 C function has a SQLITE_OPEN_READONLY which allows opening a database in read only mode. Would it be possible to have this possibility in the Tcl interface too? Perhaps similar to the way the "open" command of Tcl specifies flags. This feature would be

Re: [sqlite] Command line client and Tcl interface behaves differently?

2010-11-20 Thread Fredrik Karlsson
Hi, Sorry, never mind this post. I haven't found the problem actually yet, but a "bare minimum" example fed directly to the interpreter through the command line works correctly: % package require sqlite3 3.7.2 % set inf [open 1_schema.sql r] file6 % set sql [read $inf] [... the contents of the

Re: [sqlite] Command line client and Tcl interface behaves differently?

2010-11-20 Thread Fredrik Karlsson
On Sat, Nov 20, 2010 at 2:43 PM, Richard Hipp <d...@sqlite.org> wrote: > On Sat, Nov 20, 2010 at 8:25 AM, Fredrik Karlsson <dargo...@gmail.com>wrote: > >> Dear list, >> >> I am having a silly problem, and need your expertise. I just want to >> initiate a

[sqlite] Command line client and Tcl interface behaves differently?

2010-11-20 Thread Fredrik Karlsson
Dear list, I am having a silly problem, and need your expertise. I just want to initiate a SQLite database using a schema file in Tcl, but I just get an empty database whatever I do. I asked this question on the Tcl list, and got a reply which I interpret to mean that this is not a problem in my

Re: [sqlite] Resursive trigger not doing full recursion...

2010-11-16 Thread Fredrik Karlsson
Hi Igor, Thank you for the qick response. Of course, this PRAGMA solved the entire issue, once I got a never version of SQLite installed. Thank you! /Fredrik On Tue, Nov 16, 2010 at 10:58 PM, Igor Tandetnik <itandet...@mvps.org> wrote: > Fredrik Karlsson <dargo...@gmail.com>

[sqlite] Resursive trigger not doing full recursion...

2010-11-16 Thread Fredrik Karlsson
Dear list, I'm probably doing something really stupid here, but I feel I need to ask you anyway to see id there is something that I've missed. Is it not possible for a trigger to trigger itself? I get triggers that trigger triggers, but so far not triggers that trigger themselves... (yes, many

Re: [sqlite] Should this work?

2010-05-06 Thread Fredrik Karlsson
Hi, Have you had a look at the EXCEPT statement? http://www.sqlite.org/lang_select.html (bottom of page) "EXCEPT takes the result of left SELECT after removing the results of the right SELECT. " Does this make sense to you? /Fredrik On Thu, May 6, 2010 at 1:03 PM, Matt Young

Re: [sqlite] Aliases in subqueries?

2010-04-02 Thread Fredrik Karlsson
On Fri, Apr 2, 2010 at 1:59 PM, Igor Tandetnik <itandet...@mvps.org> wrote: > Fredrik Karlsson wrote: >> Sorry for asking this SQL question, but I just have to make sure: >> >> -  Aliases in subqueries - are the always, local to the scope of the >> subquery? >&

Re: [sqlite] Get a specific sequence of rows...

2010-03-26 Thread Fredrik Karlsson
On Fri, Mar 26, 2010 at 1:25 PM, Igor Tandetnik <itandet...@mvps.org> wrote: > Fredrik Karlsson wrote: >> This is of course another solution. I guess, coming from R, I was >> looking for a substitute for th %in% operator (or the MySQL IN >> operator as it turns out, now

Re: [sqlite] Get a specific sequence of rows...

2010-03-26 Thread Fredrik Karlsson
On Fri, Mar 26, 2010 at 12:22 PM, Simon Slavin <slav...@bigfraud.org> wrote: > > On 26 Mar 2010, at 9:00am, Fredrik Karlsson wrote: > >> I have a list of id:s stored in a field. I would now like to get some >> information from a table by these id:s, but exactly in t

[sqlite] Get a specific sequence of rows...

2010-03-26 Thread Fredrik Karlsson
Hi, I have a list of id:s stored in a field. I would now like to get some information from a table by these id:s, but exactly in this order. So, if I have a table 1 One 2 Two 3 Three and the sequence "3,1,2" stored somewhere, how do I get a neat list like Three One Two ? I I can see a

[sqlite] All ancestors / descendents of a vertex in sqlite?

2010-03-18 Thread Fredrik Karlsson
Dear list, I have a (small) directed graph which I would be able to fins all ancestors or descendents of a certain vertex (transitive closure?). So, using this graph: CREATE TABLE levels_levels (parent_id INTEGER ,child_id INTEGER, UNIQUE(parent_id, child_id)); INSERT INTO "levels_levels"

[sqlite] When should you move to R*Tree?

2009-11-11 Thread Fredrik Karlsson
Dear list, I am writing small program for large-ish databases involving multiple (nested) comparisons of time references (REAL) against time intervals (also REAL) stored as max and min points (i.e. "is this time point within the intervals I have stored in table X?") At what point, in terms of

Re: [sqlite] Datetime mystery

2009-10-08 Thread Fredrik Karlsson
Hi, Yes! That's it! Sorry about the stupid question then.. select datetime('now','localtime'); seems to do what I want. /Fredrik On Thu, Oct 8, 2009 at 9:39 AM, Simon Davies <simon.james.dav...@googlemail.com> wrote: > 2009/10/8 Fredrik Karlsson <dargo...@gmail.com>: >> H

Re: [sqlite] Datetime mystery

2009-10-08 Thread Fredrik Karlsson
Hi, On Thu, Oct 8, 2009 at 12:04 AM, P Kishor <punk.k...@gmail.com> wrote: > On Wed, Oct 7, 2009 at 5:02 PM, Fredrik Karlsson <dargo...@gmail.com> wrote: >> Dear list, >> >> I am sorry if I am asking a FAQ, but what is differnent with >> datetime() and ti

[sqlite] Datetime mystery

2009-10-07 Thread Fredrik Karlsson
Dear list, I am sorry if I am asking a FAQ, but what is differnent with datetime() and time()? > date # This is the correct time on the system Ons 7 Okt 2009 23:56:36 CEST > sqlite3 temp.sqlite "SELECT datetime();" 2009-10-07 21:56:58 > sqlite3 temp.sqlite "SELECT datetime('now);" SQL error:

Re: [sqlite] Protect against SQL injection inside of the database?

2009-07-16 Thread Fredrik Karlsson
On Thu, Jul 16, 2009 at 1:20 PM, Michael Schlenker wrote: > Your working far too hard. The sqlite Tcl binding already does all thats > needed. > > This is perfectly safe: > set result [db1 eval {select * from X where label = $myStringValue and id > > $compId}] > > But you MUST

[sqlite] Protect against SQL injection inside of the database?

2009-07-16 Thread Fredrik Karlsson
Dear list, Sorry for jumping onto the list mainly to ask a question, but it is an imporant one, and I have failed to find the answer on Google. I am developing a prototype of an application in Tcl using sqlite as the backend database. Now, I know that I will be dealing with quite naïve users,