Re: [sqlite] Ordering a GROUP BY, or other concatenating tricks?

2017-10-04 Thread Doug Nebeker
Is it just a matter of using sqlite3_create_function to register a function 
that guarantees it will concatenate in the order rows are received?  Would that 
guarantee that your example works, or is order no longer guaranteed once they 
leave the inner select?

SELECT group_concat(LineText, '\n') FROM
(SELECT LineText FROM DocLines
WHERE DocID = 10
ORDER BY LineIndex)

___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Ordering a GROUP BY, or other concatenating tricks?

2017-10-03 Thread Doug Nebeker
Imagine a table that holds individual lines of text documents:

CREATE TABLE DocLines
(
DocID INTEGER,
LineIndex INTEGER,
LineText TEXT
);

INSERT INTO DocLines (DocID, LineIndex, LineText) VALUES (1, 1, 'Mary had a 
little lamb');
INSERT INTO DocLines (DocID, LineIndex, LineText) VALUES (1, 2, 'It had white 
fleece');

//inserted in reverse order so insertion order doesn't happen to make the 
SELECT work

INSERT INTO DocLines (DocID, LineIndex, LineText) VALUES (2, 2, 'Humpty dumpty 
had a great fall');
INSERT INTO DocLines (DocID, LineIndex, LineText) VALUES (2, 1, 'Humpty dumpty 
sat on a wall');

How can I select a document and get the complete sorted text back in a single 
row (so I can do a JOIN on a different table with additional information)?  

The below happens to work fine for DocID 1 (because of insertion order), but 
fails for DocID 2.

SELECT group_concat(LineText, '\n') 
FROM DocLines 
WHERE DocID = 1
GROUP BY DocID;

Is there any way to order a GROUP BY, or some other way to concatenate text?


___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite - how to get number of active connection?

2016-09-10 Thread Doug Nebeker
This isn't exactly the same, but you can find out what other applications have 
a file open (SQLite database file in this case) using the following Windows 
APIs:

RmRegisterResources
RmGetList

That's what I use to help diagnose locking issues.

Doug

-Original Message-
From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On 
Behalf Of Bhavesh Patel
Sent: Friday, September 9, 2016 7:47 AM
To: SQLite mailing list
Subject: [sqlite] SQLite - how to get number of active connection?

I want to run certain clean-up tasks on the SQLite database only and only when 
there is only 1 connection(self) to SQLite.

I do not want to lock the database during the cleanup process.

The main application(s) using the SQLite DB is given 1st preference. the 
cleanup application is executed at low priority and will stop doing the clean 
up of there is any database connection other than the cleanup application.

The cleanup tool will connect SQLite check number of active connection, if 
found one will do some clean up tasks like deleted few tables, cleaning up 
tables etc.

I don't want to manage a flag system and looking for coming out of the box from 
sqlite or may be from windows API.


can use Process 
Explorer   but 
how to get it programmatically . 
http://stackoverflow.com/questions/12138260/how-can-i-count-the-number-of-open-connections-in-an-sqlite-database


Is there any way to know a number of active connection SQLite has ?

___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Failed to install Microsoft Visual C++ Runtime

2016-08-02 Thread Doug Nebeker
Our experience might not apply completely, but we just went through moving to 
VS2015, but because of all of the vcredist issues with the new version 
(involving the UCRT), we had to go back to VS2012.  Note that installing 
vcredist:

“To install this update, you must have April 2014 update rollup for Windows RT 
8.1, Windows 8.1, and Windows Server 2012 R2 (2919355) installed in Windows 8.1 
or Windows Server 2012 R2. Or, install Service Pack 1 for Windows 7 or Windows 
Server 2008 R2. Or, install Service Pack 2 for Windows Vista and for Windows 
Server 2008.”

I believe update KB3118401 is also needed.  Look at KB2919355.  It's a mess :(

Once you can get it and all its dependencies installed, everything works great. 
 But you often need to do more than just install the vcredist as had always 
been the case in the past.  We even did a technical support case with MS.


Doug



-Original Message-
From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On 
Behalf Of Joe Mistachkin
Sent: Sunday, July 31, 2016 6:42 PM
To: 'SQLite mailing list'
Subject: Re: [sqlite] Failed to install Microsoft Visual C++ Runtime


Zehev Spitz wrote:
> 
> > Failed to install Microsoft Visual C++ Runteim:
vcredist_x86_2015_VSU2.exe,
> Another version of this product is already installed. Installation of 
> this version cannot conitnue. To configure or remove the existing 
> version of
this
> product, use Add/Remove Programs on the Control Panel.
> 

Do you have the setup logs handy for this error?  They could help us to resolve 
the issue in the future setup packages.  The setup itself already has a check 
for the error codes that are documented to be used for this particular 
situation; however, there must (?) be (at least) one that is new (to Visual 
Studio 2015).

--
Joe Mistachkin

___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Database corruption question

2016-07-20 Thread Doug Nebeker
Been using SQLite for a long time and a huge fan.  We occasionally see database 
corruption on a local NTFS Windows drive and I've been trying to figure it out.

I finally have some logs from the SQLITE_CONFIG_LOG callback that may be of 
help:

(11) database corruption at line 78267 of [3d862f207e]
statement aborts at 29: [DELETE FROM StatData WHERE StatID IN (SELECT StatID 
FROM Statistic WHERE OwnerType IN (4) AND 
OwningComputer='f7ab745b-1aa7-4159-bbf7-b0b4d1262804') AND Date < 1350715577;]

This is for version 3.11, and the line is for a OP_NotExists case.
There was no power outage or other OS problem, this was not a restored database 
but had been in use for at least 12 hours.  It was not using WAL, and there is 
only one process using the database file (though multiple threads, but they 
each have their own database handle).

I've been through https://www.sqlite.org/howtocorrupt.html a number of times 
over the years :)

Would it be possible for a file scanning process (anti-virus, backup, etc) to 
grab hold of a database file at just the right moment, momentarily blocking a 
write or delete, and causing corruption?

There is a greater chance that this is my bug or environmental than being in 
SQLite, so I'm looking for anything I can do to decrease these occurrences.

Thanks for any input.

Doug
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Article about pointer abuse in SQLite

2016-03-23 Thread Doug Nebeker
> For obvious security reasons all allocations from the Operating System are 
> pre-initialized to 0x00.  

Time to bash Windows, but according to the docs for HeapAlloc, memory is not 
automatically initialized to 0

https://msdn.microsoft.com/en-us/library/windows/desktop/aa366597(v=vs.85).aspx

This fits with my experience as well.

Doug



-Original Message-
From: sqlite-users-bounces at mailinglists.sqlite.org 
[mailto:sqlite-users-boun...@mailinglists.sqlite.org] On Behalf Of Keith Medcalf
Sent: Tuesday, March 22, 2016 8:41 PM
To: SQLite mailing list
Subject: Re: [sqlite] Article about pointer abuse in SQLite


> This discussion on the nature of undefined behaviour code is 
> interesting.  I don't know the reasoning, but it seems that VS6 often 
> initialized things to 0xcd in debug mode and (usually) had memory 
> uninitialized to 0x00 when complied in Release (perhaps 0x00 just 
> happens to be what was on the stack or heap).  I presume this wasn't 
> just to make people suffer  when things don't work the same in debug 
> vs release mode.

The initialization of memory to non-0x00 is a compiler function.

For obvious security reasons all allocations from the Operating System are 
pre-initialized to 0x00.  This is so that your program cannot request a big 
hunk of virtual memory which is full of a predecessor process data and then 
proceed to search it for nifty things like previously used private keys, 
userids, passwords, and so forth.  Such behaviour is required for any Operating 
Systems to obtain any security certification level whatsoever. 




___
sqlite-users mailing list
sqlite-users at mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Rare database corruption - does this help?

2015-09-10 Thread Doug Nebeker
I'm hoping this might be of help to contribute to SQLite's robustness.

We've got thousands of SQLite installations and they almost always work 
flawlessly.  Every once in a while we get a corruption error and I finally have 
a log that catches it.

SQLite has been in use in the project since version 3.0.3, so 10 years?  Over 
the years we've poured over:
https://www.sqlite.org/howtocorrupt.html

The environment is Windows Server 2012 R2, with the database on a local NTFS 
drive.

The process had been running, and the database in constant use, for at least 90 
minutes when the problem occurred.  The error callback from 
sqlite3_config(SQLITE_CONFIG_LOG) reports:

(11) database corruption at line 67560 of [2ef4f3a5b1]

There were no previous database errors that my logging captured.

I have the database and can provide it if it helps. I'm pretty sure this is 
with SQLite 3.8.10.2.

Database usage:
1. Only one thread at a time is ever using a connection handle, though there 
are multiple threads and multiple database handles (each thread has it's own).  
Only one process accesses the database file.
2. Not using shared cache
3. Not using WAL
4. PRAGMA synchronous=1
5. PRAGMA temp_store=1
6. The database files might possibly be read by an external backup/anti-virus 
app, but nothing was written to, and journals shouldn't be getting deleted
7. Server was not rebooted/crash/lost power

sqlite> pragma integrity_check;
*** in database main ***
Page 145387: Rowid 30174458 out of order (max larger than parent max of 0)
Page 137945: Rowid 29568549 out of order (max larger than parent max of 0)
row 14154506 missing from index Ind_StatData_Date
row 14154507 missing from index Ind_StatData_Date
row 14154508 missing from index Ind_StatData_Date
row 14154509 missing from index Ind_StatData_Date
row 14154510 missing from index Ind_StatData_Date
row 14154511 missing from index Ind_StatData_Date
row 14154512 missing from index Ind_StatData_Date
row 14154513 missing from index Ind_StatData_Date
row 14154514 missing from index Ind_StatData_Date
row 14154515 missing from index Ind_StatData_Date
row 14154516 missing from index Ind_StatData_Date
row 14154517 missing from index Ind_StatData_Date
row 14154518 missing from index Ind_StatData_Date
row 14154519 missing from index Ind_StatData_Date
row 14154520 missing from index Ind_StatData_Date
row 14154521 missing from index Ind_StatData_Date
row 14154522 missing from index Ind_StatData_Date
row 14154523 missing from index Ind_StatData_Date
row 14154524 missing from index Ind_StatData_Date
row 14154525 missing from index Ind_StatData_Date
row 14154526 missing from index Ind_StatData_Date
row 14154527 missing from index Ind_StatData_Date
row 14154528 missing from index Ind_StatData_Date
row 14154529 missing from index Ind_StatData_Date
row 14154530 missing from index Ind_StatData_Date
row 14154531 missing from index Ind_StatData_Date
row 14154532 missing from index Ind_StatData_Date
row 14154533 missing from index Ind_StatData_Date
row 14154534 missing from index Ind_StatData_Date
row 14154535 missing from index Ind_StatData_Date
row 14154536 missing from index Ind_StatData_Date
row 14154537 missing from index Ind_StatData_Date
row 14154538 missing from index Ind_StatData_Date
row 14154539 missing from index Ind_StatData_Date
row 14154540 missing from index Ind_StatData_Date
row 14154541 missing from index Ind_StatData_Date
row 14154542 missing from index Ind_StatData_Date
row 14154543 missing from index Ind_StatData_Date
row 14154544 missing from index Ind_StatData_Date
row 14154545 missing from index Ind_StatData_Date
row 14154546 missing from index Ind_StatData_Date
row 14154547 missing from index Ind_StatData_Date
row 14154548 missing from index Ind_StatData_Date
row 14154549 missing from index Ind_StatData_Date
row 14154550 missing from index Ind_StatData_Date
row 14154551 missing from index Ind_StatData_Date
row 14154552 missing from index Ind_StatData_Date
row 14154553 missing from index Ind_StatData_Date
row 14154554 missing from index Ind_StatData_Date
row 14154555 missing from index Ind_StatData_Date
row 14154556 missing from index Ind_StatData_Date
row 14154557 missing from index Ind_StatData_Date
row 14154558 missing from index Ind_StatData_Date
row 14154559 missing from index Ind_StatData_Date
row 14154560 missing from index Ind_StatData_Date
row 14154561 missing from index Ind_StatData_Date
row 14154562 missing from index Ind_StatData_Date
row 14154563 missing from index Ind_StatData_Date
row 14154564 missing from index Ind_StatData_Date
row 14154565 missing from index Ind_StatData_Date
row 14154566 missing from index Ind_StatData_Date
row 14154567 missing from index Ind_StatData_Date
row 14154568 missing from index Ind_StatData_Date
row 14154569 missing from index Ind_StatData_Date
row 14154570 missing from index Ind_StatData_Date
row 14154571 missing from index Ind_StatData_Date
row 14154572 missing from index Ind_StatData_Date
row 14154573 missing from index 

[sqlite] PRAGMA Synchronous safety

2015-03-02 Thread Doug Nebeker
Thank you for your responses Simon and Richard.  To your questions:

> Are you using any PRAGMAs apart from "PRAGMA synchronous" ?

PRAGMA temp_store=1 (file)
PRAGMA cache_size=2000
PRAGMA page_size=4096
sqlite3_soft_heap_limit( 1GB )

Those are the only non-default settings.

> Are you testing the result codes of /all/ your sqlite3_ calls

Yes.  But I usually don't see the full log to see if something has happened 
earlier.  I'll have to track down a log and see if the corruption error is the 
first one that happens.

> are you replacing it with a known good one before continuing

Yes.  Once we get the report, the user has to delete the file and start fresh 
with an empty database.

> Depends on whether you are using WAL mode or not.

I am not using WAL.

Doug


-Original Message-
From: sqlite-users-bounces at mailinglists.sqlite.org 
[mailto:sqlite-users-boun...@mailinglists.sqlite.org] On Behalf Of Simon Slavin
Sent: Monday, March 2, 2015 3:47 PM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] PRAGMA Synchronous safety


On 2 Mar 2015, at 4:45pm, Doug Nebeker  wrote:

> 1. Is setting synchronous to FULL necessary to prevent these corruption 
> problems?

You should not be getting this corruption problem, so I don't know whether FULL 
would cure it.

> 2. NORMAL is much slower than NONE.  Is FULL much slower than NORMAL?

Sorry but it's too hard to predict 'much' since the amount of time taken varies 
with different versions of the OS, width of the data bus, disk format, and 
other such things.  All you can do is try it on your own specific setup.

In the meantime ...

Are you using any PRAGMAs apart from "PRAGMA synchronous" ?

Are you testing the result codes of /all/ your sqlite3_ calls to check that 
they're SQLITE_OK ?  Sometimes it's not the expected call which causes the 
corruption, or which first returns an error because the database is corrupt.

Once the database is reported as corrupt, are you replacing it with a known 
good one before continuing ?  Corruption is not automatically fixed and once a 
database is corrupt it will remain corrupt until something is done about it.

Simon.
___
sqlite-users mailing list
sqlite-users at mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] PRAGMA Synchronous safety

2015-03-02 Thread Doug Nebeker
In the documents, using PRAGMA synchronous 1 (NORMAL) is supposed to be safe 
unless there is an OS crash or power failure.

I've had a few customers (about one a month, out of thousands) that is getting 
the "database disk image is malformed" ExtErr=11 error with the NORMAL pragma, 
and they claim there was no crash, power failure or anything else unusual.  The 
database _does_ get hammered under normal operation.

There are two separate sqlite3* handles to the database.  Each one is protected 
by a critical section, so there is never more than one thread accessing a 
handle at a time.  The database is on a local NTFS drive.

Two questions:

1. Is setting synchronous to FULL necessary to prevent these corruption 
problems?

2. NORMAL is much slower than NONE.  Is FULL much slower than NORMAL?

Thanks
Doug


Re: [sqlite] Best Practice: Storing Dates

2015-01-14 Thread Doug Nebeker
Whatever format you choose to store it in, I highly recommend storing the UTC 
time.  It might be a little more work, but:

1. your program can display the correct local time, even if the 
database/app/user is in/changes to another timezone
2. you won't have to deal with seeing two 1:30am on the day that day light 
savings kicks in


-Original Message-
From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
On Behalf Of Chris Keilitz
Sent: Wednesday, January 14, 2015 7:09 AM
To: sqlite-users@sqlite.org
Subject: [sqlite] Best Practice: Storing Dates

I'm a new sqlite user and new to this mailing list. I hope this question is 
appropriate.

I am writing an application that needs to track a timestamp - date + time down 
to the seconds. I'd like to store the date/time in a standard, efficient, 
usable, portable format.  I have looked over the sqlite date/time functions / 
data types and the ISO 8601 standard and have landed on these two options:

1. Storing it in TEXT format e.g., "YY-MM-DD HH:MM:SS" or 2. Storing it as an 
INTEGER (LONG) in Unix Time (AKA: POSIX or Epoch
time) - number of seconds since 01/01/1970

Since sqlite and most RDMS implementations have functions to convert to and 
from both options and using a LONG should allow the date/time to function way 
past 2038, it seems it comes down to how many bytes it takes to store the 
timestamp and how fast are the conversion routines. The application I'm writing 
won't push any performance boundaries and likely won't need to overly worry 
about storage.  I just want to make the right call on data type and format and 
learn something in the process.

Again, I hope this is an appropriate post for this mailing list. If not, I 
apologize.

Thanks!

Chris
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Documentation error: sqlite3_mutex_try

2014-02-15 Thread Doug Nebeker
The documentation says that sqlite3_mutex_try will always return SQLITE_BUSY  
for "some systems (for example, Windows 95)".

That's not quite accurate from what I see in the latest implementation of 
winMutexTry.  It will ALWAYS return SQLITE_BUSY for any Windows usage, making 
the existence of the function somewhat misleading in this case.




___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] To BEGIN or not to BEGIN. That is the question...

2013-08-30 Thread Doug Nebeker
Igor is naturally correct.  One additional thing to keep in mind - the commit 
phase of a transaction is where a lot of work gets done (meaning slow disk 
access).  So if you have a lot of INSERTs or DELETEs to do, doing many within a 
transaction will give you better performance.

Doug

-Original Message-
From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
On Behalf Of Igor Tandetnik
Sent: Wednesday, August 28, 2013 5:44 PM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] To BEGIN or not to BEGIN. That is the question...

