Re: [sqlite] EXT :Re: Getting occasional crashes with sqlite3_prepare_v2 and sqlite3_step in iOS app

2012-07-19 Thread Black, Michael (IS)
99% (or more) of the time this is going to be your code. I would move forward based on that assumption. Found this that might help you: http://stackoverflow.com/questions/1730180/is-this-kind-of-crash-report-useless Michael D. Black Senior Scientist Advanced Analytics Directorate Advanced

Re: [sqlite] EXT :Re: Getting occasional crashes with sqlite3_prepare_v2 and sqlite3_step in iOS app

2012-07-19 Thread Black, Michael (IS)
From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of Black, Michael (IS) [michael.bla...@ngc.com] Sent: Thursday, July 19, 2012 12:15 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] EXT :Re: Getting occasional crashes

Re: [sqlite] EXT :Re: Getting occasional crashes with sqlite3_prepare_v2 and sqlite3_step in iOS app

2012-07-19 Thread Black, Michael (IS)
and sqlite3_step in iOS app Thanks but doesn't that code check to see if the database pointer has changed and not whether the memory it references has been corrupted? I guess that's a start though. Rick On Jul 19, 2012, at 11:02 AM, Black, Michael (IS) wrote: > Buffer overflow issues

Re: [sqlite] Getting occasional crashes with sqlite3_prepare_v2 and sqlite3_step in iOS app

2012-07-19 Thread Black, Michael (IS)
Buffer overflow issues can cause problems at seemingly random points in a program. I've worked on some really nasty ones before when no debugging was available. If dbRef is being corrupted then put a dbRef check in your program in every function at beginning and end. int

Re: [sqlite] force read schema after "delete from sqlite_master"

2012-07-19 Thread Black, Michael (IS)
Why don't you just attach another database and switch your user connections to that one? Then you can just delete the old file and not worry about vaccum at all. Sounds though like sqlite3 could use a "truncate" command like Oracle has which is the speedy way to zero out a table there.

Re: [sqlite] Updating on 32bit os slower than 64bit?

2012-07-17 Thread Black, Michael (IS)
Something that might be useful is to strace that program Use the "-c" switch to summarize the system calls first. Then use the "-tt" to show relative timestamps to identify specific bottlenecks. Also, set up a ram disk on the system and see if that's slow too. That will test the LVM

Re: [sqlite] Updating on 32bit os slower than 64bit?

2012-07-16 Thread Black, Michael (IS)
Wow...14 secs for 10 updates? That's the slowest I've ever heard by far. Is your 32-bit system using an NFS mounted /home or such? Can you run your test on /tmp instead? Michael D. Black Senior Scientist Advanced Analytics Directorate Advanced GEOINT Solutions Operating Unit Northrop

Re: [sqlite] set of db connections

2012-07-16 Thread Black, Michael (IS)
Ummmare we forgetting about WAL mode? http://www.sqlite.org/draft/wal.html "Reading and writing can proceed concurrently." Not that you can have multiples of each...just one of each. Michael D. Black Senior Scientist Advanced Analytics Directorate Advanced GEOINT Solutions

Re: [sqlite] sqlite 3.7.13 download link

2012-07-08 Thread Black, Michael (IS)
There is a bogus page at http://www.sqlite.org/download.html/ That points to the wrong link. The added / causes the problem Michael D. Black Senior Scientist Advanced Analytics Directorate Advanced GEOINT Solutions Operating Unit Northrop Grumman Information Systems

Re: [sqlite] Update trigger fires for all rows even if sqlite3_changes returns 0

2012-07-03 Thread Black, Michael (IS)
And Oracle says the opposite: Yet they all give the same answer when done with "update testtable set testrow=null where testrow not null; Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production With the Partitioning, Oracle Label Security, OLAP, Data Mining,

Re: [sqlite] Update trigger fires for all rows even if sqlite3_changes returns 0

2012-07-03 Thread Black, Michael (IS)
What's better is that it tells you what you asked for...not what you think you asked for...which it does. You've already been shown the correct solution...a WHERE clause... You want sqlite to do a complete record compare, including following update triggers, on EVERY record it looks at to see

Re: [sqlite] An interesting (strange) issue with selects

2012-06-29 Thread Black, Michael (IS)
read about on a Windows machines sporting the NTFS filesystem that when a file is deleted and recreated within a certain period of time, the original file is retrieved rather than a new one. On Fri, Jun 29, 2012 at 10:54 AM, Dennis Volodomanov <i...@psunrise.com>wrote: > On 30/06/2

Re: [sqlite] An interesting (strange) issue with selects

2012-06-29 Thread Black, Michael (IS)
You need to check your file system. When you run the shell doing this on a new, empty directory (this is using the shell from the website) sqlite3 mydb.ext In another window you should NOT see anything. then after doing .dump you should see a 0-length mydb.ext file appear. .quit --

