Re: [sqlite] WAL, synchronous=1 and durability

2012-09-11 Thread Keith Chew
Hi Dan > In both NORMAL mode, we do the following: > > 1. Write a bunch of transactions into the WAL file. > 2. fsync() the WAL file. > 3. Copy the data from the WAL file into the database file. > 4. fsync() the database file. > > If a power failure occurs at any time, the next process to

Re: [sqlite] [Question] Does it necessary to sync directory on persist journal mode?

2012-09-11 Thread Yongil Jang
Please, don't forget my questions. 2012/9/10 Yongil Jang > Dear sqlite-users, > > I have a question about directory sync. > > Question: In case of journal file already exists on disk with persist > journal mode, >does it necessary to sync directory for

Re: [sqlite] instr function or equivalent

2012-09-11 Thread Olaf Schmidt
Am 10.09.2012 17:17, schrieb Bart Smissaert: Ah, OK. I have a feeling that needs to be done either in your application code or with a user defined SQLite function. Somebody may prove me wrong. Hi Bart, since I know you're using my COM-Wrapper, a larger set of Functions (in "VBA-Style",

Re: [sqlite] instr function or equivalent

2012-09-11 Thread Bart Smissaert
Hi Olaf, Yes, I am aware of those functions in your COM wrapper and I am using them. Was just thinking in general terms as not many users on this forum use VB. Great news about the new version and will download and test that today. Thanks for that. Bart On 9/11/12, Olaf Schmidt

Re: [sqlite] WAL, synchronous=1 and durability

2012-09-11 Thread Dan Kennedy
On 09/11/2012 01:21 PM, Keith Chew wrote: Hi Dan In both NORMAL mode, we do the following: 1. Write a bunch of transactions into the WAL file. 2. fsync() the WAL file. 3. Copy the data from the WAL file into the database file. 4. fsync() the database file. If a power failure

Re: [sqlite] [Question] Does it necessary to sync directory on persist journal mode?

2012-09-11 Thread Dan Kennedy
On 09/11/2012 02:22 PM, Yongil Jang wrote: Please, don't forget my questions. 2012/9/10 Yongil Jang Dear sqlite-users, I have a question about directory sync. Question: In case of journal file already exists on disk with persist journal mode, does it

Re: [sqlite] instr function or equivalent

2012-09-11 Thread Bart Smissaert
Hi Olaf, I think it should be: Select Left$(TheField, Instr(TheField,']')) From Tbl Have tested you new dll's and all working fine as usual. Bart On 9/11/12, Olaf Schmidt wrote: > Am 10.09.2012 17:17, schrieb Bart Smissaert: >> Ah, OK. I have a feeling that needs to be done

Re: [sqlite] How do you load a ".csv" and skip the first line?

2012-09-11 Thread John Gillespie
I use "SQLite Manager " extension for Firefox. Don't know if it is available for IE, didn't find it for Safari. John G On 4 September 2012 21:23, Peter Haworth wrote: > Take a look at my SQLiteAdmin tool. It will import csv files with or > without headers, export them that

[sqlite] selecting real values

2012-09-11 Thread Baruch Burstein
When selecting real (float) values, does the sqlite return (and the shell display) the full precision it has by default, or does it have a higher precision stored in the database than it displays? -- ˙uʍop-ǝpısdn sı ɹoʇıuoɯ ɹnoʎ 'sıɥʇ pɐǝɹ uɐɔ noʎ ɟı

Re: [sqlite] WAL, synchronous=1 and durability

2012-09-11 Thread Simon Slavin
On 11 Sep 2012, at 7:21am, Keith Chew wrote: > In my ext3 file system, I have set barrier=1, disables write cache, > and also set commit=1 for per second disk sync from the kernel. In > your opinion, if I used NORMAL, would it mean: > (1) The most number of transactions I

Re: [sqlite] [Question] Does it necessary to sync directory on persist journal mode?

2012-09-11 Thread Yongiljang
Thank you for your answer! When I tested it on my Ubuntu server at the office, Performace was improved slightly. I don't remember that values exactly, but improved ratio was about 5~8%. Sys time was decreased a lot. Strace result shows almost same call counts because of osAccess call. Test SQL

Re: [sqlite] Finding rows with MIN(MTIME) for all IDs

