Re: [sqlite] range enclosing a number

2009-07-13 Thread Jay A. Kreibich
On Mon, Jul 13, 2009 at 10:33:00PM -0400, Pavel Ivanov scratched on the wall: > Jay, you're pretty much mistaken: > > > I'm pretty sure you don't want to do it this way. What this does is > > gather every row that meets the WHERE condition and then runs a max() > > or min() aggregation

Re: [sqlite] range enclosing a number

2009-07-13 Thread John Machin
On 14/07/2009 11:44 AM, Jay A. Kreibich wrote: > On Mon, Jul 13, 2009 at 07:40:48PM -0400, Wes Freeman scratched on the wall: >> Yeah, sorry about that. In two statements: >> >> select max(number) from table where number < ? >> select min(number) from table where number > ? > > I'm pretty sure

Re: [sqlite] range enclosing a number

2009-07-13 Thread Pavel Ivanov
Jay, you're pretty much mistaken: > I'm pretty sure you don't want to do it this way. What this does is > gather every row that meets the WHERE condition and then runs a max() > or min() aggregation function across all of those rows. That means > that even if the column "number" has an

Re: [sqlite] range enclosing a number

2009-07-13 Thread Jay A. Kreibich
On Mon, Jul 13, 2009 at 07:40:48PM -0400, Wes Freeman scratched on the wall: > Yeah, sorry about that. In two statements: > > select max(number) from table where number < ? > select min(number) from table where number > ? I'm pretty sure you don't want to do it this way. What this does is

Re: [sqlite] range enclosing a number

2009-07-13 Thread Bogdan Nicula
Thank you, seems like a good solution. Best regards,Bogdan > From: freeman@gmail.com > Date: Mon, 13 Jul 2009 19:40:48 -0400 > To: sqlite-users@sqlite.org > Subject: Re: [sqlite] range enclosing a number > > Yeah, sorry about that. In two statements: > > select max(number) from table

Re: [sqlite] range enclosing a number

2009-07-13 Thread Simon Slavin
On 14 Jul 2009, at 12:16am, Bogdan Nicula wrote: > Given a column containing numbers, which is the most efficient > manner to find out the highest smaller and lowest greater number? > That is, is there a better way than: > > select * from table where number <= ? order by number desc limit 1; >

Re: [sqlite] string is converted into a number

2009-07-13 Thread Simon Slavin
On 14 Jul 2009, at 12:49am, John Machin wrote: > On 14/07/2009 3:04 AM, Simon Slavin wrote: >> >> The reference you were pointed to explains what happens: >> >> http://www.sqlite.org/datatype3.html#affinity >> >> So you want 'TEXT' ... 'char' doesn't mean anything to SQLite. > > @Simon: I'm not

Re: [sqlite] string is converted into a number

2009-07-13 Thread John Machin
On 14/07/2009 3:04 AM, Simon Slavin wrote: > On 13 Jul 2009, at 4:35pm, Wilfried Mestdagh wrote: > >> But the circumstances are not really described (possible I cannot read >> between the lines as my English is not perfect). So as far as I >> understand >> the page if I want to store / retrieve

Re: [sqlite] range enclosing a number

