Re: [sqlite] Errors on release mode during link

2004-03-17 Thread Mike Marshall
I'm guessing you have a mismatch on the code generation for the sqlite lib
and the server component.  Thats what normally causes that sort of error in
VC.

Mike M


- Original Message - 
From: "Vanessa V. Nihues" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, March 17, 2004 8:03 PM
Subject: [sqlite] Errors on release mode during link


> Hi,
>
> I have a client/server aplication. I compiled sqlite into a lib and
> linked it in the client aplication with success. When I linked the
> server side, errors happened. In the debug mode I solved the problem but
> in the release mode I made the same changes from debug but the errors
> persist.
> The first errors were:
>
> Configuration: MTCPAcessorioS - Win32 Release
> MinDependency
> Linking...
> libc.lib(atox.obj) : error LNK2005: _atol already defined in
> msvcrt.lib(MSVCRT.dll)
> libc.lib(crt0dat.obj) : error LNK2005: _exit already defined in
> msvcrt.lib(MSVCRT.dll)
> libc.lib(crt0dat.obj) : error LNK2005: __exit already defined in
> msvcrt.lib(MSVCRT.dll)
> libc.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in
> msvcrt.lib(cinitexe.obj)
> libc.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in
> msvcrt.lib(cinitexe.obj)
> libc.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in
> msvcrt.lib(cinitexe.obj)
> libc.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in
> msvcrt.lib(cinitexe.obj)
> LINK : warning LNK4098: defaultlib "msvcrt.lib" conflicts with use of
> other libs; use /NODEFAULTLIB:library
> msvcrt.lib(cinitexe.obj) : warning LNK4098: defaultlib "libc.lib"
> conflicts with use of other libs; use /NODEFAULTLIB:library
> libc.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
> \Release\CP\MTCPAcessorioS\MTCPAcessorioS.exe : fatal error LNK1120: 1
> unresolved externals
> Error executing link.exe.
>
> MTCPAcessorioS.exe - 9 error(s), 2 warning(s)
>
>
> I changed project settings, in the link tab, to ignore msvcrt.lib. In
> the debug mode it solved the problem. But in the release mode I had the
> following problems:
>
> Configuration: MTCPAcessorioS - Win32 Release
> MinDependency
> Linking...
> LINK : warning LNK4049: locally defined symbol "_strncpy" imported
> LINK : warning LNK4049: locally defined symbol "_atol" imported
> LINK : warning LNK4049: locally defined symbol "_free" imported
> LINK : warning LNK4049: locally defined symbol "_malloc" imported
> LINK : warning LNK4049: locally defined symbol "_realloc" imported
> ADOModule.obj : error LNK2001: unresolved external symbol __imp___mbscmp
> \Release\CP\MTCPAcessorioS\MTCPAcessorioS.exe : fatal error LNK1120: 1
> unresolved externals
> Error executing link.exe.
>
> MTCPAcessorioS.exe - 2 error(s), 5 warning(s)
>
>
> What can I do to solve this problem? I am compiling in Microsoft Visual
> C++ 6.0 and the project options are:
>
> /nologo /MD /W3 /GR /GX /O1 /D "NDEBUG" /D "_MBCS" /D
> "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /D "_GXDLL" /D "WIN32" /D
> "_WINDOWS" /D "_AFXDLL"
> /Fp"\Release\CP\MTCPAcessorioS\MTCPAcessorioS.pch" /Yu"stdafx.h"
> /Fo"\Release\CP\MTCPAcessorioS\\" /Fd"\Release\CP\MTCPAcessorioS\\" /FD
>
>
> Thanks in advance,
> Vanessa
>


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [sqlite] more performance questions

2004-03-17 Thread dave
On Mar 17, 2004, at 5:44 PM, D. Richard Hipp wrote:

Dave Hayden wrote:
> I'm inserting a bunch of data loaded off the network into a table. 
Here at
> the office, SQLite keeps up pretty well; at home on the cable modem, 
it's a
> huge bottleneck.

Is the database file on a network filesystem?  If so, that is
probably the cause of your problem.
Nope, it's all local to the app. I should have noted that I'm trying to 
insert some 1,000 rows a second, with about 200-300 bytes per row--it's 
overview data from an NNTP server. Also, FWIW, this is on OS X and I've 
bumped the page size up to 4096 since that's the memory page size (I 
think), and the rows were exactly the wrong size for the default--pages 
could only hold one row, so I was using about 4x as much disk space as 
I needed.