On 8/28/2013 6:28 PM, jose isaias cabrera wrote:
> I know that if I am doing INSERTs and such, I need to,
>
> BEGIN;
>  INSERT...
> END;

No, you don't need to. You can, if you want to, but there's no reason to have 
to.

> But, do I need to begin if I am going to create a table? ie.
>
> BEGIN;
>  CREATE TABLE tableName
>  (
>  JobID integer primary key, SubProjID integer, ProjID integer
>  );
> END;

Same here.

> Also, what other commands should I wrap with BEGINs and ENDs?

BEGIN starts an explicit transaction; END commits the same. You need an 
explicit transaction if you want to execute two or more statements atomically, 
so that either they all succeed, or one fails and then the database is rolled 
back to the original state.

If you don't start a transaction explicitly, then each statement is implicitly 
wrapped in its own transaction.
--
Igor Tandetnik

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] CREATE INDEX and column order

2013-08-28 Thread Doug Nebeker
Thanks Simon, that makes a lot of sense.  Does the order of columns in a WHERE 
clause matter, or will the query optimizer look at them as a set and find the 
best index?  (ignoring all the special cases)



-Original Message-
From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
On Behalf Of Simon Slavin
Sent: Tuesday, August 27, 2013 7:29 AM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] CREATE INDEX and column order