Re: [sqlite] An interesting (strange) issue with selects

2012-06-29 Thread Black, Michael (IS)
ppen using the shell. Dennis On 29/06/2012 10:35 PM, Black, Michael (IS) wrote: > > Care to show all of your steps? Not that my BS flag is waving but > you're correct that this is very odd. > > What OS? > > What version sqlite? > > Shell from website or did you comp

Re: [sqlite] group by z HAVING count(z>12.5)=2

2012-06-29 Thread Black, Michael (IS)
You need to ask your question betteryour example will give an answer but I have no idea what answer you are looking for. Can you give a complete example? CREATE TABLE TableA(z); INSERT INTO "TableA" VALUES(2.0); INSERT INTO "TableA" VALUES(4.0); INSERT INTO "TableA" VALUES(8.0); INSERT

Re: [sqlite] An interesting (strange) issue with selects

2012-06-29 Thread Black, Michael (IS)
Care to show all of your steps? Not that my BS flag is waving but you're correct that this is very odd. What OS? What version sqlite? Shell from website or did you compile? Local file? Does it persist across a reboot? Are you running ANY 3rd party software? Try uninstalling your

Re: [sqlite] how to build sqlite4 (four)?

2012-06-28 Thread Black, Michael (IS)
That's the way Oracle does it too. http://docs.oracle.com/cd/B13789_01/server.101/b10759/statements_6014.htm Michael D. Black Senior Scientist Advanced Analytics Directorate Advanced GEOINT Solutions Operating Unit Northrop Grumman Information Systems

Re: [sqlite] Load SQLite from InputStream in Java as ReadOnly

2012-06-28 Thread Black, Michael (IS)
Does this article help? http://stackoverflow.com/questions/4574303/java-sqlite-how-to-open-database-as-read-only Michael D. Black Senior Scientist Advanced Analytics Directorate Advanced GEOINT Solutions Operating Unit Northrop Grumman Information Systems

Re: [sqlite] How do I rename a column called IN?

2012-06-28 Thread Black, Michael (IS)
Quote it: sqlite> create table x(in); Error: near "in": syntax error sqlite> create table x("in"); sqlite> insert into x values(1); sqlite> select * from x; 1 sqlite> select in from x; Error: near "in": syntax error sqlite> select "in" from x; 1 sqlite> update x set in=3; Error: near "in":

Re: [sqlite] sqlite time is 2 hours to late

2012-06-27 Thread Black, Michael (IS)
: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of Black, Michael (IS) [michael.bla...@ngc.com] Sent: Wednesday, June 27, 2012 11:18 AM To: General Discussion of SQLite Database Subject: EXT :Re: [sqlite] sqlite time is 2 hours to late Kinda' depend on what exactly you

Re: [sqlite] sqlite time is 2 hours to late

2012-06-27 Thread Black, Michael (IS)
Kinda' depend on what exactly you want to do. If you want your application to always use local time no matter where it's run: select('now','localtime'); If you want to know how far off of UTC you are do this: select round((julianday('now','localtime')-julianday('now'))*24); In my case this

Re: [sqlite] access from 2 different programms to same sqlite3-db

2012-06-26 Thread Black, Michael (IS)
:54 AM To: General Discussion of SQLite Database Subject: EXT :Re: [sqlite] access from 2 different programms to same sqlite3-db On Tue, Jun 26, 2012 at 10:51 AM, Black, Michael (IS) < michael.bla...@ngc.com> wrote: > Does that mean the "prepare" is wrapped inside a transaction?

Re: [sqlite] access from 2 different programms to same sqlite3-db

2012-06-26 Thread Black, Michael (IS)
Does that mean the "prepare" is wrapped inside a transaction? So you must finalize and re-prepare? Michael D. Black Senior Scientist Advanced Analytics Directorate Advanced GEOINT Solutions Operating Unit Northrop Grumman Information Systems From:

Re: [sqlite] Detecting when a table is created

2012-06-26 Thread Black, Michael (IS)
If you have sqlite3.c in your project you can just add your own hook. Take a look at sqlite3TwoPartName if you want to see if before it's created. Or look at sqlite3StartTable (end of the function) if you want to know after it's created. That will catch a VIEW creation too. Michael

Re: [sqlite] C++ programming - Extracting data