Is 200K/s unreasonable for SQLite on a modern-ish (1GHz G4 powerbook) 
machine? When I sample the app I see that it's spending most of its 
time on the filesystem--unlink, read, open, write. I was hoping there 
would be an easy way to turn off journaling so I could see how much of 
the disk access was from that..

-D

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: [sqlite] Getting max column on empty table

2004-03-17 Thread Kurt Welgehausen
Instead of

(select max(c) from t where n=20)+1

try

select coalesce(max(c)+1, 1) from t where n = 20

Regards

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[sqlite] Getting max column on empty table

2004-03-17 Thread Steve Palmer
If I have a table that is empty and I want to compute an incrementing value in a 
non-unique column (I cannot use integer primary key since the column value won't be 
unique):

(select max(c) from t where n=20)+1

where c is unique only within (n==20), then this works as long as the table has at 
least one row where c is an integer value. However if the table is empty then max(c) 
is an empty string and the +1 causes a SQL error. Here's the example:

sqlite> create table t (c integer);
sqlite> insert into t (c) values ((select max(c) from t)+1);
sqlite> select * from t;

sqlite> insert into t (c) values (1);
sqlite> select * from t;

1
sqlite> insert into t (c) values ((select max(c) from t)+1);
sqlite> select * from t;

1
2
sqlite> 

Is there a workaround so I don't need to seed the table with a specific value for c in 
the first place?
Thanks!


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: [sqlite] performance question

2004-03-17 Thread Williams, Ken

> On my PC the following query requires about 53 seconds:
> select * from TABG a, TABB b where (a.S='3' or a.S='12 or...) and 
> b.G=a.G order by a.G asc;
> 
> (On Oracle with the same scheme and data it requires only 0.4 
> seconds.)

In my experience, even though SQLite has very low overhead and is pretty
lightweight, performance can get hurt pretty badly for complicated queries
(or even fairly simple ones like yours) when it chooses the wrong
optimization paths.

I've had situations where changing "SELECT ... FROM table1, table2 ..." to
"SELECT ... FROM table2, table1 ..." makes an enormous difference in
execution time, because when SQLite has more than one index to choose from,
it seems to choose randomly.  Sometimes it's wrong, and sometimes quite
badly so.

This is why many other DBMs put a lot of effort into developing things like
cost-based optimizers, so these kinds of issues can be dealt with nicely.
I'm not sure if SQLite plans to add such things, but I'm not sure it fits
with the stated goals of simplicity.

So I guess the moral is that when performance gets slow, you really have to
scrutinize the execution plans in SQLite more than in other databases I'm
used to, rather than just adding indexes you *think* should help and
trusting the database to do the "right" thing.

 -Ken

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [sqlite] SQLite & Big Database

2004-03-17 Thread Mateusz Łoskot
In 03/17/2004 09:36 PM, Puneet Kishor wrote:
Mateusz Łoskot wrote:
[...]
I am assuming that means it is a good thing. ;-)
Certainly.

--
Mateusz Łoskot, mateusz at loskot dot net
GNU/Linux (Slackware 9.1) http://counter.li.org #220771
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: [sqlite] SQLite for Win32 TCHAR

2004-03-17 Thread Mateusz Łoskot
Hi,