On 27 Aug 2013, at 1:07pm, Doug Nebeker <ad...@poweradmin.com> wrote:

> I was reading about the new query planner and came across a few references to 
> that idea that the left most columns in the index definition should be the 
> most unique (as far as values in the column are concerned).
> 
> Is that correct?  In my case, many tables have a timestamp column, and I've 
> been using that as my right-most column, but it seems it would be a great 
> candidate to be switched.

When using an index, SQL has to work from the most significant end -- the left 
-- to the least significant end -- the right.  For instance, suppose you have a 
phone book

CREATE TABLE phonebook (firstname TEXT, surname TEXT, phonenumber TEXT) CREATE 
INDEX psf ON phonebook (surname, firstname)

This index is useless for looking someone up by their firstname, because it has 
everyone listed in surname order:

Abelson, David
Abelson, Joan
Smith, David
Smith, Martine
Smith, Tom

If you wanted to look up all the 'Martines' you'd just have to look through the 
whole index anyway.  You might as well scan the original table. [1]

Simon.

[1] Yes, many picky details about this but I'm simplifying for the purpose of 
explanation.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] CREATE INDEX and column order

2013-08-27 Thread Doug Nebeker
I was reading about the new query planner and came across a few references to 
that idea that the left most columns in the index definition should be the most 
unique (as far as values in the column are concerned).

Is that correct?  In my case, many tables have a timestamp column, and I've 
been using that as my right-most column, but it seems it would be a great 
candidate to be switched.

Thanks
Doug
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Beginning database question

2013-04-17 Thread Doug Nebeker
This is a tough one to answer because there is so much context to consider.  
SQLite, or any database, could easily solve the problem you mention (storing 
values that can change without needing to recompile your program).  

Whether it's more efficient is another question.  If you think you'll have many 
more than 10 entries (likes thousands or millions), or the 10 entries change 
very often (once a minute??) and you could automate entering them, a simple app 
using a database like SQLite would be a decent way to go.   Does this need to 
get put on a website?  Is the app going to be mailed around? (in which case a 
spreadsheet might be just as easy).

If you'd like to use this as an excuse to learn more about databases, this 
project would be a perfect opportunity.  It's surprising how often databases, 
especially a small and simple one like SQLite come in handy.

Compared to using Excel:
> coding efficiency - no coding needed to use Excel, so Excel wins
> processing speed - your app would almost certainly start up and run quicker 
> than Excel
> memory usage - your app would definitely use less memory than Excel, but does 
> this really matter with only 10 entries?

That's my best shot.

Doug

-Original Message-
From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
On Behalf Of Carl Gross
Sent: Tuesday, April 16, 2013 3:28 AM
To: sqlite-users@sqlite.org
Subject: [sqlite] Beginning database question

Hi All,

I'm an amateur programmer who has never worked with databases before.  I
*think* that getting started with SQLite may help with some of my projects, but 
I'm having trouble determining exactly how.  I'm hoping someone in this list 
may be able to point me in the right direction.

My simplified situation is this.  There are 10 discrete heights' and 10 
discrete weights,' and each height/weight combination corresponds to one of two 
'teams.'  All of this information is hardcoded into my program.  My program 
asks a user to enter his own height and weight, and the program will output the 
user's corresponding team based on the hardcoded data.

My SQLite question is:  Can using SQLite instead of Microsoft Excel be 
beneficial in terms of coding efficiency, processing speed, memory usage, or 
any other aspect?  If so, how?

Sorry for the long, broad, vague question.  I'm not looking for someone to tell 
me how to do something.  I'm looking for someone to assure me that SQLite 
(rather than a simple spreadsheet) is right for me, and to hopefully steer me 
towards some documentation that may be beneficial to me.

Thanks,

Carl
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] VC++ and SQLite

2012-11-12 Thread Doug Nebeker
You might be surprised at the speed increase you see in compile time if
you've got large projects.  The time isn't lost to CPU as much, but disk I/O
time adds up when hitting many hundreds of small (header) files (even with
an SSD).

Doug

-Original Message-
From: sqlite-users-boun...@sqlite.org
[mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Rob Richardson
Sent: Monday, November 12, 2012 1:33 PM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] VC++ and SQLite

I always turn pre-compiled headers off for every VC++ project.  In my
opinion, they are artifacts from a time when processors were a few hundred
times slower than they are now.  The benefit in time saved now is far less
than the confusion they cause when something goes wrong.

RobR

-Original Message-
From: sqlite-users-boun...@sqlite.org
[mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Adam DeVita
Sent: Monday, November 12, 2012 10:49 AM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] VC++ and SQLite

It isn't VS2010 specific. Even going back to VS6 writing your own C++
wrapper and including the.c file you had to tell it to not use precompiled
headers for that file. (Both Debug and Release builds)

You should tell VS that this file will not ever be using precompiled
headers.

On VS2012 Professional Edition one can:
Right click on the file within VS10, select Properties.
Open the C/C++ tree.
Select Precompiled Headers.
Set Precompiled Header to Not Using Precompiled Headers.


Adam

On Mon, Nov 12, 2012 at 10:17 AM, John Drescher 
wrote:
>>> I know this question is not a SQLite question, but I am hoping that 
>>> someone here has had a similar experience and/or can point me to the 
>>> right place to ask this question.
>>>
>>> After years or using Code::Blocks and Dev-Cpp, I have recently 
>>> installed Visual Studio 10 Express; it is the first time I am using 
>>> it, in my Windows
>>> 7 machine.
>>>
>>> I have written, with the help of this mailing list a wrapper class 
>>> for the latest SQLite3 library using C::B as my development 
>>> platform, now that I want to switch to VS10, there were a lot of gcc 
>>> specific code that I had to repair and after clearing all the C++ 
>>> discrepancies between MinGW's g++ and MS's VC++ I have been left with
this error message:
>>>
>>> fatal error C1853: 'Debug\sql.pch' precompiled header file is from a 
>>> previous version of the compiler, or the precompiled header is C++ 
>>> and you are using it from C (or vice versa
>>>
>>>
>>>
>>> Does anyone know how to resolve this issue or perhaps a VS10 
>>> specific
>
> You can like the other poster said disable PCH in visual studio or 
> just delete all the PCH files and have VS rebuild them. The second is 
> what I do in Visual Studio retail versions when I get this error.
>
> John
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users



--
VerifEye Technologies Inc.
905-948-0015x245
151 Whitehall Dr, Unit 2
Markham ON, L3R 9T1
Canada
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


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

2012-06-27 Thread Doug Nebeker
>  UTC is "the right time."  If you're doing anything with dates and
>  times I would STRONGLY recommend that all recorded times are in UTC.

Jay is right.  I've been bitten by storing local times before.  Even if your
users
are in the same time zone, that time zone shifts with day light savings.  It
was a 
painful lesson.  Always store times in UTC.

Doug


___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] What is the column value after ALTER TABLE ADD COLUMN?

2007-05-18 Thread Doug Nebeker
I must be missing something obvious and I'm hoping someone can help me
out.
 
I have an existing table and add a new column:

ALTER TABLE xyz ADD COLUMN newcol TEXT;
 
Next I want to set some default values to the new column.  Because this
code could potentially get executed later, I'm trying to be safe:
 
UPDATE xyz SET newcol=function(other_column) WHERE newcol=null;
UPDATE xyz SET newcol=function(other_column) WHERE newcol='';
 
Both of the above fail. What is the value in newcol?
 
Thanks for any ideas.
 
Doug


This email was sent to you by Reuters, the global news and information company. 
To find out more about Reuters visit www.about.reuters.com

Any views expressed in this message are those of the individual sender, 
except where the sender specifically states them to be the views of Reuters 
Limited.

