Re: [sqlite] SqLite - Help

2011-08-17 Thread Pavel Ivanov
> Is it possible to create Storedprocedure or Functions in Sqlite. ? No. > Since i am new to Sqlite. Can u suggest some best sites or links to learn > Sqlite (ofcourse i saw Sqlite.org site) Other than sqlite.org you can look at google.com. It is usually very good at finding answers on

[sqlite] SqLite - Help

2011-08-17 Thread Madhankumar Rajaram
Hi, I am new to Sqlite. I need to develop a Desktop windows application C# with Sqlite. Is it possible to create Storedprocedure or Functions in Sqlite. ? If so, can you send me an example for both. Since i am new to Sqlite. Can u suggest some best sites or links to learn Sqlite

Re: [sqlite] Sqlite help

2011-07-10 Thread Jan Hudec
On Tue, Jul 05, 2011 at 00:30:31 +0200, Wolfgang Enzinger wrote: > Am Mon, 4 Jul 2011 14:45:07 -0700 (PDT) schrieb ceekayCK: > > unfortunately send me a .doc file > > You're at a loss there. Your friend could as well print this file and send > you the printer output, essentially that would make

Re: [sqlite] Sqlite help

2011-07-04 Thread ceekayCK
in tables called "tracks" So what sqlite command i must write that sqlite would automatically compare and put imported csv data with all collection to "playlist1"? -- View this message in context: http://old.nabble.com/Sqlite-help-tp31992826p31993464.html Sent from the SQLit

Re: [sqlite] Sqlite help

2011-07-04 Thread Wolfgang Enzinger
Am Mon, 4 Jul 2011 16:10:10 -0700 (PDT) schrieb ceekayCK: > It was quite easy to export to csv (using excel) :) > Now i have in one column Artist , and in second column Title Fine. :-) > Ok So i use sqlite Manager in Firefox Unfortunately, I'm not too familiar with SQLite Manager. > What

Re: [sqlite] Sqlite help

2011-07-04 Thread ceekayCK
, and in second column Title Ok So i use sqlite Manager in Firefox In my database i have one Table called "tracks" Structure is Column ID, Name, Type, Name are Artist Type Text Title Text What should I do next? Wolfgang will u help me? -- View this message in context: http://old.nabble.

Re: [sqlite] Sqlite help

2011-07-04 Thread Wolfgang Enzinger
Am Mon, 4 Jul 2011 15:39:30 -0700 (PDT) schrieb ceekayCK: > If i changed .doc file to .txt or csv, will this help? > Or put all data from .doc to excel, and then split Artist and title to > separate columns and export to csv? *If* you can manage a reasonable export to .csv (using Excel, if

Re: [sqlite] Sqlite help

2011-07-04 Thread ceekayCK
tle to separate columns and export to csv? -- View this message in context: http://old.nabble.com/Sqlite-help-tp31992826p31993160.html Sent from the SQLite mailing list archive at Nabble.com. ___ sqlite-users mailing list sqlite-users@sqlite.org h

Re: [sqlite] Sqlite help

2011-07-04 Thread Wolfgang Enzinger
Am Mon, 4 Jul 2011 14:45:07 -0700 (PDT) schrieb ceekayCK: > unfortunately send me a .doc file You're at a loss there. Your friend could as well print this file and send you the printer output, essentially that would make no difference. A .doc file is basically a load of printer instructions,

[sqlite] Sqlite help

2011-07-04 Thread ceekayCK
command in sqlite that will help me to choose automatically with a whole database identified 800 songs? If so, what commands should I use? Please please help :) -- View this message in context: http://old.nabble.com/Sqlite-help-tp31992826p31992826.html Sent from the SQLite mailing list archive

Re: [sqlite] Help needed for SQLite PHP

2011-07-04 Thread Kees Nuyt
Just FYI: James told me in private mail " SQLiteDatabase is not working for sqlite3,  I changed the open script to:  $dbh = new PDO('sqlite:yourdatabase.db'); Now it is working. " On Sun, 03 Jul 2011 16:08:24 +0200, Kees Nuyt wrote: >On Sun, 3 Jul 2011 06:47:26 -0700

Re: [sqlite] Help needed for SQLite PHP

2011-07-03 Thread Kees Nuyt
On Sun, 3 Jul 2011 06:47:26 -0700 (PDT), James_21th wrote: >Dear experts, > >I was quite excited when I see such a nice portable database---SQLite,  which >can be installed locally. > >However, when I tried to open the SQLite DB with PHP, just a simple open >script >will

Re: [sqlite] Help needed for SQLite PHP

2011-07-03 Thread Simon Slavin
On 3 Jul 2011, at 2:47pm, James_21th wrote: > 20110703:054052 WARN: function 'pcntl_fork' not available > 20110703:054052 WARN: function 'posix_setuid' not available These functions aren't available under Windows. I'm guessing from the context that the SQLite API you're using depends on them.

[sqlite] Help needed for SQLite PHP

