Re: [sqlite] Make a database read-only?

2014-10-14 Thread John Hascall
Some code you may find useful to enforce the readonly byte (do this before your program opens the DB). John #include #include #define int setRObyte ( const char * sqDBfn ) { int fd = open(sqDBfn, O_WRONLY, 0); int rc = -1; if (fd == -1) return

Re: [sqlite] Make a database read-only?

2014-10-14 Thread John Hascall
Well some keystroke I hit apparently made the stupid browser send that before I finished editing it, but you get the idea Sigh, John On Tue, Oct 14, 2014 at 9:12 AM, John Hascall <j...@iastate.edu> wrote: > Some code you may find useful to enforce the readonly byte (do this befo

Re: [sqlite] Why is a b-tree sort required for this query?

2014-11-17 Thread John Hascall
​If you do ORDER BY t1c.t1_id, t1c.id; then you won't have the b-tree step, but ​including the name fields means it has the extra work to do to satisfy your order by. Or am I missing something? John On Sun, Nov 16, 2014 at 1:18 PM, Oliver Smith wrote: > In the following

Re: [sqlite] Insert Hindi Language

2014-11-18 Thread John Hascall
See also http://www.sqlite.org/pragma.html#pragma_encoding John On Tue, Nov 18, 2014 at 4:42 AM, ARVIND KUMAR wrote: > Hi, > > I am using SQLite version 3.8.7.1 > > I am not able to insert Hindi Language into table. So please help me > regarding this. > > May you send me

Re: [sqlite] An order by problem, maybe a bug?

2014-09-20 Thread John Hascall
The problem with your suggestion of 'two uses => two fields' is that no sooner do you do that then somebody comes up with additional uses, for example, formal greeting, informal greeting, the appropriate form for government form X123, and so on.... John Hascall IT Services Iowa State U

Re: [sqlite] Results of Joins in sqlite

2014-09-24 Thread John Hascall
This is a really terrible idea. It is dependent on the internals of sqlite which makes it extremely fragile. Have you profiled your code to show that this is your bottleneck? If so, it's still a terrible idea, but at least has some basis for considering the idea. John On Wed, Sep 24, 2014 at

Re: [sqlite] Division accuracy

2014-09-24 Thread John Hascall
Is the approach of 'just try it and if it goes badly fix it' doable? mid = (lo + hi) / 2; if ((mid <= lo) || (mid >= hi)) { Fix it } John Hascall IT Services Iowa State Univ. > On Sep 24, 2014, at 11:49 AM, RSmith <rsm...@rsweb.co.za> wrote: > > I'm trying t

Re: [sqlite] DEFAULT expression ignored for INTEGER PRIMARY KEYs?

2014-09-25 Thread John Hascall
Would dropping the non-functioning default clause from the schema be a "breaking change"? That is from: # sqlite3 dummy.db sqlite> CREATE TABLE x( ...> id INTEGER PRIMARY KEY DEFAULT (random()), ...> val VARCHAR ...> ); sqlite> .schema CREATE TABLE x( *id

Re: [sqlite] CLI dump command ignores view dependencies

2014-10-01 Thread John Hascall
I think his point was: illegal to create a view referring to a non-existing table AND illegal to later create a situation where you have a view referring to a non-existing table is logical legal to create a view referring to a non-existing table AND legal to later create a situation where you

Re: [sqlite] calculating in the command line interface

2014-10-01 Thread John Hascall
​You got bit by integer division... asw-1# {773} *sqlite3* SQLite version 3.7.5 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> *select round(133.0/122000.0,10) as t;* 0.0010901639 sqlite> BTW, there are other tools for simple math...​ asw-1# {772} *bc -l*