In 03/17/2004 07:35 AM, Nuno Lucas wrote:
For the original poster:
If you want a hint on how to do your wraping, 
> see the help on mbstowcs/wcstombs functions of the C runtime,
> or MultiByteToWideChar/WideCharToMultiByte in the Win32 API.
That's right. Nuno gives you a great hint.
I'm using his sqlite WinCE port (that maintained on SF.net) and
I wrote a small wprapper classes which do a ASCII <-> UNICODE
conversion using MultiByteToWideChar/WideCharToMultiByte API calls.
My wrapper uses string from STLPort by Giuseppe Govi
(look at http://www.pocketpcdn.com/ ) internally and every string
going out my wrapper is converted into TCHAR, LPTSTR or - what is
even better -  to WTL::CString class objects (which also provides some
conversions if needed).
Kind regards

--
Mateusz Łoskot, mateusz at loskot dot net
GNU/Linux (Slackware 9.1) http://counter.li.org #220771
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


[sqlite] SQLite & Big Database

2004-03-17 Thread Mateusz Łoskot
Hi,

I'm using SQLite for some time, mainly on Windows CE but
on Linux and Windows 2000 too.
My databases are not very big and they consist of about 10-30 tables.
Now, I'm going to move one of my big database currently in MDB format
that consists of about 110 tables and some of them stores a few tousends
records. There are mainly numerical data in my database stored.
So, has anyone work with such big databases in SQLite ?
I'm looking for some hints and tips about that.
I've just moved one table from my "Big" database. There are about 11000
of records and as I see SQLite database takes about 2,7 MB.
Kind regards

--
Mateusz Łoskot, mateusz at loskot dot net
GNU/Linux (Slackware 9.1) http://counter.li.org #220771
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: [sqlite] aliasing columns in views

2004-03-17 Thread Puneet Kishor
Andre Vehreschild wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi,

you're sure this command resulted not in an error. As far as I understand the 
documentation the VIEW keyword is mandatory when creating a view. So this 
should be:


CREATE VIEW qry_contacts AS
 


My apologies... that was a typo on my part in the email. Indeed, I did use

CREATE VIEW qry_contacts AS...

So, the problem remains...




SELECT c.contact_id, c.firstname, c.lastname,
(CASE
WHEN
(c.firstname & c.lastname) ISNULL
THEN
'unnamed'
ELSE
(c.firstname & ' ' & c.lastname)
END) AS fullname,
ct.contacttype
FROM contacts c LEFT JOIN contacttypes ct ON
c.contact_id = ct.contact_id;


Just a first guess of an other newbie...

Greets,
	Andre
- -- 
Andre Vehreschild -- Institute for Scientific Computing, RWTH Aachen Univ.
mailto:[EMAIL PROTECTED] , phone: ++49- 241- 80- 24874
GnuPG-key available at http://www.sc.rwth-aachen.de/vehreschild
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQFAWHJ8zVF62HujQtARAo8RAJ9siHv0Plf5lTwaZxi7IZQ9Ef3MtQCfaX8E
W/HO6ZtyEGx0TS8XaAgKmDU=
=1FCA
-END PGP SIGNATURE-



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: [sqlite] performance question

2004-03-17 Thread godot
Hi,

> I have a question about the performance of my SQLite DB, where the
> db-file has about 20MB and which I use in a Java application via the
> Java wrapper.

First, your timing figures look indeed slower than what I would expect
(using a somewhat similar DB in type and size and a similar select even on
an embedded system)

The Java wrapper might be your first suspective.
Did you try the command line program as a reference?

> TABB has 14785 rows, TABG 7111 rows.
> On my PC the following query requires about 53 seconds:
> select * from TABG a, TABB b where (a.S='3' or a.S='12 or...) and
> b.G=a.G order by a.G asc;

Depending upon how many "or" conditions you have, you might try ot use
the "in" keyword. (Although I would not expect much improvement)

> The times are used only for the query, not connecting etc. I guess it
> has something to do with building up the data structures for the first
> query resp. caching.

I do not think the behaviour you see is sqlite-internal, I would suspect
the Java wrapper.

How large is the output of your selection?
Maybe it is just the transfer (socket, whatever) which takes so much time.

Regards,

Frank Baumgart


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [sqlite] aliasing columns in views

2004-03-17 Thread Andre Vehreschild
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi,

you're sure this command resulted not in an error. As far as I understand the 
documentation the VIEW keyword is mandatory when creating a view. So this 
should be:

> CREATE VIEW qry_contacts AS
 
> SELECT c.contact_id, c.firstname, c.lastname,
> (CASE
>   WHEN
>   (c.firstname & c.lastname) ISNULL
>   THEN
>   'unnamed'
>   ELSE
>   (c.firstname & ' ' & c.lastname)
> END) AS fullname,
> ct.contacttype
> FROM contacts c LEFT JOIN contacttypes ct ON
> c.contact_id = ct.contact_id;

Just a first guess of an other newbie...

Greets,
Andre
- -- 
Andre Vehreschild -- Institute for Scientific Computing, RWTH Aachen Univ.
mailto:[EMAIL PROTECTED] , phone: ++49- 241- 80- 24874
GnuPG-key available at http://www.sc.rwth-aachen.de/vehreschild
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQFAWHJ8zVF62HujQtARAo8RAJ9siHv0Plf5lTwaZxi7IZQ9Ef3MtQCfaX8E
W/HO6ZtyEGx0TS8XaAgKmDU=
=1FCA
-END PGP SIGNATURE-



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [sqlite] SQLite quite popular

2004-03-17 Thread Chris Sebrell

I just recently found out about SQLite from a copy of the C/C++ Users
Journal that a co-worker left on my desk.  After reading just the first
couple paragraphs of the article I said "Shazam!  Just what I was looking
for all this time!".. I'm sure lots of other people have discovered it
recently the same way.

Cheers!
// CHRIS

- Original Message - 
From: "Greg Obleshchuk" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, March 17, 2004 3:45 AM
Subject: [sqlite] SQLite quite popular


Hi Guys,
I just wanted everyone to know that SQLite is a very popular piece of
software.  I don't what Dr R stats are on downloads but from my site (I have
two SQlite Wrappers), in the past 10 days I have had 290 downloads.  The
SQlite pages out hit any of my other pages on my web site, 4000 - 5000 per
month.

I think everyone who contributes to this software should pat themselves on
the back, were all doing a great job and I hope it continues.

Richard you should be very proud of this piece of software.

Greg


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[sqlite] how to switch to asynchronous mode?

2004-03-17 Thread boysen
Hi,

I just converted a DB from Oracle to SQLite and am now trying to improve
  the performance. On the performance comparison page of the sqlite.org
website I read about an asynchronous mode, which performed faster in
many cases.
How can I switch SQLite to asynchronous mode?

Thanks in advance,
Bo
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: [sqlite] SQLite for Win32 TCHAR

2004-03-17 Thread Michael Smith
This is to clarify what I meant:
 
I would like to know if anyone has modified sqlite so that it entirely works
with TCHAR, either when it is typedef'd as unsigned short or char (per
UNICODE).  
 