2011-07-03 Thread James_21th
Dear experts, I was quite excited when I see such a nice portable database---SQLite,  which can be installed locally. However, when I tried to open the SQLite DB with PHP, just a simple open script will cause "HTTP 500 Internl server error", my web server is running fine with normal php code.

Re: [sqlite] help needed to optimize a query

2011-06-28 Thread Lazarus 101
On Tue, Jun 28, 2011 at 8:18 PM, Jan Hudec wrote: > > name TEXT > > > > DATA > > file_id INTEGER REFERENCES files(resource_id) ON DELETE CASCADE, > > data_type TEXT, > > If nothing else, you want to define integer identifiers for the data types > and use integer here. That will save

Re: [sqlite] help needed to optimize a query

2011-06-28 Thread Simon Slavin
On 29 Jun 2011, at 2:26am, Lazarus 101 wrote: > the select statement is > SELECT * from files left join data on files.file_id=data.file_id; So you read all the records for the correct file_id, and deal with each one as you find it, ignoring those you don't want. Hmm. I don't see why your

Re: [sqlite] help needed to optimize a query

2011-06-28 Thread Lazarus 101
the select statement is SELECT * from files left join data on files.file_id=data.file_id; to test the performance i'm only doing long t1 = System.currentTimeMillis(); Cursor cursor = db.rawQuery(...); while (cursor.moveToNext()) { } android.util.Log.e(TAG, "loaded in: " +

Re: [sqlite] help needed to optimize a query

2011-06-28 Thread Simon Slavin
On 28 Jun 2011, at 9:58pm, Lazarus 101 wrote: >> You should make an index on the columns 'file_id' and 'data_type' from the >> 'DATA' table. This will allow it to be searched far more quickly. Your >> command will be something like >> >> CREATE UNIQUE INDEX dfd ON data (file_id,data_type) >>

Re: [sqlite] help needed to optimize a query

2011-06-28 Thread Lazarus 101
On Tue, Jun 28, 2011 at 8:18 PM, Jan Hudec wrote: > On Tue, Jun 28, 2011 at 17:33:23 +0300, Lazarus 101 wrote: > > Hi guys, i'm working on an Android app and using sqlite to store some > data > > and i need some help with a query. > > > > I have the following table structure: > > >

Re: [sqlite] help needed to optimize a query

2011-06-28 Thread Lazarus 101
On Tue, Jun 28, 2011 at 5:48 PM, Simon Slavin wrote: > > On 28 Jun 2011, at 3:33pm, Lazarus 101 wrote: > > > FILES > > file_id INTEGER NOT NULL, > > name TEXT > > I assume that SQLite has identified 'file_id' as its own 'rowid' column and > made in INDEX for it. > it's

Re: [sqlite] help needed to optimize a query

2011-06-28 Thread Jan Hudec
On Tue, Jun 28, 2011 at 17:33:23 +0300, Lazarus 101 wrote: > Hi guys, i'm working on an Android app and using sqlite to store some data > and i need some help with a query. > > I have the following table structure: > > FILES > file_id INTEGER NOT NULL, Do file_ids

Re: [sqlite] help needed to optimize a query

2011-06-28 Thread Simon Slavin
On 28 Jun 2011, at 3:33pm, Lazarus 101 wrote: > FILES > file_id INTEGER NOT NULL, > name TEXT I assume that SQLite has identified 'file_id' as its own 'rowid' column and made in INDEX for it. > DATA > file_id INTEGER REFERENCES files(resource_id) ON DELETE CASCADE, > data_type TEXT, > value

Re: [sqlite] help needed to optimize a query

2011-06-28 Thread Pavel Ivanov
> This has to run as fast as possible. A left join between these tables is too > slow, for 10.000 entries it takes around 15 seconds just to navigate through > the cursor, if I add a where clause selecting only one kind of data then it > reduces to less than 5 seconds which is acceptable. What

[sqlite] help needed to optimize a query

2011-06-28 Thread Lazarus 101
Hi guys, i'm working on an Android app and using sqlite to store some data and i need some help with a query. I have the following table structure: FILES file_id INTEGER NOT NULL, name TEXT DATA file_id INTEGER REFERENCES files(resource_id) ON DELETE CASCADE, data_type TEXT, value TEXT

Re: [sqlite] Help sqlite database corruption

2011-06-21 Thread Black, Michael (IS)
...@sqlite.org] on behalf of Singh, Manpreet [manpreet.sing...@ca.com] Sent: Tuesday, June 21, 2011 2:55 AM To: sqlite-...@sqlite.org; sqlite-users@sqlite.org Subject: EXT :Re: [sqlite] Help sqlite database corruption Anyone with clues to the problem "malformed disk image"? F

Re: [sqlite] Help sqlite database corruption