2012-06-25 Thread Black, Michael (IS)
t); if(rc != (SQLITE_DONE) && rc != (SQLITE_ROW)){ ... } while (sqlite3_step(stmt) == SQLITE_ROW) { sName = (char*)sqlite3_column_text(stmt, 0); obj.Display(sName); //<== this is not display ... } sqlite3_finalize(stmt); } theDestructor() { sqlit

Re: [sqlite] C++ programming - Extracting data

2012-06-25 Thread Black, Michael (IS)
You're not doing the right sequencing...so your cout is only executing when there is NOT a row. Change rc = sqlite3_step(stmt); if(rc != SQLITE_DONE) { ... } while ( sqlite3_step(stmt) != SQLITE_ROW) { sName = (char*)sqlite3_column_text(stmt, 0); //<== Seg fault

Re: [sqlite] EXT :Re: Can't create empty database

2012-06-25 Thread Black, Michael (IS)
On 25 Jun 2012, at 12:48, Black, Michael (IS) wrote: > Well...it doesnt' any more on Windows and Linux at least as of 3.7.9 > > The file doesn't get created until you execute at least one command relevant > to it. > > So do a .schema or .dump or such and it creates the empty

Re: [sqlite] Can't create empty database

2012-06-25 Thread Black, Michael (IS)
Well...it doesnt' any more on Windows and Linux at least as of 3.7.9 The file doesn't get created until you execute at least one command relevant to it. So do a .schema or .dump or such and it creates the empty file. Or just enter a ";" and it will create it too (ergo the "" works from

Re: [sqlite] An interesting (strange) issue with selects

2012-06-21 Thread Black, Michael (IS)
of SQLite Database Subject: EXT :Re: [sqlite] An interesting (strange) issue with selects On 22/06/2012 12:02 AM, Black, Michael (IS) wrote: > > Are you multi-threaded? > > It sounds like the database is being changed during your run...how is > that being done? Inside your program? >

Re: [sqlite] An interesting (strange) issue with selects

2012-06-21 Thread Black, Michael (IS)
(strange) issue with selects Michael, Thanks for the reply. I know, it's usually the user :) On 21/06/2012 11:31 PM, Black, Michael (IS) wrote: > > You don't show where you inserted your data. > > Are you postiive ColC is an integer and you didn't insert it as a string? > > You

Re: [sqlite] EXT : An interesting (strange) issue with selects

2012-06-21 Thread Black, Michael (IS)
You don't show where you inserted your data. Are you postiive ColC is an integer and you didn't insert it as a string? You don't show a dump of your table which would be handy. What does "bomb" mean? Your program gets a seg fault or such? What are you programming in, on what OS? I

Re: [sqlite] sqlite compound keys

2012-06-21 Thread Black, Michael (IS)
Only when you query X thoughquerying Y by itself gives a table scan. SQLite version 3.7.11 2012-03-20 11:35:50 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> create table tmp(x,y); sqlite> create unique index idx on tmp(x,y); sqlite> explain query plan

Re: [sqlite] How to select from table

2012-06-20 Thread Black, Michael (IS)
setup() must be some other function in the book. Get rid of it. Probably runs some pragmas. You can force the name error to go away by casting to char *. Or you can strdup the sqlite3_column_text value and free it when you're done. The error is warning you that you need to be aware

Re: [sqlite] Problem with select

2012-06-20 Thread Black, Michael (IS)
You missed the prepare for your select_sql: sqlite3_stmt *select_stmt = NULL; sqlite3_prepare_v2(db,select_sql,strlen(select_sql),_stmt,NULL); Add that one line and you get: Successfully bound string for insert: 'zweiter Anlauf/Versuch' Successfully bound real for insert: 22

Re: [sqlite] SQL Lite 2.8.6 Not deleting Enteries

2012-06-19 Thread Black, Michael (IS)
Or..the string being displayed in your app isn't being reset to empty when there are no records. Since you didn't mention what happens when you delete just some of the records instead of all. Michael D. Black Senior Scientist Advanced Analytics Directorate Advanced GEOINT Solutions

Re: [sqlite] SQL Lite 2.8.6 Not deleting Enteries

2012-06-19 Thread Black, Michael (IS)
I thinki you need a sanity check. Either your own or somebody looking over your shoulder. If you reboot the OS and it sill has records when you think (and see) 0 records then, in all high-probability likelihood, you are doing something wrong. The idea that you can add records and they show

Re: [sqlite] SQL Lite 2.8.6 Not deleting Enteries

2012-06-19 Thread Black, Michael (IS)
Your database isn't on a network share, is it? Sounds like data caching is ocurring. Does your app close and re-open the database? What kind of "app" are you running? Michael D. Black Senior Scientist Advanced Analytics Directorate Advanced GEOINT Solutions Operating Unit Northrop

Re: [sqlite] VERY weird rounding error

2012-06-17 Thread Black, Michael (IS)
boun...@sqlite.org] on behalf of Black, Michael (IS) [michael.bla...@ngc.com] Sent: Sunday, June 17, 2012 7:38 AM To: General Discussion of SQLite Database Subject: EXT :Re: [sqlite] VERY weird rounding error Do you have a reference for this? I found 3: Wikipedia says 16 http://en.wikipedia.org/w

Re: [sqlite] VERY weird rounding error

2012-06-17 Thread Black, Michael (IS)
Do you have a reference for this? I found 3: Wikipedia says 16 http://en.wikipedia.org/wiki/IEEE_754-2008 BYU says 15 http://www.math.byu.edu/~schow/work/IEEEFloatingPoint.htm Oracle says 15-17 http://docs.oracle.com/cd/E19957-01/806-3568/ncg_math.html But I've never heard of "expected

Re: [sqlite] error group_concat

2012-06-16 Thread Black, Michael (IS)
Works in 3.7.9 SQLite version 3.7.9 2011-11-01 00:52:41 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> CREATE TABLE t1 (A1 INTEGER NOT NULL,A2 INTEGER NOT NULL,A3 INTEGER NOT NULL,A4 INTEGER NOT NULL,PRIMARY KEY(A1)); sqlite> REPLACE INTO t1

Re: [sqlite] Triggers in Sqlite using C

2012-06-15 Thread Black, Michael (IS)
using C Black, Michael (IS) <michael.bla...@ngc.com> wrote: > Could the SQLite code add a new dummy function for a callback which we can > then override with our own library? sqlite3_update_hook -- Igor Tandetnik ___ sqlite-users mailing

Re: [sqlite] Triggers in Sqlite using C

2012-06-15 Thread Black, Michael (IS)
se Subject: EXT :Re: [sqlite] Triggers in Sqlite using C On Fri, Jun 15, 2012 at 12:12:22PM +0000, Black, Michael (IS) scratched on the wall: > Could the SQLite code add a new dummy function for a callback which > we can then override with our own library? Just use an SQL function: h

Re: [sqlite] Triggers in Sqlite using C

2012-06-15 Thread Black, Michael (IS)
Could the SQLite code add a new dummy function for a callback which we can then override with our own library? That would provide an easy-to-use interface which would then still work in the shell (unless you're doing some other database functions inside the callback -- coider beware). e.g.

Re: [sqlite] Full text search without full phrase matches

2012-06-14 Thread Black, Michael (IS)
Sounds to me like you want Lucene instead of SQLite http://lucene.apache.org/core/ Michael D. Black Senior Scientist Advanced Analytics Directorate Advanced GEOINT Solutions Operating Unit Northrop Grumman Information Systems From:

Re: [sqlite] Quoting "id" versus 'id' in query

2012-06-12 Thread Black, Michael (IS)
That's the nice thing about standards...there are so many to choose from...:-( Michael D. Black Senior Scientist Advanced Analytics Directorate Advanced GEOINT Solutions Operating Unit Northrop Grumman Information Systems ___ sqlite-users mailing

Re: [sqlite] Features of SQLite question

2012-06-12 Thread Black, Michael (IS)
Sent: Monday, June 11, 2012 5:31 PM To: General Discussion of SQLite Database Subject: EXT :Re: [sqlite] Features of SQLite question On 11 Jun 2012, at 11:11pm, "Black, Michael (IS)" <michael.bla...@ngc.com> wrote: > Isn't it true that semi-accurate (sub-second) time-tagge

Re: [sqlite] Features of SQLite question

2012-06-11 Thread Black, Michael (IS)
Answer: The most recent one. Isn't it true that semi-accurate (sub-second) time-tagged transactions will generally keep 2 databases in sync? I've done that before with considerable success. You don't sync the fields...you sync the transactions. The presumption is that later transactions

Re: [sqlite] 100% CPU utilization sqlite running in VMWare

2012-06-07 Thread Black, Michael (IS)
There's some good info here. http://www.brianmadden.com/forums/t/30061.aspx Namely, use 1 CPU per VM and do more VMs. Addresses your 100% usage directly. And what does process explorer tell you about context switches? Michael D. Black Senior Scientist Advanced Analytics Directorate Advanced

Re: [sqlite] SQLite3.dll for OS x64

2012-06-07 Thread Black, Michael (IS)
"didn't work" doesn't tell us much. What OS are you using? What compiler are you using? What error are you seeing and what do you expect to see? What code are you testing? Michael D. Black Senior Scientist Advanced Analytics Directorate Advanced GEOINT Solutions Operating Unit

Re: [sqlite] Database Corruption - Table data being overwritten

2012-06-06 Thread Black, Michael (IS)
That sounds like it might a corrupt index since the data doesn't show up in a dump. Does your select work if you drop the index? And have you done a "pragma integrity_check" ? Michael D. Black Senior Scientist Advanced Analytics Directorate Advanced GEOINT Solutions Operating Unit

Re: [sqlite] Disk file size

2012-06-06 Thread Black, Michael (IS)
Cleared space is not automatically reclaimed. You can run "vacuum" which wiill reclaim the space. Michael D. Black Senior Scientist Advanced Analytics Directorate Advanced GEOINT Solutions Operating Unit Northrop Grumman Information Systems From:

Re: [sqlite] 100% CPU utilization sqlite running in VMWare

2012-06-05 Thread Black, Michael (IS)
Have you run your bare metal test using the same share? And have you tried "pragma synchronous=OFF" ?? And I assume you are using transactions? Have you profiled your app to see where it's spinning? Probably trying to get the lock on the share. What flags did you use to comiple the sqlite

Re: [sqlite] Query runs in SQLite Database Browser but not in iPad app

2012-06-03 Thread Black, Michael (IS)
r database with that nameā€¦ if it were a different d/b, it would error out on column names being nonexistent, right? Regards, Rolf (SpokaneDude) On Jun 3, 2012, at 5:34 AM, Black, Michael (IS) wrote: > My first suspiciion would be that you're pointing to 2 different databases. > Are

Re: [sqlite] Query runs in SQLite Database Browser but not in iPad app

2012-06-03 Thread Black, Michael (IS)
My first suspiciion would be that you're pointing to 2 different databases. Are you SURE the DB is the same between the 2 apps? Michael D. Black Senior Scientist Advanced Analytics Directorate Advanced GEOINT Solutions Operating Unit Northrop Grumman Information Systems

Re: [sqlite] Views Optimization

2012-06-01 Thread Black, Michael (IS)
Perhaps the query flattener should ignore any nondeterministic functions? Are there any others besides random() or date/time functions? Michael D. Black Senior Scientist Advanced Analytics Directorate Advanced GEOINT Solutions Operating Unit Northrop Grumman Information Systems

Re: [sqlite] Why can't sqlite disregard unused outer joins?

2012-05-30 Thread Black, Michael (IS)
Since you have a one-to-one relationship I'm not sure why you don't just put the inseam with the Employee, but perhaps you're just giving an example here. I would do it this way which is going to run a heck of lot faster than using string compares as you are doing. pragma foreign_keys = on;

Re: [sqlite] how to merge data from fields... if this is possible.

2012-05-29 Thread Black, Michael (IS)
Does this do what you want? create table t1(rowid,fieldA,fieldB); insert into t1 values(1,'val1','This is a'); insert into t1 values(2,'val1','small'); insert into t1 values(3,'val1','test.'); insert into t1 values(4,'val2','The proof is in'); insert into t1 values(5,'val2','the pudding.');

Re: [sqlite] How to write and read the same sqlite3 DB in memory concurrently in two thread?

2012-05-29 Thread Black, Michael (IS)
eloper responsibility. Pavel On Tue, May 29, 2012 at 9:57 AM, Black, Michael (IS) <michael.bla...@ngc.com> wrote: > This seems to fly in thte face of what I remember reading on here before. > Can we get a clear explanation of what to do with the different THREADSAFE > settings?

Re: [sqlite] How to write and read the same sqlite3 DB in memory concurrently in two thread?

2012-05-29 Thread Black, Michael (IS)
This seems to fly in thte face of what I remember reading on here before. Can we get a clear explanation of what to do with the different THREADSAFE settings? I think it's implied... i.e. (assumign this is correct) Single-thread -- no threading allowed at all Multi-thread -- one sqlite3

Re: [sqlite] What does "The use of the amalgamation is recommended for all applications." mean, precisely?

2012-05-26 Thread Black, Michael (IS)
I'll point out that all of your problem is addressed by open source whereas an external library only addresses part. You could do whatever you want with open source. I refuse to put things into mission critical without source unless support is also purchased with it. Michael D. Black

Re: [sqlite] What does "The use of the amalgamation is recommended for all applications." mean, precisely?

2012-05-25 Thread Black, Michael (IS)
On the 3rd hand (Medusa here) those of us involved in mission critical apps refuse to let people arbitrarily update packages that are part of the "system". Things like the bug introduced in 3.7.12 being a prime example. It's called "Configuration Control". Some apps may depend on updated

Re: [sqlite] SQLite SELECT performance problem

2012-05-25 Thread Black, Michael (IS)
Usng your sqlite3.exe CPU Time: user 2.156250 sys 2.078125 Using your sqlite3.console.exe CPU Time: user 1.375000 sys 0.140625 I'm afraid I don't see the problem since the pre-built is slower than your executable for me. Michael D. Black Senior Scientist Advanced Analytics Directorate

Re: [sqlite] sqlite Commit C API

2012-05-21 Thread Black, Michael (IS)
Tandetnik [itandet...@mvps.org] Sent: Sunday, May 20, 2012 8:47 AM To: sqlite-users@sqlite.org Subject: EXT :Re: [sqlite] sqlite Commit C API Black, Michael (IS) <michael.bla...@ngc.com> wrote: > Hmmm...our math is a bit different... > > A 1,000 RPM disk would take 1ms to s

Re: [sqlite] sqlite Commit C API

2012-05-20 Thread Black, Michael (IS)
of Jay A. Kreibich [j...@kreibi.ch] Sent: Sunday, May 20, 2012 7:53 AM To: General Discussion of SQLite Database Subject: EXT :Re: [sqlite] sqlite Commit C API On Sun, May 20, 2012 at 12:04:33PM +, Black, Michael (IS) scratched on the wall: > Another more indirect way to test is this util

Re: [sqlite] sqlite Commit C API

2012-05-20 Thread Black, Michael (IS)
If you can run perl on your ARM host try this utility to see if fsync() actually works -- this is a real end-to-end test that you pull the plug on and it will let you know if your disk file is where it's supposed to be and how many errors you had. http://brad.livejournal.com/2116715.html

Re: [sqlite] Compiler warnings with 3.7.12

2012-05-15 Thread Black, Michael (IS)
Same thing on mingw 4.5.1 It's not harmful but this cleans it up and should be harmless also. #undef popen #define popen(a,b) _popen((a),(b)) #undef pclose #define pclose(x) _pclose(x) Michael D. Black Senior Scientist Advanced Analytics Directorate Advanced GEOINT Solutions Operating

Re: [sqlite] how to write line feed "\n\r" when output a txt file

2012-05-14 Thread Black, Michael (IS)
Under windows: SQLite version 3.7.9 2011-11-01 00:52:41 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> create table t(a,b); sqlite> insert into t values(1,2); sqlite> insert into t values(3,4); sqlite> .output akk.txt sqlite> select * from t; sqlite> .output

Re: [sqlite] Trouble importing hex encoded blob

2012-05-14 Thread Black, Michael (IS)
boun...@sqlite.org] on behalf of Black, Michael (IS) [michael.bla...@ngc.com] Sent: Monday, May 14, 2012 12:28 PM To: General Discussion of SQLite Database Subject: EXT :Re: [sqlite] Trouble importing hex encoded blob Looks like it goes inside this loop in 3.7.12 at line 1883 of shell.c. Could

Re: [sqlite] Trouble importing hex encoded blob

2012-05-14 Thread Black, Michael (IS)
Looks like it goes inside this loop in 3.7.12 at line 1883 of shell.c. Could we get maybe a pragma ".mode csvblob" or such and have this made a permanet part of the shell? for(i=0; i

Re: [sqlite] Trouble importing hex encoded blob

2012-05-14 Thread Black, Michael (IS)
I updated my csvimport utility to allow hex fields. So hex fields like X'01020304' will get imported as blobs if the option is enabled. Sooo test.csv: X'0001063500',X'00' X'0001063501',X'01' csvimport test.csv test.db t csvimport -x test.csv test.db

Re: [sqlite] a couple of questions

2012-05-14 Thread Black, Michael (IS)
If you do a periodic commit and use SQLITE_TRANSIENT wouldn't that work? One the data is commited surely it doesn't need to be retained, does it? Michael D. Black Senior Scientist Advanced Analytics Directorate Advanced GEOINT Solutions Operating Unit Northrop Grumman Information Systems

Re: [sqlite] intial database creation

2012-05-11 Thread Black, Michael (IS)
I was thinking a bit on your question...let's make some terminology clear. Database file -- a user file on your hard disk that may contain tables Table -- a user table entry which may contain records Records -- a specific user data record in a table containing fields of user data #1 Create "a

Re: [sqlite] intial database creation

2012-05-10 Thread Black, Michael (IS)
My preference is to create a file with an editor to spell out the tables and some example inserts and selects to test. Then you can easily just make some changes and re-read the file to test it again. Then you can run the sqlite shell and do this (example file is myfile.sql that you create)

Re: [sqlite] max(userID) .. WHERE userID IS NOT NULL returns NULL But... WHERE <> '' returns value

2012-05-09 Thread Black, Michael (IS)
That doesn't appear to work for 2.8.17. But using round() does work. NULL stays NULL and space (or any non-numeric string) becomes zero. Tried typeof() but it always returns numeric. SQLite version 2.8.17 Enter ".help" for instructions sqlite> CREATE TABLE

Re: [sqlite] max(userID) .. WHERE userID IS NOT NULL returns NULL But... WHERE <> '' returns value

2012-05-09 Thread Black, Michael (IS)
Hmmm...works for meare you SURE you're using the correct database after you made the changes? I used the 2.8.17 shell that I got from http://www.gamefront.com/files/service/thankyou?id=4833830 and it works just fine. CREATE TABLE "maillist"(recordID,userID,name,email); INSERT INTO

Re: [sqlite] Having in prepared statement with parameters

2012-05-09 Thread Black, Michael (IS)
Doing exact matches on floating point values will get you in trouble quite frequently. Most float numbers cannot be exactly represented internally so can cause such behavior. Hopefully your application doesn't depend on thisif so you need to redesign what you're doing. But to fix your

Re: [sqlite] is SQLite the right tool to analyze a 44GB file

2012-05-07 Thread Black, Michael (IS)
Next iteration of my csvimport utility. I think it handles Simon's test cases adequately (or it gives an error). Now allows for multiline fields Correctly(?) handles fields with escaped quotes. Checks the entire file to ensure all records have the correct field count before processing.

Re: [sqlite] is SQLite the right tool to analyze a 44GB file

2012-05-06 Thread Black, Michael (IS)
m: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of Simon Slavin [slav...@bigfraud.org] Sent: Sunday, May 06, 2012 8:35 AM To: General Discussion of SQLite Database Subject: EXT :Re: [sqlite] is SQLite the right tool to analyze a 44GB file On 6 May 2012, at 1:5

Re: [sqlite] is SQLite the right tool to analyze a 44GB file

2012-05-06 Thread Black, Michael (IS)
I modified my csvimport to allow for quoted fields. Still automaticallhy detects the # of columns. If quoted fields also contain internal quotes they must be escaped by doubling them. e.g. col1,"this is, a ""quoted"" field",col3 It's not fully RFC4180 compliant as it doesn't allow for CF/LF

Re: [sqlite] is SQLite the right tool to analyze a 44GB file

2012-05-04 Thread Black, Michael (IS)
Here's a utility to import a comma separated file (does not work for quoted strings or strings with commas). Figures out the # of columns automagically from the csv file. All wrapped in a singled transaction. Shows progress every 100,000 inserts. Usage: csvimport filename databasename

Re: [sqlite] is SQLite the right tool to analyze a 44GB file

2012-05-02 Thread Black, Michael (IS)
would recommend for SQLite? peter -Original Message- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Black, Michael (IS) Sent: Tuesday, May 01, 2012 4:22 PM To: General Discussion of SQLite Database Subject: Re: [sqlite] is SQLite the right tool

Re: [sqlite] is SQLite the right tool to analyze a 44GB file

2012-05-01 Thread Black, Michael (IS)
You need to try and do an import from the shell. GUIs seem to have way too many limits. http://sqlite.org/download.html Don't do any indexes up frontdo them afterwords if they'll help your queries. Indexes will slow down your import notably. I don't think you're anywhere near the

Re: [sqlite] Using a select with 'where'

2012-05-01 Thread Black, Michael (IS)
You most certainly can do what you want...but your example makes no sense to me. Sound to me like "personnick" is text and absid is numeric -- they'll never match. You can do something like: delete from addressbook where absid in (select otherid from grouplinks where groupnick='27');

Re: [sqlite] SQLite 3.7.11 behavioral change from 3.7.10 with concurrency -- bug?? -- test case!

2012-05-01 Thread Black, Michael (IS)
I agree (surprise!)people switch to WAL mode for concurrent read/write. I would've assumed a write rollback was non-intrusive into exisiting reads in all circumstances unless told otherwise. So some sort of cross-reference to shared cache causing potential problems under rollbacks would

Re: [sqlite] sqlite] Fwd: Expression syntax

2012-04-30 Thread Black, Michael (IS)
It evaluates to the content of the table. sqlite> create table t(a); sqlite> insert into t values(1); sqlite> insert into t values(2); sqlite> create table t2(a); sqlite> insert into t2 values(1); sqlite> insert into t2 values(2); sqlite> insert into t2 values(3); sqlite> insert into t2

Re: [sqlite] SQLite 3.7.11 behavioral change from 3.7.10 with concurrency -- bug?? -- test case!

2012-04-28 Thread Black, Michael (IS)
Should another "disadvantage" of WAL mode be added to http://www.sqlite.org/draft/wal.html Something that says rolled back transactions will cause an abort on any reads in progress if shared cache is enabled. Michael D. Black Senior Scientist Advanced Analytics Directorate Advanced

Re: [sqlite] Problem with insert

2012-04-27 Thread Black, Michael (IS)
I needed some practice this morning to get my juju going...code could be modularized a bit...I'll leave that exercise for the student...in particular, the rc checking could be a function: checkerr(rc,SQLITE_OK,"Insert error: "); Or fancier yet with varargs According to your data you

Re: [sqlite] EXT :Re: Re Query planner creating a slow plan

2012-04-26 Thread Black, Michael (IS)
e.org] on behalf of Peter [pe...@somborneshetlands.co.uk] Sent: Thursday, April 26, 2012 3:57 PM To: General Discussion of SQLite Database Subject: EXT :Re: [sqlite] Re Query planner creating a slow plan Black, Michael (IS) wrote, On 26/04/12 21:39: > My fault...I thought I had extracted it und