2012-09-11 Thread BardzoTajneKonto
select * from tab id | a | mtime | +--++---+-- 1 | 1 | 3 | 1 | 2 | 2 | 1 | 3 | 4 | 1 | 4 | 2 | 1 | 5 | 7 | 2 | 6 | 1 | 2 | 7 | 0 | 2 | 8 | 4 | 2 | 9 | 1 | 2 | 10 | 2 | select id, a, min(mtime) over(partition by id

Re: [sqlite] selecting real values

2012-09-11 Thread Simon Slavin
On 11 Sep 2012, at 12:18pm, Baruch Burstein wrote: > When selecting real (float) values, does the sqlite return (and the shell > display) the full precision it has by default, or does it have a higher > precision stored in the database than it displays? If the value is

Re: [sqlite] selecting real values

2012-09-11 Thread Black, Michael (IS)
A quick experiment shows that 3.7.14 rounds off the last 2 digits of a double-precision. As of 3.7.14 sqlite3 rounds to 15 significant digits when using the internal formatting routines. sqlite3 test.db SQLite version 3.7.14 2012-09-03 15:42:36 Enter ".help" for instructions Enter SQL

Re: [sqlite] selecting real values

2012-09-11 Thread Igor Tandetnik
Baruch Burstein wrote: > When selecting real (float) values, does the sqlite return (and the shell > display) the full precision it has by default, or does it have a higher > precision stored in the database than it displays? SQLite stores and returns a 64-bit IEEE floating

Re: [sqlite] selecting real values

2012-09-11 Thread Simon Slavin
On 11 Sep 2012, at 1:56pm, "Black, Michael (IS)" wrote: > A quick experiment shows that 3.7.14 rounds off the last 2 digits of a > double-precision. I think we found that the rounding was happening during the translation from text input to having the number stored in

[sqlite] System.Data>SQLite locking problem

2012-09-11 Thread Serge Fournier
Hi, I'm not sure if it's Windows 8 or the latest version of the library (1.0.82) but I have a new problem with the same code that was working before. Simply put, i I open a database and then close it in an application then I reopen it again, I cannot write to it anymore; it is always locked. I

[sqlite] System.Data.SQLite upgrade issue

2012-09-11 Thread Robert Calco
Upgrading from 1.0.66 to 1.0.82 on .NET 4.0 I am running into an issue that appears to stem from assumptions about when/how SQLiteConnection instances are disposed. I'm working on a code base with which I'm not yet entirely familiar. The previous developer created a sort of wrapper connection

Re: [sqlite] selecting real values

2012-09-11 Thread Black, Michael (IS)
There are 3 places in 3.7.14 sqlite3.c where %!.15g" format is used. Ergo 15 significant digits on output. 57186:sqlite3_snprintf(nByte, pMem->z, "%!.15g", pMem->r); 62788:sqlite3XPrintf(, "%!.15g", pVar->r); 85973: sqlite3_snprintf(sizeof(zBuf), zBuf, "%!.15g", r1); For this

Re: [sqlite] WAL, synchronous=1 and durability

2012-09-11 Thread Daniel Frimerman
I fully agree - my tests (involving many hard resets) confirm this. If I could just expound on some of your statements for clarity, for others. This is my understanding gained from testing and reading the posts -- I did not see the code. > In both synchronous=NORMAL and synchronous=FULL the >

Re: [sqlite] WAL, synchronous=1 and durability

2012-09-11 Thread Dan Kennedy
On 09/11/2012 11:03 PM, Daniel Frimerman wrote: In FULL mode, the above is sync'ed, although I don't know whether individual writes to the WAL file are sync'ed, or when all the data belonging to the commit is written the WAL is sync'ed. In NORMAL mode this is not done and that is why it is much

Re: [sqlite] Finding rows with MIN(MTIME) for all IDs

2012-09-11 Thread Petite Abeille
On Sep 11, 2012, at 2:48 PM, bardzotajneko...@interia.pl wrote: > select id, a, min(mtime) over(partition by id order by mtime) m from tab > qualify row_number() over(partition by id order by mtime) = 1 While using analytics would indeed be the best approach overall, these are sadly not

Re: [sqlite] Finding rows with MIN(MTIME) for all IDs

2012-09-11 Thread Wiktor Adamski
select id, a, min(mtime) over(partition by id order by mtime) m from tab qualify row_number() over(partition by id order by mtime) = 1 While using analytics would indeed be the best approach overall, these are sadly not supported in SQLite in any ways or forms. (For the record, if using

[sqlite] C# access to SQLite and Windows 8

2012-09-11 Thread Nicolas Rivera
Hi, If you have seen this message already, please ignore it. I received some sort of email about message content type from the forum, and I am resending it as text just in case. Currently at my job I am writing code to access SQLite from C# using System.Data.SQLite. We are also looking at

Re: [sqlite] Finding rows with MIN(MTIME) for all IDs

2012-09-11 Thread Petite Abeille
On Sep 11, 2012, at 9:13 PM, Wiktor Adamski wrote: >>> select id, a, min(mtime) over(partition by id order by mtime) m from tab >>> qualify row_number() over(partition by id order by mtime) = 1 >> While using analytics would indeed be the best approach overall,

Re: [sqlite] : C# access to SQLite and Windows 8

2012-09-11 Thread Black, Michael (IS)
Have you looked at this? http://timheuer.com/blog/archive/2012/08/07/updated-how-to-using-sqlite-from-windows-store-apps.aspx Michael D. Black Senior Scientist Advanced Analytics Directorate Advanced GEOINT Solutions Operating Unit Northrop Grumman Information Systems _

Re: [sqlite] Finding rows with MIN(MTIME) for all IDs

2012-09-11 Thread Petite Abeille
On Sep 11, 2012, at 9:53 PM, Petite Abeille wrote: > I suspect QUALIFY is SQL Server specific, no? Teradata perhaps… drifting even farther away from ISO/ANSI :P ___ sqlite-users mailing list sqlite-users@sqlite.org

Re: [sqlite] Finding rows with MIN(MTIME) for all IDs

2012-09-11 Thread Wiktor Adamski
With regular ISO window functions, one could typically write something along these lines: with DataSet as ( select foo.*, lag( 0, 1, 1 ) over ( partition by id order by time ) as is_lag fromfoo ) select * fromDataSet where DataSet.is_lag = 1 you're right. it

Re: [sqlite] : C# access to SQLite and Windows 8

2012-09-11 Thread Nicolas Rivera
Have you looked at this? http://timheuer.com/blog/archive/2012/08/07/updated-how-to-using-sqlite-from-windows-store-apps.aspx Thanks for that link. Yes, I have looked at it before. Just to make it clear, I know that, according to that blog, sqlite-net will work from Metro and desktop. I

Re: [sqlite] System.Data>SQLite locking problem

2012-09-11 Thread Joe Mistachkin
Serge Fournier wrote: > > Simply put, I open a database and then close it in an application then I > reopen it again, > I cannot write to it anymore; it is always locked. I tried doing a close, > dispose and shutdown > to my connection and then reopning it and do a simple vaccum; it tell me >

Re: [sqlite] System.Data.SQLite upgrade issue

2012-09-11 Thread Joe Mistachkin
Robert Calco wrote: > > When calling the Close() method on this abstraction, the Connection > variable (an instance of SQLiteConnection) is throwing > ObjectDisposedException. > That exception means the connection has already been disposed. Ideally, disposing the connection only once will solve

[sqlite] C++ - HOW MANY rows?

2012-09-11 Thread Arbol One
I read my newly created database using this method: void Runner::read_tblName() { . sql_statement = "SELECT * FROM name"; db->setStmt(sql_statement); int pos = 0; data1 = db->read_int(pos); db->setStmt(sql_statement); pos = 1; data2 = db->read_str(pos);

Re: [sqlite] C++ - HOW MANY rows?

2012-09-11 Thread Igor Tandetnik
On 9/11/2012 7:28 PM, Arbol One wrote: This works just fine, but it only reads the first row Of course. You only ever call sqlite3_step step after prepare and before finalize. how can I 'tell' my program HOW MANY rows are there to be read and which row I WANT TO READ? You are supposed to

Re: [sqlite] C++ - HOW MANY rows?

2012-09-11 Thread Igor Tandetnik
On 9/11/2012 7:37 PM, Igor Tandetnik wrote: On 9/11/2012 7:28 PM, Arbol One wrote: This works just fine, but it only reads the first row Of course. You only ever call sqlite3_step step after prepare and before finalize. I mean, you only ever call sqlite3_step *once* after prepare and before

Re: [sqlite] System.Data>SQLite locking problem

2012-09-11 Thread Serge Fournier
Yes, all command have been disposed; everything works until I close the connection. Then when I open it again it the same application; either I get a "database is locked" when trying to write to it or I get "SQL queries are still processing" when I just opened it and send a VACUUM pragma to it.

Re: [sqlite] System.Data>SQLite locking problem

2012-09-11 Thread Joe Mistachkin
Serge Fournier wrote: > > Simply put, it's only possible to open a database once in the application > for writing; it's like the lock > doesn't get released until the application is closed. > I'm unable to reproduce the issue you describe here. Could you show us some sample code that

Re: [sqlite] C++ - HOW MANY rows?

2012-09-11 Thread Arbol One
Thanks Igor for your prompt response. Since the call to the sqlite3_step function is inside the mySQLite3::read_* class-function/method, I call the read_* method from Runner::read_tblName() for each datum I need to retrieve. Now, in a while loop inside Runner::read_tblName() I could call the

Re: [sqlite] C++ - HOW MANY rows?

2012-09-11 Thread Igor Tandetnik
Arbol One wrote: > Since the call to the sqlite3_step function is inside the mySQLite3::read_* > class-function/method ... it is clear that you have a poor class design. As you would generally want to read several columns from the same row, it is unwise to have a read_*