This is an example of what I would like to see:
 
sqlite *sqlite_open(LPTCSTR filename, int mode, LPTSTR* errmsg);
 
typedef int (*sqlite_callback)(void*,int,LPTSTR*, LPTSTR*);
 
int sqlite_exec(sqlite*,  LPCTSTR sql,  sqlite_callback,  void *, LPTSTR
*errmsg);
 
and following this the underlying code fully supports TCHAR all down to the
functions in os.c.
 
In studying the code I realize its not a simple task and it may not even be
possible or desirable considering the logic which supports UTF8 throughout.
Other sources of concern are buffer sizes and how the changes would affect
read/write performance etc
 
Thanks for your feedback to this point,
 
Mike Smith
 
 
 
 

-Original Message-
From: Steven Van Ingelgem [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 17, 2004 1:27 AM
To: Andrew Francis; Michael Smith
Cc: [EMAIL PROTECTED]
Subject: Re: [sqlite] SQLite for Win32 TCHAR


I understand what he means... 

I am using SQLite 2.8.11 and I did notice this too... Some Win32 fucntions
should have 'A' attached to the end. This way it does not complain when
using SQLite embedded in a UNICODE project.

[ I even think I submitted a diff with things you would have to change to
have absolutely no warnings any more (for a Win32 unicode build that is)]


greets...

At 06:11 17/03/2004, Andrew Francis wrote:


Michael Smith wrote:



Has anyone ported the SQLite code to support the Win32 TCHAR type and API?


I'll confess I'm not actually sure what you mean by "ported" - do you mean
using TCHAR (which is, btw, just a typedef for char or short depending on
whether UNICODE is #define'd) in the sqlite library interface, or using
TCHAR for Win32 calls?

Regardless, I'd start by looking at the sqlite ports to Windows CE /
PocketPC. From memory, there are a couple around. Windows CE provides only
Unicode versions of the Win32 functions, so generally WinCE code has to be
TCHAR/Unicode 'clean.'

-- 
Andrew Francis
Software Developer
Family Health Software


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



G00fy, (aka KaReL, aka Steven)

Main Webpage : http://komma.cjb.net  
CQ Database  : http://lid.fragland.net/  
ICQ #: 35217584




Re: [sqlite] SQLite quite popular

2004-03-17 Thread D. Richard Hipp
Greg Obleshchuk wrote:
I don't [know] what Dr R stats are on downloads...

Stats from this morning are shown below.  These stats are for
the website at http://www.sqlite.org/.  The mirror site at
http://www.hwaci.com/sw/sqlite/ gets about the same amount of
traffic, but because that is a hosted site, I don't have as
much detail on it.
Note that as of this past Friday, http://www.sqlite.org/ and
http://www.cvstrac.org/ resolve to the same IP address and
use the same web server.
 20 largest cumulative downloads in the past 48 hours 
count   outbound  url
--    --
450 300892810 http://www.sqlite.org/sqlite-2.8.13.tar.gz
347 34133732  http://www.sqlite.org/lang.html
471 33127057  http://www.sqlite.org/cvstrac/timeline
108 30789252  http://www.sqlite.org/sqlite_source.zip
330023298815  http://www.sqlite.org/cvstrac/wiki
180 19568768  http://www.sqlite.org/sqlite.zip
23  15588109  http://www.sqlite.org/sqlite-2.8.13-1.src.rpm
19  15068645  http://www.sqlite.org/sqlite-2.8.12.tar.gz
179413747800  http://www.sqlite.org/
16  13404324  http://sqlite.org/sqlite-2.8.13.tar.gz
122 11929818  http://www.sqlite.org/sqlitedll.zip
140 11254134  http://www.sqlite.org/cvstrac/rptview
241 10451035  http://www.sqlite.org/c_interface.html
537 8462184   http://www.sqlite.org/cvstrac/chngview
34  7313212   http://www.sqlite.org/sqlite.bin.gz
276 7068042   http://www.sqlite.org/sqlite.html
17156283401   http://www.sqlite.org/cvstrac/tktview
23  5914300   http://www.cvstrac.org/cvstrac.bin.gz
42  5758294   http://www.cvstrac.org/cvstrac-src.tar.gz
30  5756330   http://www.sqlite.org/vdbe.html
 20 most common downloads in the past 48 hours 
count   outbound  url
--    --
330023298815  http://www.sqlite.org/cvstrac/wiki
22713152148   http://www.sqlite.org/goback.jpg
179413747800  http://www.sqlite.org/
17156283401   http://www.sqlite.org/cvstrac/tktview
850 171700http://www.sqlite.org/favicon.ico
791 3850618   http://www.sqlite.org/cvstrac/tktedit
633 3515214   http://www.cvstrac.org/cvstrac/wiki
599 3022554   http://www.sqlite.org/download.html
537 8462184   http://www.sqlite.org/cvstrac/chngview
471 33127057  http://www.sqlite.org/cvstrac/timeline
450 300892810 http://www.sqlite.org/sqlite-2.8.13.tar.gz
437 71668 http://www.sqlite.org/cvstrac/dot.gif
357 58905 http://www.sqlite.org/cvstrac/x.gif
355 58575 http://www.sqlite.org/cvstrac/ck.gif
352 51392 http://www.sqlite.org/cvstrac/star.gif
351 47034 http://www.sqlite.org/cvstrac/box.gif
350 50400 http://www.sqlite.org/cvstrac/ptr1.gif
349 49907 http://www.sqlite.org/cvstrac/arrow.gif
347 34133732  http://www.sqlite.org/lang.html
338 878900http://www.cvstrac.org/
date  IPs   hits  inbound  outbound
      ---  --
2004-03-011709  11996 4524710  421643023
2004-03-021585  14047 4988335  360977097
2004-03-031543  20632 7510685  332113699
2004-03-041612  11604 4274696  300777219
2004-03-051505  11899 4775890  268497459
2004-03-061107  8019  2863309  187142731
2004-03-071220  8700  3108087  191822702
2004-03-082122  17950 6522889  480673066
2004-03-092102  16735 6326259  467134426
2004-03-101812  13738 5295061  378162361
2004-03-111796  13700 5033992  354953915
2004-03-121659  12323 4585398  277006886
2004-03-131261  11590 4243367  184798785
2004-03-141167  10280 4097592  227577196
2004-03-152039  19412 7205114  378470598
2004-03-161919  15876 5959467  419523949
--
D. Richard Hipp -- [EMAIL PROTECTED] -- 704.948.4565
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]