[sqlite] Re Query planner creating a slow plan

2012-04-26 Thread Black, Michael (IS)
te] Re Query planner creating a slow plan Black, Michael (IS) wrote, On 26/04/12 19:00: > Sqliteman must be pointing to the wrong database. > > > > sqlite> SELECT transfer_date FROM transfer_history WHERE regn_no = > '039540'. Error: no such table: transfer_history > Hmm

Re: [sqlite] SQLite 3.7.11 behavioral change from 3.7.10 with concurrency -- bug??

2012-04-26 Thread Black, Michael (IS)
Would WAL mode prevent this? Michael D. Black Senior Scientist Advanced Analytics Directorate Advanced GEOINT Solutions Operating Unit Northrop Grumman Information Systems From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf

Re: [sqlite] Re Query planner creating a slow plan

2012-04-26 Thread Black, Michael (IS)
Re Query planner creating a slow plan Black, Michael (IS) wrote, On 26/04/12 18:21: > There is no transfer_table_new in that database. Or any view named > "transfer" anything. > > So what query are you running on this one? > > Sorry, that should be transfer_history. The n

Re: [sqlite] Re Query planner creating a slow plan

2012-04-26 Thread Black, Michael (IS)
on Systems From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of Peter [pe...@somborneshetlands.co.uk] Sent: Thursday, April 26, 2012 11:54 AM To: General Discussion of SQLite Database Subject: EXT :Re: [sqlite] Re Query planner creating a slow plan Blac

