[sqlite] regular expression in check constraint?

2015-11-24 Thread James Hartley
I would like to add a check constraint which determines if a string contains all digits, ie. sqlite> select zip_code from zip_codes where regexp(zip_code, '^[[:digit:]]+$'); However, this generates the error: Error: no such function: regexp Searching through sqlite.org points that this

[sqlite] disable update's & delete's via triggers?

2015-09-20 Thread James Hartley
...which states that INSTEAD OF triggers are to be used with views, not tables. Is this still true? I'm using SQlite 3.8.9. Thanks, again. On Sun, Sep 20, 2015 at 6:34 PM, Simon Slavin wrote: > > On 21 Sep 2015, at 12:21am, James Hartley wrote: > > > I am assuming

[sqlite] disable update's & delete's via triggers?

2015-09-20 Thread James Hartley
On Sun, Sep 20, 2015 at 5:20 PM, Simon Slavin wrote: > > Then your next concern is over how to zero-out the log if you really > needed to do that. > > That is a valid concern, however, I am assuming that dropping the trigger will re-enable any action which had been disabled by creating the

[sqlite] disable update's & delete's via triggers?

2015-09-20 Thread James Hartley
As I look at the flowchart for triggers at the following: https://www.sqlite.org/lang_createtrigger.html It appears that the body of a trigger must specify some kind of statement. I ask because I am wanting to log all activity on another table. I can successfully do this with triggers. What I

[sqlite] useful Perl modules for working with SQLite databases?

2012-12-28 Thread James Hartley
SQLite has recently been added to the base installation to the Unix-variant I frequently use. This is a good thing. I'm looking at the various CPAN modules which are available in the ancillary ports sponsored by that Unix-like project, & I see that DBD::SQLite package could be updated. This

Re: [sqlite] triggers & last_insert_rowid?

2011-10-21 Thread James Hartley
On Fri, Oct 21, 2011 at 12:31 PM, Pavel Ivanov wrote: > http://www.sqlite.org/c3ref/last_insert_rowid.html > > "If an INSERT occurs within a trigger or within a virtual table > method, then this routine will return the rowid of the inserted row as > long as the trigger or

[sqlite] triggers & last_insert_rowid?

2011-10-21 Thread James Hartley
After implementing simple auditing of table changes, last_insert_rowid() still provides the value I really want even though additional table inserts are being performed in the background. To illustrate: CREATE TABLE t (a); CREATE TABLE t_log ( timestamp DATETIME NULL DEFAULT

Re: [sqlite] importing CSV data on command-line?

2011-10-14 Thread James Hartley
On Fri, Oct 14, 2011 at 7:37 AM, Simon Davies <simon.james.dav...@gmail.com>wrote: > On 14 October 2011 15:17, James Hartley <jjhart...@gmail.com> wrote: > > When attempting to import CSV data, the shell balks... > > and look at what the separator is set to in the .s

[sqlite] importing CSV data on command-line?

2011-10-14 Thread James Hartley
When attempting to import CSV data, the shell balks at the command-line but is otherwise fine when all is done interactively. I suspect user error, but I just don't see it. Any insight shared would be greatly appreciated. Thanks. $ ls create_table.sql src.csv $ cat create_table.sql src.csv

Re: [sqlite] getting value of last inserted primary key?

2011-10-14 Thread James Hartley
On Fri, Oct 14, 2011 at 1:44 AM, Petite Abeille <petite.abei...@gmail.com>wrote: > > On Oct 14, 2011, at 10:23 AM, James Hartley wrote: > > > Is > > there a way to save the value of last_insert_rowid() as a SQL statement? > > Sure. > > insert &g

[sqlite] getting value of last inserted primary key?

2011-10-14 Thread James Hartley
Okay, here's a few newbie questions. When dealing with tables with foreign constraints, how can the value of a recently inserted primary key be propagated to multiple child tables? Is there a way to save the value of last_insert_rowid() as a SQL statement? Lastly, shouldn't the last INSERT

Re: [sqlite] pzTail parameter to sqlite3_prepare_v2()?

2011-10-09 Thread James Hartley
On Sun, Oct 9, 2011 at 10:27 AM, Igor Tandetnik <itandet...@mvps.org> wrote: > James Hartley <jjhart...@gmail.com> wrote: > > From this, I assume that *pzTail will be set to NULL after compiling > > the stream's last statement? > > I suspect it'll point to the

[sqlite] pzTail parameter to sqlite3_prepare_v2()?

2011-10-09 Thread James Hartley
I am needing some clarification. The documentation speaks that multiple SQL statements can be passed to sqlite3_prepare_v2() which will only compile the first statement of the stream. Upon return, pzTail points to the first character of the next SQL statement which has not been compiled. From

Re: [sqlite] undefined symbol/reference: sqlite3_version. Please!

2011-09-27 Thread James Hartley
On Sun, Sep 25, 2011 at 7:04 PM, JFC Morfin wrote: > At 02:44 26/09/2011, Simon Slavin wrote: > > On 26 Sep 2011, at 1:35am, JFC Morfin wrote: >> >> > I have copied the C programe in >> > http://sqlite.org/quickstart.**htmland >> > tried

Re: [sqlite] sqlite3_analyzer

2011-09-19 Thread James Hartley
On Mon, Sep 19, 2011 at 5:25 AM, Simon Slavin wrote: > > On 18 Sep 2011, at 9:34pm, Anonymous wrote: > > > Hi can someone please explain how to build this from source? I wasn't > able > > to find it in the current amalgamation. Thanks. > > The amalgamation is just source