2011-06-21 Thread Singh, Manpreet
Anyone with clues to the problem "malformed disk image"? From: Singh, Manpreet Sent: Tuesday, May 24, 2011 3:10 PM To: sqlite-...@sqlite.org; d...@hwaci.com; sqlite-users@sqlite.org Cc: Singh, Abhijeet; Singh, Satbeer; Prasanth, Neelapalem Subject: RE: Help sqlite database corruption

Re: [sqlite] Help with CASE WHEN

2011-06-19 Thread jose isaias cabrera
"Mr. Puneet Kishor" wrote... > > On Jun 19, 2011, at 10:04 PM, jose isaias cabrera wrote: > >> "Mr. Puneet Kishor" wrote... >>> >>> On Jun 19, 2011, at 5:12 PM, jose isaias cabrera wrote: >>> "Nico Williams" wrote... > On Fri, Jun 17, 2011 at 5:05 PM, Mr. Puneet Kishor >

Re: [sqlite] Help with CASE WHEN

2011-06-19 Thread Mr. Puneet Kishor
On Jun 19, 2011, at 10:04 PM, jose isaias cabrera wrote: > "Mr. Puneet Kishor" wrote... >> >> On Jun 19, 2011, at 5:12 PM, jose isaias cabrera wrote: >> >>> >>> "Nico Williams" wrote... >>> On Fri, Jun 17, 2011 at 5:05 PM, Mr. Puneet Kishor wrote: > The

Re: [sqlite] Help with CASE WHEN

2011-06-19 Thread jose isaias cabrera
"Mr. Puneet Kishor" wrote... > > On Jun 19, 2011, at 5:12 PM, jose isaias cabrera wrote: > >> >> "Nico Williams" wrote... >> >>> On Fri, Jun 17, 2011 at 5:05 PM, Mr. Puneet Kishor >>> wrote: The above is not SQL. You can't have a SQL statement begin with CASE. SQL

Re: [sqlite] Help with CASE WHEN

2011-06-19 Thread Mr. Puneet Kishor
On Jun 19, 2011, at 5:12 PM, jose isaias cabrera wrote: > > "Nico Williams" wrote... > >> On Fri, Jun 17, 2011 at 5:05 PM, Mr. Puneet Kishor >> wrote: >>> The above is not SQL. You can't have a SQL statement begin with CASE. SQL >>> statements can only begin with either

Re: [sqlite] Help with CASE WHEN

2011-06-19 Thread jose isaias cabrera
"Nico Williams" wrote... > On Fri, Jun 17, 2011 at 5:05 PM, Mr. Puneet Kishor > wrote: >> The above is not SQL. You can't have a SQL statement begin with CASE. SQL >> statements can only begin with either SELECT or UPDATE or CREATE or >> DELETE or ALTER, etc. CASE is an

Re: [sqlite] help with a query using between with a select staement