2009-07-13 Thread Wes Freeman
Yeah, sorry about that. In two statements: select max(number) from table where number < ? select min(number) from table where number > ? if you want to merge them into a single statement, you can do: select (select max(number) from table where number < ?) highest_smaller, (select min(number)

Re: [sqlite] range enclosing a number

2009-07-13 Thread Bogdan Nicula
Thank you for your answer. Looking back to my original email, I believe I didn't explain well enough: I want to find the highest smaller and lowest greater numbers enclosing the number. For example, given the sequence: 1, 3, 5, 7, 9, etc., if I query for 6, I would like to get 5 and 7.

Re: [sqlite] range enclosing a number

2009-07-13 Thread Wes Freeman
Sorry, I misread the question... Still, I think min/max are better than order by limit 1. Wes On Mon, Jul 13, 2009 at 7:24 PM, Wes Freeman wrote: > Select max(number), min(number) from table; > > Wes > > On Mon, Jul 13, 2009 at 7:16 PM, Bogdan Nicula

Re: [sqlite] range enclosing a number

2009-07-13 Thread Wes Freeman
Select max(number), min(number) from table; Wes On Mon, Jul 13, 2009 at 7:16 PM, Bogdan Nicula wrote: > > > Hi, > > Sorry for my lack of SQL knowledge which triggered this help request: > Given a column containing numbers, which is the most efficient manner to find > out

[sqlite] range enclosing a number

2009-07-13 Thread Bogdan Nicula
Hi, Sorry for my lack of SQL knowledge which triggered this help request: Given a column containing numbers, which is the most efficient manner to find out the highest smaller and lowest greater number? That is, is there a better way than: select * from table where number <= ? order by number

[sqlite] trigger in self-attached db

2009-07-13 Thread Jan
Hi, if I attach a database to itself the trigger in the second db seem not to work as expected (as I wrongly expected? .-): Does anyone no why and how I could work around this? sqlite3 adb .headers on create table a ( pk integer primary key ); create table b ( pk integer

Re: [sqlite] Raise is not working

2009-07-13 Thread Kees Nuyt
On Sun, 12 Jul 2009 18:03:14 -0700, "Jim Showalter" wrote: >Schema: > >create table words (_id integer primary key autoincrement, wordtext >text not null unique); > >create table definitions (_id integer primary key autoincrement, >owningWordId integer not null unique,

Re: [sqlite] Updating a database by email

2009-07-13 Thread John Stanton
Bruce Robertson wrote: >> We use a system of updating an Sqlite database buit use port 80 to send >> data in XML format. >> >> Is there a reason you have access to the email port and not the HTTP >> port 80? It is very complex to identify a missing email but using port >> 80 and HTTP the process

[sqlite] SQLite Editor or Database Console for iPhone/iPod Touch

2009-07-13 Thread Monte Milanuk
Anyone here on the list have experience with either app? Thanks, Monte ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] string is converted into a number

2009-07-13 Thread Simon Slavin
On 13 Jul 2009, at 4:35pm, Wilfried Mestdagh wrote: > But the circumstances are not really described (possible I cannot read > between the lines as my English is not perfect). So as far as I > understand > the page if I want to store / retrieve a string (which can be a > numeric > string) I

Re: [sqlite] string is converted into a number

2009-07-13 Thread John Elrick
Wilfried Mestdagh wrote: > Hi Dan, > > Thank you for your reply. I read: > > >> Under circumstances described below, the database engine may convert >> values between numeric storage classes (INTEGER > and REAL) and >> TEXT during query execution >> > > But the circumstances are not really

Re: [sqlite] string is converted into a number

2009-07-13 Thread Wilfried Mestdagh
Hi Dan, Thank you for your reply. I read: > Under circumstances described below, the database engine may convert > values between numeric storage classes (INTEGER > and REAL) and >TEXT during query execution But the circumstances are not really described (possible I cannot read between the

[sqlite] (no subject)

2009-07-13 Thread Frank
-- This message has been scanned for viruses and dangerous content by Pinpoint, and is believed to be clean. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] writing images to an SQLite database using SQLite commandline program.

2009-07-13 Thread Igor Tandetnik
chandan wrote: > I would like to know how to store images inside a SQLite database > using the SQLite command line program. You can't, really. You'd have to write your own application to handle such BLOBs. > consider the following example: > > create table img_tbl ( > img_id int primary

Re: [sqlite] two question, 1.)sqlite3's select? 2.)errno and the sqlite3's result code

2009-07-13 Thread Igor Tandetnik
liubin liu wrote: > 1.)How does sqlite3's select work? It works well. What specifically do you want to now? > Does it need to seach for all the records? Sometimes. Other times, it could use indexes to reduce the number of records a statement needs to look at. See:

Re: [sqlite] SQLite 3 is truncating numbers--can you help me figure out why?

2009-07-13 Thread P Kishor
On Sun, Jul 12, 2009 at 11:00 PM, tetragon tetragon wrote: > create table words (_id integer primary key autoincrement, wordtext text not > null unique, timestamp integer not null); > > public class Word > { >     long _id; >     String wordtext; >     long timestamp; > } >

[sqlite] SQLite 3 is truncating numbers--can you help me figure out why?

2009-07-13 Thread tetragon tetragon
create table words (_id integer primary key autoincrement, wordtext text not null unique, timestamp integer not null); public class Word {     long _id;     String wordtext;     long timestamp; } timestamp: before save: 1247435151517 after save : 1247435160847 Why is it doing this?

[sqlite] "database is locked" error using lastest linux kernel

2009-07-13 Thread hua zhou
My problem is get a "database is locked" error using lastest linux kernel (above 2.6.28) ,  while the code can run smoothly on linux 2.6.26.2 kernel(vmware pc686 host) and on 2.6.26.3 kernel(arm9 embed system).   The problem code is: #if 1  if (sqlite3_exec(gJcDb, "PRAGMA cache_size = 4000",

Re: [sqlite] string is converted into a number

2009-07-13 Thread Dan
On Jul 13, 2009, at 3:38 PM, Wilfried Mestdagh wrote: > Hi, > > It seems that if I create the table as a field type 'char' instead of > 'string' then the issue is solved. But I thought the field type was > of non > importance? Details here: http://www.sqlite.org/datatype3.html#affinity

Re: [sqlite] string is converted into a number

2009-07-13 Thread Wilfried Mestdagh
Hi, It seems that if I create the table as a field type 'char' instead of 'string' then the issue is solved. But I thought the field type was of non importance? rgds, Wilfried 2009/7/13 Wilfried Mestdagh > Hello, > > I'm using sqlite3.dll and Delphi 7. In certain

[sqlite] (no subject)

2009-07-13 Thread Frank
-- This message has been scanned for viruses and dangerous content by Pinpoint, and is believed to be clean. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

[sqlite] string is converted into a number

2009-07-13 Thread Wilfried Mestdagh
Hello, I'm using sqlite3.dll and Delphi 7. In certain cirumstances a string seems to be converted to a number. To test I use SQLiteSpy from Ralf Junker wich is a nice tool. When I do this: insert into Queue (NetworkID) values ("200907130833123740007") Then the result of the field NetworkID is:

[sqlite] two question, 1.)sqlite3's select? 2.)errno and the sqlite3's result code

2009-07-13 Thread liubin liu
1.)How does sqlite3's select work? Does it need to seach for all the records? 2.)Is there any relation between errno and the sqlite3's result code? -- View this message in context:

[sqlite] writing images to an SQLite database using SQLite command line program.

2009-07-13 Thread chandan
Hi, I would like to know how to store images inside a SQLite database using the SQLite command line program. consider the following example: create table img_tbl ( img_id int primary key, img blob); In the above case how do I use the SQL "insert" statement to store images into the