Reuters Limited is part of the Reuters Group of companies, of which Reuters 
Group PLC is the ultimate parent company.
Reuters Group PLC - Registered office address: The Reuters Building, South 
Colonnade, Canary Wharf, London E14 5EP, United Kingdom
Registered No: 3296375
Registered in England and Wales



RE: [sqlite] One more SQLite threading question

2007-05-18 Thread Doug Nebeker
> > Yes I did the same experiment with a lock that made thread A wait  
> > until B was finished. So actually only one thread can be active at
the time.
> > I don't see how the outcome of this experiment can be of  any 
> > interest, as there is no time reduction any longer. But your  guess
is 
> > right that, it works.
> 
>How would multiple threads be faster than a single one when you are
accessing a single resource?

Assumably the thread that is accessing the database either spends some
time gathering data to write
or processing data it read.  The single resource isn't in use during
that time.

This email was sent to you by Reuters, the global news and information company. 
To find out more about Reuters visit www.about.reuters.com

Any views expressed in this message are those of the individual sender, 
except where the sender specifically states them to be the views of Reuters 
Limited.

Reuters Limited is part of the Reuters Group of companies, of which Reuters 
Group PLC is the ultimate parent company.
Reuters Group PLC - Registered office address: The Reuters Building, South 
Colonnade, Canary Wharf, London E14 5EP, United Kingdom
Registered No: 3296375
Registered in England and Wales



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



RE: [sqlite] SQLite v/s SQLite3 Performance Assay

2007-03-13 Thread Doug Nebeker
Be aware that the Windows GetTickCount call has a resolution of 10 to 15
ms on most machines, so that could throw throw your timings off if
you're timing each individual test case as it appears below.  To get
better timer resolution, use QueryPerformanceCounter.

Now, would that make SQLite3 looks slower than v2?  I wouldn't think
so--you'd think it would skew the results equally for both tests.  

Doug

-Original Message-
From: Nitin Kashyap [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 13, 2007 2:51 AM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] SQLite v/s SQLite3 Performance Assay

> Version 3 has a different default safety-level (default FULL) to 
> version 3 (default NORMAL). So if you didn't explicitly set the 
> safety-level during the tests, then version 3 was syncing the disk 
> more often than version 2. I think this might be why version 3 appears

> slower in Test Case I (Inserts).
>
> The results of cases II to IV seem odd. Can you post the test code to 
> the list?
>
> Dan.


Hi Dan,
   You seem to be right on the Sync end; But it does not explains why
read is taking more time.  Below are the snippet u requested.

Select Query:
#define SQLQuery4 "select tbl01.code, * from tbl01, tbl02, tbl03, tbl04
"
\
 "where tbl01.code=tbl02.code01 "
\
 "and tbl01.code=tbl03.code01 "
\
 "and tbl01.code=tbl04.code01 "
\
 "order by tbl04.orderField "

#define SQLQuery2 "select tbl03.code, * from tbl03, tbl04 "
\
 "where tbl03.code = tbl04.code03 "
\
 "order by tbl04.orderField "