2011-06-19 Thread Petite Abeille
On Jun 19, 2011, at 12:06 PM, looki wrote: > and a table 'foods' which also holds a 'time' column and i now want to know > all entries in foods which time is between one of the times in t. for example: select foods.id fromfoods where exists (select 1 from symptoms where foods.time between

[sqlite] help with a query using between with a select staement

2011-06-19 Thread looki
Hi, i have a select stamement which holds two dates, something like: 2011-12-31 09:002011-12-30 21:00 2011-12-31 18:002011-12-31 06:00 ... let me call this t. and a table 'foods' which also holds a 'time' column and i now want to know all entries in foods which

Re: [sqlite] Help with CASE WHEN

2011-06-17 Thread Nico Williams
On Fri, Jun 17, 2011 at 5:05 PM, Mr. Puneet Kishor wrote: > The above is not SQL. You can't have a SQL statement begin with CASE. SQL > statements can only begin with either SELECT or UPDATE or CREATE or DELETE or > ALTER, etc. CASE is an expression, and has to be a

Re: [sqlite] Help with CASE WHEN

2011-06-17 Thread Mr. Puneet Kishor
On Jun 17, 2011, at 4:56 PM, jose isaias cabrera wrote: > CASE (SELECT round(sum(Xtra8),2) FROM LSOpenJobs > WHERE subProjID = 9144 AND lang = 'ES-LA' > AND PSubClass != 'Portal-Fee') > > WHEN < 5000 THEN >UPDATE LSOpenJobs SET ProjFund = (SELECT

[sqlite] Help with CASE WHEN

2011-06-17 Thread jose isaias cabrera
Greetings. I have used CASE before, but for simple codes and it works. However, I am trying to break down some calculations and it-s not working. I am getting, ...> ...> END; Error: near "CASE": syntax error sqlite> COMMIT TRANSACTION; Error: cannot commit - no transaction is active

Re: [sqlite] HELP: SQLException getErrorCode vs gerErrorMessage()

2011-06-08 Thread Jim Morris
I've only used the xerial driver recently and haven't checked for the error code on exception. It does come with source, so you may be able to walk into the code to see how the value is set/retrieved. ___ sqlite-users mailing list

Re: [sqlite] HELP: SQLException getErrorCode vs gerErrorMessage()

2011-06-08 Thread Sridhar Polavarapu
Any one with java/JDBC experience please have a look at the snippet and let me know why I am not able to get the exact errorCode. Thanks Sridhar On 08-06-2011 21:23, Martin.Engelschalk wrote: > Hi, > > The important information is that you seem to use a JDBC driver. > Maybe someone with

Re: [sqlite] HELP: SQLException getErrorCode vs gerErrorMessage()

2011-06-08 Thread Sridhar Polavarapu
I am on windows 7 and this is my test code try { Statement stat = mconn.createStatement(); stat.execute(sql); resultSet = stat.getResultSet(); mconn.close(); break; } catch (SQLException e) {

Re: [sqlite] HELP: SQLException getErrorCode vs gerErrorMessage()

2011-06-08 Thread Martin.Engelschalk
Hello Sridhar, please tell us more: what interface are you using? what OS? SQLException is not a part of the sqlite library, so obviously you use an additional layer. Martin Am 08.06.2011 16:44, schrieb Sridhar Polavarapu: > Appreciate if anyone can help me. > > Thanks > Sridhar > > On

Re: [sqlite] HELP: SQLException getErrorCode vs gerErrorMessage()

2011-06-08 Thread Sridhar Polavarapu
Appreciate if anyone can help me. Thanks Sridhar On 08-06-2011 16:16, Sridhar Polavarapu wrote: > Hi > > I am using getErrorCode() of SQLException to see if the exception is > due to any database lock. I all the time get Errorcode to be 0 even > though the getMessage is returning different

[sqlite] HELP: SQLException getErrorCode vs gerErrorMessage()

2011-06-08 Thread Sridhar Polavarapu
Hi I am using getErrorCode() of SQLException to see if the exception is due to any database lock. I all the time get Errorcode to be 0 even though the getMessage is returning different messages. Can anyone let me know if there is some thing that i need to do to get the error codes correctly ?

Re: [sqlite] HELP: sqlite queries execute faster in sqlite manager addon but take a lot of time to execute using a java program

2011-06-06 Thread Sridhar Polavarapu
Changing the driver helped in improving the performance drastically. Sridhar On 03-06-2011 20:05, Sridhar Polavarapu wrote: > This is not any update or insert statement. This is just a select > statement. Will that help if i change the driver ? I am currently > using sqlitejdbc-v056.jar > >

Re: [sqlite] HELP : how to use datetime('column', 'localtime') as a part of sql string

2011-06-06 Thread Sridhar Polavarapu
Thanks Pavel for your replies. The reason looks to be the driver I am using to connect sqlite. I have changed it to use the driver from xerial and it is working fine now. Sridhar On 03-06-2011 12:00, Sridhar Polavarapu wrote: > Here is the code of my TestStatusDate > > public static void

[sqlite] HELP: sqlite queries execute faster in sqlite manager addon but take a lot of time to execute using a java program

2011-06-03 Thread Sridhar Polavarapu
This is not any update or insert statement. This is just a select statement. Will that help if i change the driver ? I am currently using sqlitejdbc-v056.jar Thanks Sridhar On 03-06-2011 18:59, Sridhar Polavarapu wrote: > Hi > > One of my sqlite query executes faster in sqlite manager( firefox

Re: [sqlite] HELP : how to use datetime('column', 'localtime') as a part of sql string

2011-06-03 Thread Sridhar Polavarapu
Here is the code of my TestStatusDate public static void main(String[] args) throws Exception { String jobQuery = "SELECT j.jobId, c.channelName , datetime(j.jobCreateDate, 'localtime'), j.jobStatus, j.jobQuality, j.jobCompleteDate FROM Job j, Channel c where c.channelId =

Re: [sqlite] HELP : how to use datetime('column', 'localtime') as a part of sql string

2011-06-02 Thread Pavel Ivanov
And your TestStatusDate code is? I'd bet now that the problem is in the way you get that time from jdbc. It can convert the time back to utc for you, although it looks a little strange that it converts one date and doesn't convert other one... Pavel On Thu, Jun 2, 2011 at 11:52 AM, Sridhar

Re: [sqlite] HELP : how to use datetime('column', 'localtime') as a part of sql string

2011-06-02 Thread Sridhar Polavarapu
I am on Windows 7 64 bit; I have tested the program as you mentioned, the good point here was the issue still appears please find logs . Let me know if you infer anything from below. C:\development\SignalCoreClient\test\com\Rimage\Starfish\AutomatedTests>java TestStatusDate Today's Locale is

Re: [sqlite] HELP : how to use datetime('column', 'localtime') as a part of sql string

2011-06-02 Thread Pavel Ivanov
> I have verified my locale and default time zone in the same program.The > values are correct and it is not UTC timezone. Any help appreciated. How did you do that? What OS are you running it on? Can you extract the code accessing SQLite database from your program and create a mini-program that

Re: [sqlite] HELP : how to use datetime('column', 'localtime') as a part of sql string

2011-06-02 Thread Sridhar Polavarapu
I have verified my locale and default time zone in the same program.The values are correct and it is not UTC timezone. Any help appreciated. Sridhar On 02-06-2011 19:34, Sridhar Polavarapu wrote: > The returned value is displayed to the user. We are not storing back > the returned column. > >

Re: [sqlite] HELP : how to use datetime('column', 'localtime') as a part of sql string

2011-06-02 Thread Sridhar Polavarapu
The returned value is displayed to the user. We are not storing back the returned column. Sridhar On 02-06-2011 19:28, Pavel Ivanov wrote: >> but is returning the value stored in the database when executed >> as a part of a java program. Can anyone help me if I am missing >> something here ? >

Re: [sqlite] HELP : how to use datetime('column', 'localtime') as a part of sql string

2011-06-02 Thread Pavel Ivanov
> but is returning the value stored in the database when executed > as a part of a java program. Can  anyone help me if I am missing > something here ? Looks like your java program runs with a different locale than SQLite Manager. I'm not sure why it thinks that you are in a UTC timezone. Maybe

Re: [sqlite] Help sqlite database corruption

2011-05-24 Thread Richard Hipp
On Tue, May 24, 2011 at 5:39 AM, Singh, Manpreet wrote: > Hello, > > > > Resending with some more finding any help would be appreciated. One of > the tables in the database is getting corrupted. > http://www.sqlite.org/howtocorrupt.html

Re: [sqlite] Help sqlite database corruption

2011-05-24 Thread Singh, Manpreet
Hello, Resending with some more finding any help would be appreciated. One of the tables in the database is getting corrupted. 1. Sqlite>select count(*) from $table_name .. 7981508|35001|284 7981509|35002|284 7981510|35003|284 7981511|35004|284 SQL error: database disk image is

[sqlite] Help with the code: vdbe

2011-04-21 Thread Lucas Cotta
Hi!! I'm studying databases in my college and I'd like to implement an algorithm to SQLite... since I'm not familiar with C, could you guys help me a little? For now, I just need to, every time the VDBE enters in OP_COLUMN, get the column value and put it to a string variable, that's all ! Thank

Re: [sqlite] Help with error codes

2011-04-13 Thread Jeff Archer
> drh on Tue Apr 12 22:23:38 > >Set your breakpoint on the function winAccess if you want to try to debug >this. Which I cannot do since attaching debugger masks the problem. Now I am really confused. I have modified winAccess to simply return the result of GetFileAttributesExW() if

Re: [sqlite] Help with error codes

2011-04-12 Thread jeff archer
>drh   Tue Apr 12 22:23:38 GMT 2011 > >Set your breakpoint on the function winAccess if you want to try to debug >this. If only it were that easy.  Its intermittent and attaching a debugger seems to mask the problem.  It's never been seen with only a single process and occurs more when there

Re: [sqlite] Help with error codes

2011-04-12 Thread Richard Hipp
On Tue, Apr 12, 2011 at 6:06 PM, jeff archer wrote: > I have a process which analyzes an image then writes results to database. > (sqlite 3.7.4) > When I run multiple of these in parallel, each on its own image but all on > the > same database, and all on same machine

[sqlite] Help with error codes

2011-04-12 Thread jeff archer
I have a process which analyzes an image then writes results to database.  (sqlite 3.7.4) When I run multiple of these in parallel, each on its own image but all on the same database, and all on same machine (Windows 7) I get an error from sqlite3_step() when attempting to execute "BEGIN

Re: [sqlite] Help with changing the code

2011-04-05 Thread Simon Slavin
On 5 Apr 2011, at 8:47pm, Guilherme Batista wrote: > Yes it's true. > But I'm not trying to improve the SQLite performance. I'm just studying the > query optimization of databases in general, and a better way to optimize if > the tables do not have indexes and if the query is complex and deals

Re: [sqlite] Help with changing the code

2011-04-05 Thread Simon Slavin
On 5 Apr 2011, at 6:54pm, Guilherme Batista wrote: > let's say I get the number of rows from the first table scan of the > execution. I would compare it with the number of rows defined for the table > in sqlite_stat1 (I ran the analyze once, and there are no index in my > tables). If the

Re: [sqlite] Help with changing the code

2011-04-04 Thread Simon Slavin
On 4 Apr 2011, at 11:53am, thilo wrote: > On 4/4/2011 2:05 AM, Guilherme Bamepe wrote: >> Hi! >> >> I'm new in SQLite, and I'm studying it to do a work in my college, >> and would be helpful if I get the SQLite to print, while executing >> the sql, after each table scan or join, the name of the

Re: [sqlite] Help with changing the code

2011-04-04 Thread thilo
On 4/4/2011 2:05 AM, Guilherme Bamepe wrote: > Hi! > > I'm new in SQLite, and I'm studying it to do a work in my college, > and would be helpful if I get the SQLite to print, while executing > the sql, after each table scan or join, the name of the table and > number of rows that are going to the

[sqlite] Help with changing the code

2011-04-03 Thread Guilherme Bamepe
Hi! I'm new in SQLite, and I'm studying it to do a work in my college, and would be helpful if I get the SQLite to print, while executing the sql, after each table scan or join, the name of the table and number of rows that are going to the next operator... for example.. the following sql:

Re: [sqlite] Help me understand the sqlite query optimizer

2011-03-21 Thread Simon Slavin
On 21 Mar 2011, at 5:46pm, Enrico Thierbach wrote: > On 21.03.2011, at 06:34, Simon Slavin wrote: > >> Suppose you have a TABLE employees with ten thousand rows and no indexes, >> and you execute >> >> SELECT id,firstname,surname FROM employees WHERE firstname='Guilherme' AND >> age=46 >>

Re: [sqlite] Help me understand the sqlite query optimizer

2011-03-21 Thread Enrico Thierbach
Hi Simon, I just stumbled about this post. > On 21.03.2011, at 06:34, Simon Slavin wrote: > > Suppose you have a TABLE employees with ten thousand rows and no indexes, and > you execute > > SELECT id,firstname,surname FROM employees WHERE firstname='Guilherme' AND > age=46 > > The

Re: [sqlite] Help me understand the sqlite query optimizer

2011-03-21 Thread Simon Slavin
On 21 Mar 2011, at 2:17pm, Guilherme Batista wrote: > So, in general, the the ANALYZE is not advantageous only if I have just 1 > index in my table, in that case the sqlite never use the ANALYZE... If you have exactly one INDEX which looks helpful for the query, SQLite will just use that. It

Re: [sqlite] Help me understand the sqlite query optimizer

2011-03-21 Thread Richard Hipp
On Mon, Mar 21, 2011 at 9:48 AM, Simon Slavin wrote: > > Note that if you provide good INDEXes as you should, then the results of > ANALYZE will never be used at all because the query finder will find it has > an excellent INDEX before it even starts trying to guess how to

Re: [sqlite] Help me understand the sqlite query optimizer

2011-03-21 Thread Simon Slavin
On 21 Mar 2011, at 12:12pm, Guilherme Batista wrote: > 1) So if I run ANALYZE, it will gather statistics about all columns in all > tables from the database? You can add parameters to the end of the command: http://www.sqlite.org/lang_analyze.html but without them it will analyze everything,

Re: [sqlite] Help me understand the sqlite query optimizer

2011-03-21 Thread Guilherme Batista
Thanks for the big and helpful explanation Simon! My changes in my study, theoretically, would improve the performance just of big and complex queries, so it's not my intention improve the sqlite, I want just study the effects.. Just a few more questions if anyone can help me 1) So if I run

Re: [sqlite] Help me understand the sqlite query optimizer

2011-03-20 Thread Simon Slavin
On 21 Mar 2011, at 3:33am, Guilherme Batista wrote: > I'll implement some changes in the sqlite query optimization for study > purpose... before I start studying the code please help me understand the > basic idea... > > 1) The basic idea of optimization is to optmize and then execute. Where in

[sqlite] Help me understand the sqlite query optimizer

2011-03-20 Thread Guilherme Batista
Hi!! I'll implement some changes in the sqlite query optimization for study purpose... before I start studying the code please help me understand the basic idea... 1) The basic idea of optimization is to optmize and then execute. Where in the code the plan is built and where it is executed? 2)

Re: [sqlite] Help with a query

2011-03-04 Thread Marco Bambini
Thanks a lot Simon and Robert. -- Marco Bambini http://www.sqlabs.com On Mar 4, 2011, at 11:50 AM, Robert Hairgrove wrote: > On Fri, 2011-03-04 at 11:10 +0100, Marco Bambini wrote: >> Hello, >> I have a table defined as: >> CREATE TABLE MKProperties (id INTEGER PRIMARY KEY AUTOINCREMENT,

Re: [sqlite] Help with a query

2011-03-04 Thread Robert Hairgrove
On Fri, 2011-03-04 at 11:10 +0100, Marco Bambini wrote: > Hello, > I have a table defined as: > CREATE TABLE MKProperties (id INTEGER PRIMARY KEY AUTOINCREMENT, obj_id > INTEGER, prop_key TEXT, prop_value TEXT, UNIQUE(obj_id, prop_key)) > > In that table there some rows like: > obj_id

Re: [sqlite] Help with a query

2011-03-04 Thread Simon Davies
On 4 March 2011 10:10, Marco Bambini wrote: > Hello, > I have a table defined as: > CREATE TABLE MKProperties (id INTEGER PRIMARY KEY AUTOINCREMENT, obj_id > INTEGER, prop_key TEXT, prop_value TEXT, UNIQUE(obj_id, prop_key)) > > In that table there some rows like: > obj_id  

[sqlite] Help with a query

2011-03-04 Thread Marco Bambini
Hello, I have a table defined as: CREATE TABLE MKProperties (id INTEGER PRIMARY KEY AUTOINCREMENT, obj_id INTEGER, prop_key TEXT, prop_value TEXT, UNIQUE(obj_id, prop_key)) In that table there some rows like: obj_id prop_keyprop_value 1 PARENTID0 1 RESOURCE_ORDER 0

Re: [sqlite] Help for Garbled

2011-03-01 Thread 陈强
>> for example, i insert String filled with gbk bytes and set the String >> charset 'UTF-8' > >What do you mean, "set String charset"? Set how and where? >-- >Igor Tandetnik Hi The String on java side is ok. > for example, i insert String filled with gbk bytes and set the String charset >

Re: [sqlite] Help for Garbled

2011-03-01 Thread Igor Tandetnik
On 3/1/2011 9:49 PM, 陈强 wrote: > How did the sqlite.exe work if insert data through it? > insert gbk string? Most likely. I wouldn't be surprised if these strings came out wrong on Java side, though. > can I insert data like it ? Probably, but I don't think you really want to. It'll be a

Re: [sqlite] Help for Garbled

2011-03-01 Thread 陈强
>Try running this command before starting sqlite.exe, but I'm not sure >this will help: > >mode con cp select=65001 Hi I tried to change the charset of console to utf-8 before, but it didn't work correctly. Because the app will besent to custom, so i want to make sqlite.exe display correctly.

Re: [sqlite] Help for Garbled

2011-03-01 Thread Igor Tandetnik
On 3/1/2011 8:52 PM, 陈强 wrote: > But if i want to make the gbk console show String correctly, what should i do? Try running this command before starting sqlite.exe, but I'm not sure this will help: mode con cp select=65001 There also exists a number of nice graphical tools for working with

Re: [sqlite] Help for Garbled

2011-03-01 Thread 陈强
At 2011-03-02 09:17:48,"Igor Tandetnik" wrote: >On 3/1/2011 8:05 PM, 陈强 wrote: >> At 2011-03-01 20:56:49,"Igor Tandetnik" wrote: >> >>> 陈强 wrote: Why is the Chinese i Selected from SQLIte.exe and jdbc is not different. The

Re: [sqlite] Help for Garbled

2011-03-01 Thread Igor Tandetnik
On 3/1/2011 8:05 PM, 陈强 wrote: > At 2011-03-01 20:56:49,"Igor Tandetnik" wrote: > >> 陈强 wrote: >>> Why is the Chinese i Selected from SQLIte.exe and jdbc is not different. >>> The Chinese from JDBC(rs.getString(index)) is normal but >>> the Chinese from

Re: [sqlite] Help for Garbled

2011-03-01 Thread 陈强
At 2011-03-01 20:56:49,"Igor Tandetnik" wrote: >陈强 wrote: >> Why is the Chinese i Selected from SQLIte.exe and jdbc is not different. The >> Chinese from JDBC(rs.getString(index)) is normal but >> the Chinese from Sqlite.exe (Select data) is Garbled, my

Re: [sqlite] Help for Garbled

2011-03-01 Thread Igor Tandetnik
陈强 wrote: > Why is the Chinese i Selected from SQLIte.exe and jdbc is not different. The > Chinese from JDBC(rs.getString(index)) is normal but > the Chinese from Sqlite.exe (Select data) is Garbled, my environment as list: Console window doesn't know UTF-8. The strings are

[sqlite] Help for Garbled

2011-02-28 Thread 陈强
Dear All: I have a problem toDisturb your. Why is the Chinese i Selected from SQLIte.exe and jdbc is not different. The Chinese from JDBC(rs.getString(index)) is normal but the Chinese from Sqlite.exe (Select data) is Garbled, my environment as list: Server os: 2003 Simple Chinese Server

Re: [sqlite] Help with join

2011-02-20 Thread Jeff Archer
>Date: Fri, 18 Feb 2011 07:34:06 -0800 >From: Jim Morris > >A correlated sub-query might work for you. > >SELECT >[Analyzers].[AnalyzerID] >, [Analyzers].[Name] AS [Analyzer] >, [Analysis].[AnalysisID] >, [Analysis].[ScanID] >, [Analysis].[Timestamp] >

Re: [sqlite] Help with join

2011-02-18 Thread Jim Morris
A correlated sub-query might work for you. SELECT [Analyzers].[AnalyzerID] , [Analyzers].[Name] AS [Analyzer] , [Analysis].[AnalysisID] , [Analysis].[ScanID] , [Analysis].[Timestamp] , [Analysis].[EndTime] , (SELECT COUNT(*) AS NumDefects

[sqlite] Help with join

2011-02-17 Thread jeff archer
Here is my existing schema.  I would like to change this and remove the "NumDefects" from the [Analysis] table. To do this I need to update the [vwAnalysis] view to determine the number of defects from the [Defects] table by the AnalysisID. I can't seem to get the right select for the new

[sqlite] help: sigsegv error using sqlite3_exec( )

2011-02-10 Thread Zaryab Munir (zmunir)
Hi, I am using an in-memory dbase in a multi-threaded application and have the following two questions: I create dbase connections by each thread using the API: { Sqlite3 *db = NULL; Sqlite3_open(":memory:", ); When I try to use sqlite3_exec( ) I get segmentation faults. }

Re: [sqlite] Help on DELETE FROM...

2011-01-18 Thread Marcus Grimm
ite-users-boun...@sqlite.org on behalf of Marcus Grimm > Sent: Mon 1/17/2011 11:18 AM > To: General Discussion of SQLite Database > Subject: EXTERNAL:Re: [sqlite] Help on DELETE FROM... > > > > > On 17.01.2011 17:26, Black, Michael (IS) wrote: >> I came up with the lo

Re: [sqlite] Help on DELETE FROM...

2011-01-17 Thread Black, Michael (IS)
se Subject: EXTERNAL:Re: [sqlite] Help on DELETE FROM... On 17.01.2011 17:26, Black, Michael (IS) wrote: > I came up with the logical opposite which I think does what you want > > select a.id from thi as a where a.id in (select thi.id from thi where > a.userid=thi.userid order by timestamp l

Re: [sqlite] Help on DELETE FROM...

2011-01-17 Thread Marcus Grimm
rom thi where a.userid=thi.userid > ...> order by timestamp limit 100 offset 10); > 10|20|10|0 > 11|21|10|0 > 12|22|10|0 > 23|31|20|0 > 24|32|20|0 > 25|33|20|0 > > > Michael D. Black > Senior Scientist > Advanced Analytics Directorate > Northrop Grumman

Re: [sqlite] Help on DELETE FROM...

2011-01-17 Thread Igor Tandetnik
Igor Tandetnik wrote: > delete from THI where ID not in ( >select ID from THI t2 where t2.UserID = UserId >order by t2.TimeStamp desc limit 10); Correction: delete from THI where ID not in ( select t2.ID from THI t2 where t2.UserID = THI.UserId order by

Re: [sqlite] Help on DELETE FROM...

2011-01-17 Thread Igor Tandetnik
Black, Michael (IS) wrote: > The "NOT IN" approach doesn't work..here's sample data using select rather > than delete to show the result. > > sqlite> select * from THI where ID not in ( >...> select ID from THI t2 where t2.UserID = UserId >...> order by

Re: [sqlite] Help on DELETE FROM...

2011-01-17 Thread Marcus Grimm
e > Northrop Grumman Information Systems > > > > > From: sqlite-users-boun...@sqlite.org on behalf of Marcus Grimm > Sent: Mon 1/17/2011 10:24 AM > To: General Discussion of SQLite Database > Subject: EXTERNAL:Re: [sqlite] Help on DELETE FROM... >

Re: [sqlite] Help on DELETE FROM...

2011-01-17 Thread Black, Michael (IS)
0|0 24|32|20|0 25|33|20|0 Michael D. Black Senior Scientist Advanced Analytics Directorate Northrop Grumman Information Systems From: sqlite-users-boun...@sqlite.org on behalf of Igor Tandetnik Sent: Mon 1/17/2011 10:57 AM To: sqlite-users@sqlite.org Subject: EX

Re: [sqlite] Help on DELETE FROM...

2011-01-17 Thread Igor Tandetnik
Marcus Grimm wrote: >> delete from THI where ID not in ( >> select ID from THI t2 where t2.UserID = UserId >> order by t2.TimeStamp desc limit 10); A correction: I think the subselect should say "select t2.ID from ..." > Thanks Igor! > but a stupid question:

Re: [sqlite] Help on DELETE FROM...

2011-01-17 Thread Black, Michael (IS)
Senior Scientist Advanced Analytics Directorate Northrop Grumman Information Systems From: sqlite-users-boun...@sqlite.org on behalf of Marcus Grimm Sent: Mon 1/17/2011 10:24 AM To: General Discussion of SQLite Database Subject: EXTERNAL:Re: [sqlite] Help on DELETE

Re: [sqlite] Help on DELETE FROM...

2011-01-17 Thread Marcus Grimm
On 17.01.2011 17:14, Igor Tandetnik wrote: > Marcus Grimm wrote: >> I have a table to record some history data, for example >> items a user recently selected: >> >> CREATE TABLE THI(ID INTEGER PRIMARY KEY, TimeStamp INTEGER, UserID INTEGER, >> DataID INTEGER); >> >>

Re: [sqlite] Help on DELETE FROM...

2011-01-17 Thread Igor Tandetnik
Marcus Grimm wrote: > I have a table to record some history data, for example > items a user recently selected: > > CREATE TABLE THI(ID INTEGER PRIMARY KEY, TimeStamp INTEGER, UserID INTEGER, > DataID INTEGER); > > That table needs to trace only the last 10 events,

<    1   2   3   4   5   6   7   8   9   >