Re: [sqlite] Re Query planner creating a slow plan

2012-04-26 Thread Black, Michael (IS)
ing a slow plan Black, Michael (IS) wrote, On 26/04/12 16:38: > And does this also work? Sounds like the planner isn't seeing all the > columns in the view unless in the select. > > > > SELECT transfer_date,regn_no FROM transfer_history_new > WHERE regn_no = '039540' and tra

Re: [sqlite] Re Query planner creating a slow plan

2012-04-26 Thread Black, Michael (IS)
And does this also work? Sounds like the planner isn't seeing all the columns in the view unless in the select. SELECT transfer_date,regn_no FROM transfer_history_new WHERE regn_no = '039540' and transfer_date <= '2012-05-01' order by transfer_date asc Michael D. Black Senior Scientist

[sqlite] Re Query planner creating a slow plan

2012-04-26 Thread Black, Michael (IS)
What happens if you use a subselect? selsect transfer_date from (select transfer_date from transfer_history where regn_no='039540' and transfer_date <= '2012-05-01') order by transfer_date; Michael D. Black Senior Scientist Advanced Analytics Directorate Advanced GEOINT Solutions

Re: [sqlite] location of database wrt

2012-04-23 Thread Black, Michael (IS)
If you do a file search you will probably find an empty database of the same name as what you expect. You're probably using the "default working directory" and the file isn't where you expect it. Michael D. Black Senior Scientist Advanced Analytics Directorate Advanced GEOINT Solutions