SQLite2 Snippet:
{
end getTickCount();

/ Start Select: 2 table */
printf("Perfroming Simple Select of 2 Table...");
fflush(stdout);
beg = end;
i=0;
snprintf(sqlQry, 1024, "%s",SQLQuery2);
if( sqlite_compile(pSource, sqlQry, NULL, , ) ==
SQLITE_OK )
{
while( sqlite_step( pVm
   ,
   ,(const char ***) 
   ,(const char ***) ) == SQLITE_ROW
)
{
 i++;
}
sqlite_finalize(pVm, );
}
else
{
printf("err in sql:  : %s\n",__LINE__, sqlQry);
if(errMsg != NULL)
printf("errMsg: %s\n", errMsg);
goto cleanUp;
}
end = getTickCount();
printf("Done\n");
printf("Time To Select 2 Table with entries returned(%d),(%d):
%ld\n", i, numColumn, (end-beg)); }

SQLite3 Snippet:
{
end = getTickCount();
/ Start Selecting: 2 table
*/
printf("Perfroming Simple Select of 2 Table");
beg = end;
i=0;
snprintf(sqlQry, 1024, "%s",SQLQuery1);
if( sqlite3_prepare(pSource, sqlQry, -1, , ) ==
SQLITE_OK )
{
while( sqlite3_step(pSqlStmt) == SQLITE_ROW )
{
i++;
}
sqlite3_finalize(pSqlStmt);
}
else
{
printf("err in sql:  : %s\n",__LINE__, sqlQry);
if(errMsg != NULL)
printf("errMsg: %s\n", errMsg);
goto cleanUp;
}
end = getTickCount();
printf("Done\n");
printf("Time To Select 2 Table with entries returned(%d): %ld\n", i,
(end-beg)); }

Thanks & Regards
Nitin K

This email was sent to you by Reuters, the global news and information company. 
To find out more about Reuters visit www.about.reuters.com

Any views expressed in this message are those of the individual sender, 
except where the sender specifically states them to be the views of Reuters 
Limited.

Reuters Limited is part of the Reuters Group of companies, of which Reuters 
Group PLC is the ultimate parent company.
Reuters Group PLC - Registered office address: The Reuters Building, South 
Colonnade, Canary Wharf, London E14 5EP, United Kingdom
Registered No: 3296375
Registered in England and Wales



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



RE: [sqlite] Lemon example

2007-03-05 Thread Doug Nebeker
URL didn't work for me either, but you'll see what you want at the root
(at least today):
http://www.cesarodas.com/



-Original Message-
From: Cesar Rodas [mailto:[EMAIL PROTECTED] 
Sent: Monday, March 05, 2007 10:44 AM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] Lemon example

The URL is ok, I opened here... try again and let me know if you could
not and I will email you the content of the example.

On 05/03/07, Clay Dowling <[EMAIL PROTECTED]> wrote:
>
>
> Cesar Rodas wrote:
> > Here is  Lemon tutorial. Shows how to make a calculator with a
> feature  of
> > use Parents "()" in math expression.
> >
> http://www.cesarodas.com/2007/03/creating-basic-calculator-with-lemon.
> html
> .
> >
> > The author disclaims the copyright of the calculator.
>
> There's a problem with that URL.  Could you check it, or check your 
> server?  I'd love to read the example, but my browser steadfastly 
> refuses to resolve an address for cesarodas.com
>
> Clay Dowling
> --
> Simple Content Management
> http://www.ceamus.com
>
>
>
> --
> --- To unsubscribe, send email to 
> [EMAIL PROTECTED]
>
> --
> ---
>
>


--
Cesar Rodas
http://www.sf.net/projects/pagerank (The PageRank made easy...)
http://www.sf.net/projects/fastfs ( The Fast File System) Mobile Phone:
595 961 974165
Phone: 595 21 645590
[EMAIL PROTECTED]
[EMAIL PROTECTED]


This email was sent to you by Reuters, the global news and information company. 
To find out more about Reuters visit www.about.reuters.com

Any views expressed in this message are those of the individual sender, 
except where the sender specifically states them to be the views of Reuters 
Limited.

Reuters Limited is part of the Reuters Group of companies, of which Reuters 
Group PLC is the ultimate parent company.
Reuters Group PLC - Registered office address: The Reuters Building, South 
Colonnade, Canary Wharf, London E14 5EP, United Kingdom
Registered No: 3296375
Registered in England and Wales



-
To unsubscribe, send email to [EMAIL PROTECTED]
-



RE: [sqlite] Re: SQL that is stumping me

2006-10-31 Thread Doug Nebeker
Thank you Igor, that works great.  

Is there a FAQ or page somewhere that would help me understand how
inter-table comparisons like this work?  I'd like to be able to do more
of them (without asking for help if possible).


-Original Message-
From: Igor Tandetnik [mailto:[EMAIL PROTECTED] 
Sent: Monday, October 30, 2006 5:08 PM
To: SQLite
Subject: [sqlite] Re: SQL that is stumping me

Doug Nebeker <[EMAIL PROTECTED]>
wrote: 
> Imagine I have the following data:
> 
> TimeStamp | Person | Data1
> ---
> 1 | Doug   | X
> 2 | Doug   | Y
> 2 | Fred   | A
> 3 | Doug   | Z
> 4 | Fred   | B
> 
> How do I set all Data1 values for each person to the _first_ value 
> that was seen for them (X for all Doug Data1 values, A for all Fred 
> Data1 values)?

update tableName set data1 =
(select data1 from tableName t2 where t2.Person=tableName.Person
 order by t2.TimeStamp limit 1);

Igor Tandetnik


-
To unsubscribe, send email to [EMAIL PROTECTED]

-



This email was sent to you by Reuters, the global news and information company. 
To find out more about Reuters visit www.about.reuters.com

Any views expressed in this message are those of the individual sender, except 
where the sender specifically states them to be the views of Reuters Ltd.


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



[sqlite] SQL that is stumping me

2006-10-30 Thread Doug Nebeker
I have a generic SQL question for the less-newbie-than-me out there.

Imagine I have the following data:

TimeStamp | Person | Data1
---
1 | Doug   | X
2 | Doug   | Y
2 | Fred   | A
3 | Doug   | Z
4 | Fred   | B

How do I set all Data1 values for each person to the _first_ value that
was seen for them (X for all Doug Data1 values, A for all Fred Data1
values)?

I get as far as:

UPDATE  SET SET Data1=(SELECT Data1 FROM  ORDER BY
Timestamp Limit 1) 

but then can't figure out how to handle the per-person part of it (GROUP
BY and HAVING?).

I'm really stuck on this and could benefit from any direction you might
have.

Thank you in advance for any ideas.



This email was sent to you by Reuters, the global news and information company. 
To find out more about Reuters visit www.about.reuters.com

Any views expressed in this message are those of the individual sender, except 
where the sender specifically states them to be the views of Reuters Ltd.


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



[sqlite] Can't figure out index problem

2006-08-24 Thread Doug Nebeker
I'm wondering if someone can help me understand why a table scan is
being done for the SQL below even though I've created what I thought
would be appropriate indices.
 
When I do a EXPLAIN QUERY PLAN on the following SQL:
 
SELECT S.ScanID S.Date, S.RootDirID, S.OwningMonitorID, D.Path 
FROM Check S, Directory D 
WHERE 
 S.RootDirID = D.DirID AND 
 S.bHasFileInfo = 1 AND 
 S.bComplete= 1 
ORDER BY D.PATH ASC, S.DATE DESC
 
it tells me it will do a table scan on Check and Directory
 
CREATE TABLE Directory 
(
 DirID INTEGER PRIMARY KEY,
 Path TEXT NOT NULL,
 ParentDirID INTEGER NOT NULL
);
CREATE INDEX Ind_Directory_ParentDirID ON Directory (ParentDirID);
CREATE UNIQUE INDEX Ind_Directory_Path ON Directory (Path);
 
CREATE TABLE Check 
( 
 ScanID INTEGER PRIMARY KEY,
 Date INTEGER NOT NULL, 
 OwningMonitorID INTEGER NOT NULL,
 RootDirID INTEGER NOT NULL,
 bHasDirInfo INTEGER NOT NULL,   
 bHasFileInfo INTEGER NOT NULL,  
 bHasOwnerInfo INTEGER NOT NULL, 
 bComplete INTEGER NOT NULL
);
CREATE UNIQUE INDEX Ind_Check_Date ON Check (Date);
CREATE UNIQUE INDEX Ind_Check_RootDirID ON Check (RootDirID);
 
What can I do so this statement will use the/an index?
 
Thanks
 
 


To find out more about Reuters visit www.about.reuters.com

Any views expressed in this message are those of the individual sender, except 
where the sender specifically states them to be the views of Reuters Ltd.



RE: [sqlite] Multithreading. Again.

2006-06-05 Thread Doug Nebeker
The problem with that solution is that it assumes all database access
happens from within a single process.  As far as I understand it, SQLite
allows database access from multiple processes (and even from remote
processes I assume) and thus the locking has to happen outside of the
process.  In process locking would be a nice conditionally compiled
optimization, but you'd have to guarantee that no other process would
never touch the database.

-Original Message-
From: John Stanton [mailto:[EMAIL PROTECTED] 
Sent: Saturday, June 03, 2006 8:14 PM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] Multithreading. Again.

Joe Wilson wrote:
>>Remember, that the operating system bug that is causing all the 
>>multithreading grief is that file locks created by one thread cannot 
>>be reliably removed or modified by a different thread.
> 
> 
> You could have a single thread that exclusively performs file
locking/unlocking.
> This thread would wait on a threadsafe work queue (using a POSIX 
> condition variable mechanism) and execute file locking/unlocking 
> tasks, otherwise it would use zero CPU. Functions could be provided to

> put file lock/unlock operations on to this work queue and wait for the
result.
> Such file locking/unlocking functions could be called safely and 
> reliably from any thread.
> 
That sounds like good practice to me.  When one discovers that a
particular function is flaky and variable between implementations, O/S's
and versions prudence requires that it be bypassed.  In our Sqlite usage
we want platform independence and reliability and accordingly never rely
on file locking for synchronization.

A bonus of such an approach is simpler code and logic and better
execution efficiency.
JS


To find out more about Reuters visit www.about.reuters.com

Any views expressed in this message are those of the individual sender, except 
where the sender specifically states them to be the views of Reuters Ltd.



RE: [sqlite] Charset-Confusions

2006-05-15 Thread Doug Nebeker
I can't comment on Anne's situation, but I too think there is something funny 
going on with charsets because of one small data point:
I open and use a database using the '16' APIs (ie sqlite3_open16, 
sqlite3_prepare16, etc).  When I tried to run an EXPLAIN QUERY PLAN statement 
(like "EXPLAIN QUERY PLAN SELECT id FROM LIST WHERE test=1" just as an example) 
using my typical prepare16, step16, etc code, I'd always get back an empty 
result.  However, if I run the identical statement with sqlite3_exec (NOT the 
16 version) the results came back as expected.  After figuring this out I just 
worked around the problem, but it makes me think there might be something there.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Monday, May 15, 2006 1:45 PM
To: sqlite-users@sqlite.org
Subject: [sqlite] Charset-Confusions

Hi

I have some confusion again. I have create the same Database 4 times and after 
that perform Insert some records. I dont change the SQL-Commands.

1. Compiler-Option Unicode and run "sqlite3_exec()" 
2. Compiler-Option Multibyte and run "sqlite3_exec()"

3. Compiler-Option Unicode and run "sqlite3_prepare()"
4. Compiler-Option Multibyte and run "sqlite3_prepare()"

Create Table and Insert Records works fine with sqlite3_prepare() on both 
charsets. I got no problems with write and followed read the written records 
and there field-values. 

Create Table first, Insert and followed Select to fetch Data works also fine 
with sqlite3_exec() if i define Multibyte. But the results are unusable, if i 
define Unicode (only German Umlauts).

I have a look in SQLite-Source and found, that sqlite3_exec() after some lines 
self perform a Call to sqlite3_prepare(). 
If i dont need the Callback-Funtionality, can i start in my App directly 
sqlite3_prepare() instead sqlite3_exec() and get the same Result for "Inserts" 
and "Updates" (only)?

An the 2. question: Is there any Really-Good-Admin-Tool to create DB and Table, 
to browse and maybe edit Fieldvalues in a grid? 
I have found 4 Admin-Programms. Some of them cannot open Version 3, some cannot 
differ Unicode and Multibytecharset, one of them has not a useful gui.

Greetings from Germany
Anne

--
GMX Produkte empfehlen und ganz einfach Geld verdienen!
Satte Provisionen für GMX Partner: http://www.gmx.net/de/go/partner


To find out more about Reuters visit www.about.reuters.com

Any views expressed in this message are those of the individual sender, except 
where the sender specifically states them to be the views of Reuters Ltd.



Re: [sqlite] Detecting table scan

2006-05-04 Thread Doug Nebeker
Thanks Dennis.

So does that mean if I get "TABLE xyz" in the 'detail' column back and
it does NOT mention an index that a full table scan is taking place?
I found some info about EXPLAIN QUERY PLAN
(http://www.sqlite.org/cvstrac/wiki?p=QueryPlans) but haven't found out
exactly what the response columns mean.

Thanks
Doug

>>I have a wrapper class that I use for SQLite that I'm quite happy
with.
>>I've decided that if it is compiled for DEBUG usage, I want it to do
an 
>>EXPLAIN on every SQL statement and then check the output to see if any

>>table scans are happening (I'm just barely good enough at SQL to be 
>>dangerous).  This way I'll be notified if I've got some statements or 
>>table definitions that could use some help.
>>  
>>
>Doug,
>
>Instead of using the EXPLAIN command, use the EXPLAIN QUERY PLAN
command. Its output tells you how it is scanning the tables and indexes
to implement a >query.
>
>HTH
>Dennis Cote


To find out more about Reuters visit www.about.reuters.com

Any views expressed in this message are those of the individual sender, except 
where the sender specifically states them to be the views of Reuters Ltd.



[sqlite] Detecting table scan

2006-05-03 Thread Doug Nebeker
I appologize for asking what might be a dumb question, but here goes:
 
I have a wrapper class that I use for SQLite that I'm quite happy with.
I've decided that if it is compiled for DEBUG usage, I want it to do an
EXPLAIN on every SQL statement and then check the output to see if any
table scans are happening (I'm just barely good enough at SQL to be
dangerous).  This way I'll be notified if I've got some statements or
table definitions that could use some help.
 
So, I started looking through the list of opcodes
(www.sqlite.org/opcode.html) and it is not at all obvious to me how to
detect that a table scan will take place.  Do I just look for OpenXXX
opcodes??
 
One other completely unrelated question: How often do any of you run
ANALYZE on your databases?  Any rules of thumb for when to do it?
 
Thanks
Doug


To find out more about Reuters visit www.about.reuters.com

Any views expressed in this message are those of the individual sender, except 
where the sender specifically states them to be the views of Reuters Ltd.



RE: [sqlite] Complile and connecting to SQLite

2006-05-02 Thread Doug Nebeker
Pre-compiled Windows DLL:  http://www.sqlite.org/sqlitedll-3_3_5.zip 
Source for Windows: http://www.sqlite.org/sqlite-source-3_3_5.zip

You can compile the source (I happen to do it with Microsoft Visual
Studio) and get the DLL as well.

The links above are available on the following page:
http://www.sqlite.org/download.html

There are other downloads there that might be helpful too so look
around.

- Doug

-Original Message-
From: Aaron Jones [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 02, 2006 9:49 AM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] Complile and connecting to SQLite

there is no dll file in the sqlite source

On 02/05/06, Eric Bohlman <[EMAIL PROTECTED]> wrote:
>
> Aaron Jones wrote:
> > Windows XP, don't know what compiler to use.
>
> MinGW and all the common versions of Visual Studio work.
>
> >
> > I am creating a GUI to SQLite, so need my interface to connect to
> SQLite,
> > and wanted to know what it connected to, the source code or the exe
> file.
>
> SQLite is an embeddable engine (library), not a server, so you don't 
> "connect to" it, you link it into your program.  The "exe file" is 
> simply a command-line shell program that's been linked with the SQLite

> library.  You can link SQLite either statically or dynamically (.dll) 
> the same way you can link any other library.
>


To find out more about Reuters visit www.about.reuters.com

Any views expressed in this message are those of the individual sender, except 
where the sender specifically states them to be the views of Reuters Ltd.



RE: [sqlite] Intermittent crash in sqlite3_prepare()

2006-04-24 Thread Doug Nebeker
What does the code look like that is calling sqlite3_prepare?  The crash
point is just dereferening a pointer that you passed in, and it looks
like the pointer value must be bad.
 
> int sqlite3_prepare(
>   sqlite3 *db,  /* Database handle. */
>   const char *zSql, /* UTF-8 encoded SQL statement. */
>   int nBytes,   /* Length of zSql in bytes. */
>   sqlite3_stmt **ppStmt,/* OUT: A pointer to the prepared  
> statement */
>   const char** pzTail   /* OUT: End of parsed string */
> ){
>   Parse sParse;
>   char *zErrMsg = 0;
>   int rc = SQLITE_OK;
>   int i;
>
>   /* Assert that malloc() has not failed */
>   assert( !sqlite3MallocFailed() );
>
>   assert( ppStmt );
>   *ppStmt = 0;  << the crash occurs here...


Any ideas why this is happening?

Thanks,

-- Tito


To find out more about Reuters visit www.about.reuters.com

Any views expressed in this message are those of the individual sender, except 
where the sender specifically states them to be the views of Reuters Ltd.



RE: [sqlite] how to fix problem of lock

2006-04-04 Thread Doug Nebeker
>From http://www.hwaci.com/sw/sqlite/whentouse.html
"Situations Where Another RDBMS May Work Better"
* High Concurrency

SQLite uses reader/writer locks on the entire database file. That means
if any process is reading from any part of the database, all other
processes are prevented from writing any other part of the database.
Similarly, if any one process is writing to the database, all other
processes are prevented from reading any other part of the database. For
many situations, this is not a problem. Each application does its
database work quickly and moves on, and no lock lasts for more than a
few dozen milliseconds. But there are some applications that require
more concurrency, and those applications may need to seek a different
solution. 

If you are really writing an app like Google, SQLite is quite possibly
not the best solution because of its locking.  


-Original Message-
From: Cesar David Rodas Maldonado [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 04, 2006 1:23 PM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] how to fix problem of lock

Please people help me :D, the project will be open source...

On 4/4/06, Cesar David Rodas Maldonado <[EMAIL PROTECTED]> wrote:
>
> OK English is not my first language, i am from south America, from 
> Paraguay so i speak Spanish...
>
> I am doing a project in C multiplataform.. right it project like 
> google, for a Linux.
>
> the project uses SQ Lite for repository.
>
> The software is a server which listen connection UDP. The server could

> index (INSERT) and search within the database (SELECT).
>
> The problem is when i do so much connection at the same time for do 
> index and search at the same time.
>
> Know is it clear? sorry for my english :D
>
> Thanxs
>
>
>
>
> On 4/3/06, John Stanton <[EMAIL PROTECTED]> wrote:
> >
> > Try to explain what you are doing.  How do you access SQLITE?  What 
> > language?  What SQL are you using.  How many concurrent users do you

> > have?  Are you getting a LOCK error because of multiple users?
> >
> > Cesar David Rodas Maldonado wrote:
> > > please i need some help
> > > On 4/3/06, Cesar David Rodas Maldonado <[EMAIL PROTECTED]> wrote:
> > >
> > >>i insert numbers and  select numbers, so what could be the 
> > >>solutions, couse i have to do that
> > >>
> > >>
> > >>On 4/3/06, Pam Greene < [EMAIL PROTECTED] > wrote:
> > >>
> > >>>An INSERT can change the results of your SELECT, so the database 
> > >>>has
> > to
> > >>>be
> > >>>locked during INSERT.  Otherwise, the result of your SELECT would
> > depend
> > >>>on
> > >>>whether the INSERT had finished yet.  (The INSERT might even have
> > only
> > >>>partly finished, which would mean the SELECT was looking at a
> > database
> > >>>in an
> > >>>inconsistent state.)  It's not good to have unpredictable results
> > like
> > >>>that.
> > >>>
> > >>>For more explanation of why what you want isn't a good idea, see 
> > >>>any discussion of an "ACID" database, for example 
> > >>>http://en.wikipedia.org/wiki/ACID .
> > >>>
> > >>>- Pam
> > >>>
> > >>>On 4/3/06, Cesar David Rodas Maldonado <[EMAIL PROTECTED]> wrote:
> > >>>
> > HElp me, couse i just need to do insert and select, i dont use
> > delete
> > >>>
> > >>>or
> > >>>
> > replate or update
> > 
> > On 4/3/06, Cesar David Rodas Maldonado < [EMAIL PROTECTED] >
wrote:
> > 
> > >thanx man
> > >
> > >
> > >but is posible open several DATABASE with a programm and do
> > >>>
> > >>>transaccion
> > >>>
> > >without locked the table???
> > >
> > >On 4/3/06, Jay Sprenkle < [EMAIL PROTECTED]> wrote:
> > >
> > >
> > >>On 4/3/06, Cesar David Rodas Maldonado < [EMAIL PROTECTED] >
wrote:
> > >>
> > >>>I have a database ok... i do a lot of insert and select, 
> > >>>but
> > >>>
> > there
> > 
> > >>is
> > >>
> > >>>sometime that i cant do the select couse the database is
> > >>>
> > >>>locked...
> > >>>
> > >>>i have to do a lot of insert every time, so how can i do for
> > >>>
> > >>>dont
> > >>>
> > lock
> > 
> > >>the
> > >>
> > >>>database...
> > >>>
> > >>>understand guy?
> > >>
> > >>Try this:
> > >>http://sqlite.org/lang_transaction.html
> > >>
> > >
> > >
> > 
> > >>>
> > >
> >
> >
>


To find out more about Reuters visit www.about.reuters.com

Any views expressed in this message are those of the individual sender, except 
where the sender specifically states them to be the views of Reuters Ltd.



RE: [sqlite] question about performance

2006-02-08 Thread Doug Nebeker
When you don't wrap everything in a transaction, each statement becomes
it's own transaction.  And the database file is opened, updated, and
closed on each transaction.  So your first case had roughly 50 times the
amount of file I/O and transaction startup/commit overhead as the second
case.

-Original Message-
From: Xavier Noria [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, February 08, 2006 10:04 AM
To: sqlite-users@sqlite.org
Subject: [sqlite] question about performance

I have a simple schema and a sql loader that fills a table with initial
values:

   delete from foo;
   insert into foo ...;
   insert into foo ...;
   ... about 50 inserts ...

To my surprise, the execution of these inserts took a few seconds
(SQLite is 3.3.3). However, if I wrapped the entire loader in a
transaction:

   begin transaction;
   delete from foo;
   insert into foo ...;
   insert into foo ...;
   ... about 50 inserts ...
   commit transaction;

then it was immediate. Why?

-- fxn




To find out more about Reuters visit www.about.reuters.com

Any views expressed in this message are those of the individual sender, except 
where the sender specifically states them to be the views of Reuters Ltd.



[sqlite] Best possible concurrency

2006-01-13 Thread Doug Nebeker
This group is a wonderful resource.  Some day I'll have enough
experience to contribute in a meaningful way... 
 
I have a small number of read and writer threads.  A few months ago I
had some deadlock issues and one simple solution was to run all
transactions as exclusive (ie BEGIN EXCLUSIVE).  That works
perfectly--no hint of deadlock.  But now that I've been using it for a
few months, I'm starting to feel the pain of serializing all calls to
the database, particularly the readers which previously were able to
overlap.
 
I've read through most of the documentation but haven't quite found the
best way to increase concurrency.  I understand that SQLITE_BUSY is
returned when a statement can't be executed because another thread has
temporarily locked the database.  What I'm trying to do is figure out
when I need to just wait and try again (my earlier approach which works
great if deadlock isn't the underlying cause) or let go of the current
resources and then try again (so that the other transaction can
complete).  And naturally, in the second case, it would be nice for both
transaction to not let go since one of them (assuming only two are
participating in the deadlock) could run to completion once the other
lets go.
 
So my questions boil down to:
1. When SQLITE_BUSY is returned, is it possible to tell if a deadlock
state has been reached?  
 
2. If I need to 'let go' of the resources/current transaction, do I:
sqlite3_finalize on the current statement which returned
SQLITE_BUSY
sqlite3_prepare("ROLLBACK TRANSACTION")
sqlite3_step
sqlite3_finalize
...wait... and then try the statement again?
 
3. Is there any kind of algorithm I could use which would direct one
thread in a deadlock to release while the other tries again (anything in
the API that would give a hint??).  Maybe looking at which lock you're
trying to get and if it is a lock of type X you always try again, but if
it is a lock of type Y you always give up immediately?
 
4. When can sqlite3_prepare return SQLITE_BUSY?  I can't think of a
case, but I know I had to write code to handle it in my previous
attempts.
 
Thank you very much in advance for any insight.
 
 
 


To find out more about Reuters visit www.about.reuters.com

Any views expressed in this message are those of the individual sender, except 
where the sender specifically states them to be the views of Reuters Ltd.



RE: [sqlite] CE locking -- review the code

2006-01-09 Thread Doug Nebeker
Two comments:

* This should only be used for Windows CE as-is.  On Windows
XP/2000/2003(?)/Terminal Services you should probably add "Global\" to
the front of the mutex name so the lock is truly system wide.
Unforunately, you'd have to query Windows to see whether that prefix
could/should be added, but that is doable.  

* Although it is unlikely, the complete mutex name could end up being
larger than MAX_PATH in which case the mutex won't be created at all.
Maybe creating a hash of the path would be safest (ie
"Global\sqlite_X4F12F9AB481727BCD" or something like that).

-Original Message-
From: Robert Simpson [mailto:[EMAIL PROTECTED] 
Sent: Saturday, January 07, 2006 5:49 PM
To: sqlite-users@sqlite.org
Subject: [sqlite] CE locking -- review the code

Attached is a pseudo-locking mechanism I wrote, intending to use it for
Windows CE.  The design goal for the code was to allow the existing
os_win.c locking code to remain intact with zero replacement coding
involved.

With that in mind, I basically implemented LockFile(), LockFileEx() and
UnlockFile() using a mutex and some shared global memory.  It is similar
in nature to Nuno Lucas's "idea" behind locking -- however, its
completely re-realized in this code.

The code is designed around SQLite's behavioral use of those API
functions and for testing purposes, does not require Windows CE to run
and test.

Please have a look at it and poke some holes in it.

Robert


To find out more about Reuters visit www.about.reuters.com

Any views expressed in this message are those of the individual sender, except 
where the sender specifically states them to be the views of Reuters Ltd.



RE: [sqlite] Threads and locking

2005-12-16 Thread Doug Nebeker
I used to have the same issue.  I finally did two things:

1. The background worker thread is at least normal priority.  If you own
the DB, you need to get in and get out.  I put sleeps in to make sure I
wasn't hitting the DB too often from this thread

2. All connections to the database happen inside a "begin exclusive"
transaction.  I'm guaranteed not to hit deadlock this way.

With those two in place, I believe you can let a busy handler spin (ie
keep trying) forever because it is guaranteed to get in sooner or later.

-Original Message-
From: Barry Paul [mailto:[EMAIL PROTECTED] 
Sent: Friday, December 16, 2005 2:20 PM
To: sqlite-users@sqlite.org
Subject: [sqlite] Threads and locking

 
Hi, I am having some unexpected locking issues with SQLite.

I have a desktop application that uses SQLite. The application has a low
priority worker thread that is constantly
analyzing/adding/updating/deleting
records in the database. The main application thread mainly reads from
the database but also does some updating/deleting. Both threads have
their own SQLite connection.
 
My problem is that when I do updates in the main application thread I
quite often fail with a return value of SQLITE_BUSY. I have messed
around with busy_timeouts and busy_handlers without much success. My
current busy handler (culled either from this list or the web) is:

int busyHandler(void *pArg1, int iPriorCalls) {

// sleep if handler has been called less than threshold value
if (iPriorCalls < 20)
{
// adding a random value here greatly reduces locking
if (pArg1 < 0)
Sleep((rand() % 500) + 400);
else Sleep(500);
return 1;
}

// have sqlite3_exec immediately return SQLITE_BUSY
return 0;
}

If I increase the transaction size on the low priority thread I get more
update failures on the main thread.

My schema is fairly simple and my tables contain < 90,000 rows. It would
seem to me that with just two threads and this busy handler I should
never (or very rarely) get SQLITE_BUSY. 
 
My theory is that the main application thread is getting locked out
because it is waiting for the low priority thread to release the lock on
the database. Meanwhile something else is happing on the machine at a
higher priority and not letting the low priority thread back in to
finish the transaction and release the lock.

Does this sound reasonable and is there a good way of dealing with this
situation?  Should I try to increase the priority of the background
thread when I get a lock? Or is there some way to make sure that
transactions in the low priority thread are executed all at once without
interruption?

Thanks for your time,

--
BP
<< www.planet-hood.com >> Welcome to our world <<
 



To find out more about Reuters visit www.about.reuters.com

Any views expressed in this message are those of the individual sender, except 
where the sender specifically states them to be the views of Reuters Ltd.



RE: [sqlite] Trying to compile under VC.NET

2005-12-14 Thread Doug Nebeker
Also be sure to #define THREADSAFE in your project settings if you'll be using 
multiple threads.



From: Mike Marshall [mailto:[EMAIL PROTECTED]
Sent: Tue 12/13/2005 2:17 AM
To: sqlite-users@sqlite.org
Subject: RE: [sqlite] Trying to compile under VC.NET



Just switch off the Using Precompiled Headers directive in the project you
are compiling

Project -> Properties -> C/C++ -> Precompiled Headers

And everything will be AOK

Mike M

-Original Message-
From: Henning Folger [mailto:[EMAIL PROTECTED]
Sent: 13 December 2005 08:08
To: sqlite-users@sqlite.org
Subject: [sqlite] Trying to compile under VC.NET

Hello,

I am happy to find sqlite. This backend fully matches my need regarding
to a projekt of mine.
But i have to make some changes to fit into my project.

So i tried to recompile the sources under VC.NET. On the web page i
found a howto to do it, but i have no luck with it.
I always get the error C1010, unexpected end of file while looking for
precompiled headers.

Is there anyone out who can help me or can send me an an howto or maybe
a dsw-File?

Thanks for your help

Henning






To find out more about Reuters visit www.about.reuters.com

Any views expressed in this message are those of the individual sender, except 
where the sender specifically states them to be the views of Reuters Ltd.



RE: [sqlite] Concurrency handling question

2005-11-30 Thread Doug Nebeker
Thanks for the input Ned--I thought there had to be more going on.  

After reading about BEGIN TRANSACTION some more, it seems like some
times my retry strategy works (a reader gets SQLITE_BUSY because a
writer is holding an exclusive lock, in which case retrying the same
sqlite3_ call later in the reader would work--and does from what I've
seen).  But once the deadlock case is hit, one must abort/rollback as
you point out.  

Is there a way to detect the deadlock situation (will SQLite return
SQLITE_LOCKED), or would it be better to retry a couple of times and
then rollback?  

Is it best to bail out by closing the database handle, or calling
sqlite3_prepare16 on a "rollback" statement and trying to execute it?

Thanks again for your time.



-Original Message-
From: Ned Batchelder [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, November 30, 2005 11:54 AM
To: sqlite-users@sqlite.org
Subject: RE: [sqlite] Concurrency handling question

You can't simply loop on retrying the last sqlite3_* call.  You need to
rollback one of the transactions and retry the entire transaction.  Your
two threads are deadlocked because (roughly) each has acquired a lock
that the other needs.  One needs to release the locks it holds.  Rolling
back is the way to do that.

--Ned.
http://nedbatchelder.com
 

-Original Message-----
From: Doug Nebeker [mailto:[EMAIL PROTECTED]
Sent: Wednesday, 30 November, 2005 11:04 AM
To: sqlite-users@sqlite.org
Subject: [sqlite] Concurrency handling question

I've written a C++ wrapper for SQLite which has been working great.
Lately though I've started getting what might be deadlocks when running
two threads against the same database.  One thread is a reader and the
other is a writer (at the moment, I'm getting 'database locked' errors,
but that's after many hours of failures so not sure where it started).
It's possible to have two or three readers and/or writers, but not more
than that.

Each thread has it's own database handle, however, I keep the database
handle open for many calls (where each 'call' opens a transaction,
executes SQL statements, then closes the transaction).

I've read about concurrency, and it sounds like the best way to work is
just to retry the last call if SQLITE_BUSY is ever returned, but that
doesn't seem to be working for me in this case.  I've stripped my main
processing loop down to make it concise (it is not completely correct
nor will it compile as shown, but it shows the flow).

Can anyone see what I'm doing wrong?  Is the fact that I keep the
database handle open between calls and between retries the problem?  If
the retry loops finally fails, sqlite3_finalize gets called,
sqlite3_close and then sqlite3_open16 to re-initialize the state.

Thanks in advance for any insight.

do
{
long prepareLoopCount = 0;

PrepareLoop:
if(SQLITE_BUSY == (res = sqlite3_prepare16(m_hDB,
nextStatement, -1, , )))
{
if(prepareLoopCount++ < 200)
{
Sleep(300 ms);
goto PrepareLoop;
}
}

if((SQLITE_OK == res) && (NULL != pStmt)) 
{
long stepLoopCount = 0;
StepLoop:
res = sqlite3_step(pStmt);
if(SQLITE_BUSY == res)
{
if(stepLoopCount++ < 200)
{
Sleep(300 ms);
goto StepLoop;
}
}
else do other processing like fetching the
rows

}

if(NULL != pStmt)
{
sqlite3_finalize(pStmt);
pStmt = NULL;
}
}
while(NULL != nextStatement)


To find out more about Reuters visit www.about.reuters.com

Any views expressed in this message are those of the individual sender,
except where the sender specifically states them to be the views of
Reuters Ltd.




To find out more about Reuters visit www.about.reuters.com

Any views expressed in this message are those of the individual sender, except 
where the sender specifically states them to be the views of Reuters Ltd.



[sqlite] Concurrency handling question

2005-11-30 Thread Doug Nebeker
I've written a C++ wrapper for SQLite which has been working great.
Lately though I've started getting what might be deadlocks when running
two threads against the same database.  One thread is a reader and the
other is a writer (at the moment, I'm getting 'database locked' errors,
but that's after many hours of failures so not sure where it started).
It's possible to have two or three readers and/or writers, but not more
than that.

Each thread has it's own database handle, however, I keep the database
handle open for many calls (where each 'call' opens a transaction,
executes SQL statements, then closes the transaction).

I've read about concurrency, and it sounds like the best way to work is
just to retry the last call if SQLITE_BUSY is ever returned, but that
doesn't seem to be working for me in this case.  I've stripped my main
processing loop down to make it concise (it is not completely correct
nor will it compile as shown, but it shows the flow).

Can anyone see what I'm doing wrong?  Is the fact that I keep the
database handle open between calls and between retries the problem?  If
the retry loops finally fails, sqlite3_finalize gets called,
sqlite3_close and then sqlite3_open16 to re-initialize the state.

Thanks in advance for any insight.

do
{
long prepareLoopCount = 0;

PrepareLoop:
if(SQLITE_BUSY == (res = sqlite3_prepare16(m_hDB,
nextStatement, -1, , )))
{
if(prepareLoopCount++ < 200)
{
Sleep(300 ms);
goto PrepareLoop;
}
}

if((SQLITE_OK == res) && (NULL != pStmt)) 
{
long stepLoopCount = 0;
StepLoop:
res = sqlite3_step(pStmt);
if(SQLITE_BUSY == res)
{
if(stepLoopCount++ < 200)
{
Sleep(300 ms);
goto StepLoop;
}
}
else do other processing like fetching the
rows

}

if(NULL != pStmt)
{
sqlite3_finalize(pStmt);
pStmt = NULL;
}
}
while(NULL != nextStatement)


To find out more about Reuters visit www.about.reuters.com

Any views expressed in this message are those of the individual sender, except 
where the sender specifically states them to be the views of Reuters Ltd.



RE: [sqlite] uSQLiteServer Source code available

2005-11-16 Thread Doug Nebeker
I'd be interested in seeing that code--there's always something to be
learned from another implementation.

For those interested, I've put my code up at:
http://www.poweradmin.com/sourcecode/index.asp  (HTTPServer.zip--you'll
see it)

I welcome any feedback.  Probably better to send it to my private
account (admin AT poweradmin DOT com) to keep from bothering the list.

-- Doug

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 15, 2005 10:48 PM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] uSQLiteServer Source code available

Doug Nebeker <[EMAIL PROTECTED]> wrote:
> I've had a number of people express interest in the small HTTP server.

> I'll work on commenting it a little better and then put it out on a 
> website in a day or two.
> 

FWIW, the www.sqlite.org website is implemented using a webserver
written as a single file of C code - 752 lines (exclusive of comments).
It's unix-specific though, and in fact really wants to run on Linux.
--
D. Richard Hipp <[EMAIL PROTECTED]>



To find out more about Reuters visit www.about.reuters.com

Any views expressed in this message are those of the individual sender, except 
where the sender specifically states them to be the views of Reuters Ltd.



RE: [sqlite] uSQLiteServer Source code available

2005-11-15 Thread Doug Nebeker
I've had a number of people express interest in the small HTTP
server.  I'll work on commenting it a little better and then
put it out on a website in a day or two. 

-Original Message-
From: Noel Frankinet [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 15, 2005 9:27 AM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] uSQLiteServer Source code available

Doug Nebeker wrote:

>I have a simple C++ HTTP server that I wrote (all in a single .cpp and 
>.h file).  Multi-threaded, has a session concept (via cookies), can 
>parse POST and GET variables.  It is a C++ class that you can derive 
>from and then override the LoadFile method (which is where I typically 
>put my command/transaction processing).  The default just serves files 
>from a defined directory.  Implemented on Windows with the Win32 API, 
>so there would be some porting to get it onto other platforms.
>
>I'd be happy to put out somewhere if anyone is interested (and I'd love 
>to receive feedback--always happy to learn from anyone).
>
>By the way, it is my personal work and not owned in any way by my 
>employer (<-- decided to put that there for my own sake...)
>
>Doug
>
>-Original Message-
>From: David Fletcher [mailto:[EMAIL PROTECTED]
>Sent: Tuesday, November 15, 2005 7:59 AM
>To: sqlite-users@sqlite.org
>Subject: RE: [sqlite] uSQLiteServer Source code available
>
>
>  
>
>>>>>>"r" == roger  <[EMAIL PROTECTED]> writes:
>>>>>>
>>>>>>
>
>r> HTTP would be the logical choice, telnet is often firewalled. BTW, 
>r> you can of course allready telnet into the server anyway.
>
>r> I will try doing something like this, but I have never implemented 
>r> the server side of a HTML connection. Do you know where I can find a 
>r> quick guide to making a simple HTTP server? Better still, what about 
>r> a small simple ready made HTTP server of the sort that can be 
>r> embedded into the application and has hooks to callback into user 
>r> code?
>
>I know that Qt has something like this, but I can't recall if this is 
>only available in the enterprise (commercial) edition or not.  Check 
>http://www.trolltech.com for more.  See 
>http://doc.trolltech.com/4.0/qhttp.html, for example.
>
>http://www.sourceforge.net has some http clients and servers, too.  A 
>search there should turn up some results.
>
>HTH
>
>  
>
Hello Doug,
I am *very* interested, I'm searching something like that for quite some time.
I have a sax like xml parser (not validating) in one .h file (C++) if somebody 
is interested !
Best regards



--
Noël Frankinet
Gistek Software SA
http://www.gistek.net



To find out more about Reuters visit www.about.reuters.com

Any views expressed in this message are those of the individual sender, except 
where the sender specifically states them to be the views of Reuters Ltd.



RE: [sqlite] uSQLiteServer Source code available

2005-11-15 Thread Doug Nebeker
I have a simple C++ HTTP server that I wrote (all in a single .cpp and
.h file).  Multi-threaded, has a session concept (via cookies), can
parse POST and GET variables.  It is a C++ class that you can derive
from and then override the LoadFile method (which is where I typically
put my command/transaction processing).  The default just serves files
from a defined directory.  Implemented on Windows with the Win32 API, so
there would be some porting to get it onto other platforms.

I'd be happy to put out somewhere if anyone is interested (and I'd love
to receive feedback--always happy to learn from anyone).

By the way, it is my personal work and not owned in any way by my
employer (<-- decided to put that there for my own sake...)

Doug

-Original Message-
From: David Fletcher [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 15, 2005 7:59 AM
To: sqlite-users@sqlite.org
Subject: RE: [sqlite] uSQLiteServer Source code available


> "r" == roger  <[EMAIL PROTECTED]> writes:

r> HTTP would be the logical choice, telnet is often firewalled. BTW, 
r> you can of course allready telnet into the server anyway.

r> I will try doing something like this, but I have never implemented 
r> the server side of a HTML connection. Do you know where I can find a 
r> quick guide to making a simple HTTP server? Better still, what about 
r> a small simple ready made HTTP server of the sort that can be 
r> embedded into the application and has hooks to callback into user 
r> code?

I know that Qt has something like this, but I can't recall if this is
only available in the enterprise (commercial) edition or not.  Check
http://www.trolltech.com for more.  See
http://doc.trolltech.com/4.0/qhttp.html, for example.

http://www.sourceforge.net has some http clients and servers, too.  A
search there should turn up some results.

HTH

-- 
David Fletcher  Tuscany Design Automation, Inc.
[EMAIL PROTECTED] 5875 S. Danube Circle
Aurora, CO 80015-3169 USA


To find out more about Reuters visit www.about.reuters.com

Any views expressed in this message are those of the individual sender, except 
where the sender specifically states them to be the views of Reuters Ltd.