Re: [sqlite] SQLITE3 64-bit version

2012-04-23 Thread Black, Michael (IS)
Is there a reason you can't just compile it into your program instead of using it as a DLL? Are you distributing multiple executables that would actually take advantage of that? It's under 1Meg as it's not much by today's standards. Seems to me we've heard more than one person with DLL

Re: [sqlite] "DEFAULT BOOLEAN NOT NULL" not working with entityframework

2012-04-20 Thread Black, Michael (IS)
un...@sqlite.org [sqlite-users-boun...@sqlite.org] on behalf of Nico Williams [n...@cryptonector.com] Sent: Thursday, April 19, 2012 4:47 PM To: General Discussion of SQLite Database Subject: EXT :Re: [sqlite] "DEFAULT BOOLEAN NOT NULL" not working with entityframework On Thu,

Re: [sqlite] "DEFAULT BOOLEAN NOT NULL" not working with entityframework

2012-04-19 Thread Black, Michael (IS)
, non-zero was true. > -Original Message- > From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users- > boun...@sqlite.org] On Behalf Of Black, Michael (IS) > Sent: Thursday, April 19, 2012 3:15 PM > To: General Discussion of SQLite Database > Subject: Re: [sqlite] "DEFAU

Re: [sqlite] "DEFAULT BOOLEAN NOT NULL" not working with entityframework

2012-04-19 Thread Black, Michael (IS)
Problem with true=-1. !false=1 So !false == true fails which can bite you in the behind unexpectedly true= 1 !true=0 true=-1 !true=0 !false=1 (true= 1 == !false) = 1 (true=-1 == !false) = 0 #include main() { int true1=1; int true2=-1; int false=0;

<    1   2   3   4   5   6   7   8   9   >