Re: [sqlite] exists clause in select

2011-08-08 Thread Martin.Engelschalk
Hi, this seems like correct SQL to me. SQLite should execute it. Doesn't it work? Martin Am 08.08.2011 07:50, schrieb William Canfield: > Hi, > I am having trouble writing a select statement. What I want to do is this: > > SELECT * FROM customers WHERE NOT EXISTS (SELECT * FROM orders WHERE >

Re: [sqlite] Ensure that query acts on PRE-SORTED tables

2011-07-01 Thread Martin.Engelschalk
Hi, i apologize beforehand if my post does not answer your question directly. It seems to me that you may be missing a basic concept. Data in an SQL table is never sorted in itself. So, you can not sort a table before you query it. If you select data without an "order by" - clause, the order

Re: [sqlite] Should i upgrade SQLITE for my system?

2011-06-27 Thread Martin.Engelschalk
Hi, you can look at the changes doumented here http://www.sqlite.org/changes.html and determine if they are beneficial for your application. Also, my own application runs faster with the newest version (I upgraded from version 3.2.5) Martin Am 27.06.2011 09:48, schrieb Hoang Linh Duong: >

Re: [sqlite] SQLITE run slow

2011-06-14 Thread Martin.Engelschalk
Hi, make sure you have an index on category and distance, like create index MyIndex on Location (category, distance) Because many records fulfill the category=17 condition, and if database size is an issue, an index only on distance might help also. Martin Am 14.06.2011 13:01, schrieb

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] How to know the offset of a rowid inside a table?

2011-06-08 Thread Martin.Engelschalk
Am 08.06.2011 16:37, schrieb Marco Bambini: > Thanks Martin and Richard, solution was so simple that I think to need a time > break today. No, an order by does not make any sense here, because the result set contains exactly one row. > Should I add an ORDER BY rowid clause at the end of the

Re: [sqlite] How to know the offset of a rowid inside a table?

2011-06-08 Thread Martin.Engelschalk
Hi, select count(*) from foo where rowid < X Martin Am 08.06.2011 16:18, schrieb Marco Bambini: > I have a table foo with N rows and I want to know the offset of the row with > rowid X inside that table. > What query/strategy should I perform? > > I assume that a brute force algorithm should

Re: [sqlite] Unknown parameter for prepare_v2

2011-05-19 Thread Martin.Engelschalk
Hi, you cannot bind the name of a table. Bind variables only work for Values in the database, like you used in the VALUES('1', ?) - clause. Names of tables, columns or other items of the schema must be written in the sql statement. You will have to build your statement (using sprintf() or

Re: [sqlite] Joinery

2011-01-21 Thread Martin.Engelschalk
Hi, select a.ID from a join b on b.aID = a.ID where b.user = 'MyUser' The join is an inner join, so that only rowa of table a are selected where a rocord in b exists. This seems to be what you want. Martin Am 21.01.2011 12:33, schrieb Ian Hardingham: > Hey guys. > > This is just an

Re: [sqlite] sqlite3 ltrim behaviour bug or feature?

2011-01-14 Thread Martin.Engelschalk
Hi, this is the expected behaviour. See http://www.sqlite.org/lang_corefunc.html "The ltrim(X,Y) function returns a string formed by removing any and all characters that appear in Y from the left side of X. If the Y argument is omitted, ltrim(X) removes spaces from the left side of X. " The

Re: [sqlite] How to optimize a multi-condition query

2010-10-15 Thread Martin.Engelschalk
Hi, the condition in your query select achr,bchr from c where achr=bchr involves 2 columns of the table. In this case, an index is useless. If you do select achr,bchr from c where achr='foo' then the index will be used. Martin Am 15.10.2010 15:09, schrieb Black, Michael (IS): > Ok

Re: [sqlite] [C-API] Query returns only 0

2010-09-30 Thread Martin.Engelschalk
Hello Gerald, i think you should tell us more about what you are trying to do and add some C code. what do you mead by "return value"? What functions do you call? Do you know that you have to get the selected value by calling a function like sqlite3_column_text ? Martin Am 30.09.2010

Re: [sqlite] Reserve database pages

2010-08-12 Thread Martin.Engelschalk
Am 12.08.2010 13:04, schrieb TeDe: > Am 12.08.2010 12:16, schrieb Martin.Engelschalk: >> Am 12.08.2010 12:08, schrieb TeDe: >>>Hello, >>> >>> I want to import a big subset of data from one database to a new one. I >>> attach the two databases t

Re: [sqlite] Reserve database pages

2010-08-12 Thread Martin.Engelschalk
Am 12.08.2010 12:08, schrieb TeDe: > Hello, > > I want to import a big subset of data from one database to a new one. I > attach the two databases together and use > > insert into customers select * from source.customers where name LIKE 'x%' > > I can approximately calculate, how big the new

Re: [sqlite] foreign key the true error - sqlite 3.7.0.1

2010-08-09 Thread Martin.Engelschalk
Am 09.08.2010 16:57, schrieb Oliver Peters: > [...] > > To my mind the simplified question is: > > why returns the "INSERT INTO a" not an error while the "INSERT INTO b" does? > How > corresponds this behaviour to the concept of FOREIGN KEYS? > > I wrote the code into file.sql (encoding=utf8,

Re: [sqlite] if exist

2010-03-09 Thread Martin.Engelschalk
Hi, try this: select coalesce(min(length), 0) from t where id = ? Martin Andrea Galeazzi schrieb: > Hi All, > I've got a table T made up of only two fields: INT id (PRIMARY KEY) and > INT length. > I need a statement in order to yield 0 when the key doesn't exist. At > this moment the query

Re: [sqlite] size control of sqlite database

2010-01-14 Thread Martin.Engelschalk
Hi, a sqlite database is a file, you can get its size using OS calls. It is not possible to create a database with an initial size, because the file grows dynamically when you insert data. To avoid fragmentation, I also looked for a way to allocate empty space inside the database file when

Re: [sqlite] a possible bug of select min(id) from...

2009-12-17 Thread Martin.Engelschalk
Hi, sqlite works like any other database I know, and afaik conforms to sql standard. Martin nick huang schrieb: > Hi Igor, > > > > You are absolutely right that its type is NULL and min(id) returns 0 as I use > sqlite_column_int64 to retrieve data. However, isn't it confusing that the >

Re: [sqlite] requesting 2 tables about one select

2009-12-17 Thread Martin.Engelschalk
Hi, this requires a simple join: select siterate.name, sitetype.name from siterate join sitetype on sitetype.id = siterate.type where sitetype.status!=1 This supposes that for every entry in siterate, there exists an entry in sitetypes with sitetype.id = siterate.type It seems to me that you

Re: [sqlite] BACK API Questions

2009-12-15 Thread Martin.Engelschalk
Hello Raghu, it seems to mee that you misunderstand the backup api. This api does not "know" or care for your schema and tables, but backups the database block for block. In this sense, the api does not know "old" contents and can not add "new" content. The backup api can not help you in your

Re: [sqlite] In-memory database backup

2009-09-30 Thread Martin.Engelschalk
Hi, you can use the online backup api described here: http://www.sqlite.org/backup.html Martin Andres Velasco Garcia schrieb: > Hello, > > Do any of you know if it is possible to backup an in-memory database to disk > so it can be recovered later from disk. > > Thanks > > Andres Velasco > M:

Re: [sqlite] Problem with -order by- clause

2009-07-27 Thread Martin.Engelschalk
Hi, The sorting used by default in sqlite uses normal strcmp - like comparison. This problem has been discussed several times in the mailing list: perhaps you want to search the archive. You will have to write your own collation, perhaps using the ICU. See

Re: [sqlite] how to access tables in multiple sqlite databases

2009-07-14 Thread Martin.Engelschalk
Hi, see http://www.sqlite.org/lang_attach.html you attach a second database, giving it a name, and prepend this name to the table name. Martin Zhenyu Guo schrieb: > Hi guys, > > I have multiple sqlite databases in hand, and I would like to perform the > following several tasks: > > . two

Re: [sqlite] Error is coming in Linux while openings Databse

2009-07-09 Thread Martin.Engelschalk
Hi, Does the user under which the application runs have write permission on the Directory the database resides in? Are you sure that the segfault occurs inside sqlite and not in your own code? Martin Pramoda M. A schrieb: > Hi All, > >I am working on Fedora 10. Using C interfaces, I am

Re: [sqlite] what is most effective way to temporarily disable triggers?

2009-07-09 Thread Martin.Engelschalk
Hi, if you are talking about a feature request: Oracle supports sql syntax to enable or disable a certain trigger (as opposed to all triggers as you suggested): ALTER TRIGGER DISABLE or ALTER TRIGGER ENABLE This would be nice. Martin Michal Seliga schrieb: > hi > > attached is patch which

Re: [sqlite] What's the different of the types TEXT and VARCHAR in sqlite3?

2009-06-24 Thread Martin.Engelschalk
Hi, type names do not matter in sqlite, see http://www.sqlite.org/datatype3.html Martin Kermit Mei schrieb: > Hello, I'm a newbie for sqlite3, I hope somebody can tell me what's the > different of TEXT and VARCHAR. Does TEXT can save arbitrary characters, > but VARCHAR? Which is better, then?

Re: [sqlite] how to compose the sql sentence?

2009-06-04 Thread Martin.Engelschalk
Hi, what do you mean by "command"? The command line tool takes commands entered by the user, such as SQL - statements. These do not have returncodes. If an error occurs, the command line tool will print out the error message. The functions of the sqlite3 library have returncodes, but they can

Re: [sqlite] how to compose the sql sentence?

2009-06-04 Thread Martin.Engelschalk
Hi, First, you have to declare the index as unique: CREATE UNIQUE INDEX i_data ON data (num, di, time1); or - depending on your database design, declare a primary key with these three fields. Second, the error message says it all: You supplied three column - names, but 6 values. Martin

Re: [sqlite] accessing a sqlite db with multiple java processes.

2009-05-27 Thread Martin.Engelschalk
Hi, i imagine that your problem has nothing to do with your driver. Have you looked at http://www.sqlite.org/faq.html#q5 ? Martin Laurent Burgy schrieb: > Hi, > I was using sqlite with only one java process (using the sqlitejdbc driver) > and everything was ok... now i'm trying to run several

Re: [sqlite] (no subject)

2009-05-26 Thread Martin.Engelschalk
Hi, select * from sqlite_master; Martin PS.: Please provide a subject which summarises your question. Manasi Save schrieb: > Hi All, > > Can anyone help me out with the command to see the SQLite table defination > on command-line SQLite application. >

Re: [sqlite] Insert into with select not working

2009-04-09 Thread Martin.Engelschalk
Hello Brian, you do not need a VALUE keyword in this case. INSERT INTO "subscribers_new" --VALUES <- remove this SELECT id, ip_address, added, 'aa:bb:cc:etc' from subscribers; See the syntax diagram for the insert command: http://www.sqlite.org/lang_insert.html Martin Brian

Re: [sqlite] Binary Format

2009-04-01 Thread Martin.Engelschalk
Hi, from the website http://www.sqlite.org/oldnews.html: The file format for version 3.3.0 has changed slightly to support descending indices and a more efficient encoding of boolean values. SQLite 3.3.0 will read and write legacy databases created with any prior version of SQLite 3. But

Re: [sqlite] is primary key already indexed ?

2009-03-19 Thread Martin.Engelschalk
Hi,. baxy77bax schrieb: > hi my question is : if i create table that contains primary key like; > > create table TEST (field1 varchar not null primary key); > > do i need to create index on it or not? > Yes, the primary key is indexed > and is it better to create table with a primary key and

Re: [sqlite] nullable select fields

2009-03-10 Thread Martin.Engelschalk
Hi, see sqlite3_bind_null: http://www.sqlite.org/capi3ref.html#sqlite3_bind_blob Martin Andrea Galeazzi schrieb: > Hi All, > I'm developing an application which relies on sqllite as back-end. Now > I face to this problem: I've got a form that allows the user to fill a > lot of fields,

Re: [sqlite] Error message This program cannot be run in DOS

2009-02-05 Thread Martin.Engelschalk
Hi, what is your "DOS Prompt"? There are "command.com" and "cmd.exe". Try using "cmd.exe". Martin Richard Hardwick schrieb: >> selecting the UNBLOCK button from the window displayed, and unzip and >> > Well I dont seem to have an unblock button > Here is what I did > > I downloaded >

Re: [sqlite] sqlite3_bind_int returns SQLITE_RANGE

2009-02-02 Thread Martin.Engelschalk
Hi, no, you habe 13 placeholders and one string constant '?' on position 9. You do not need to include the ? in quotes if the value you want to bind is a string. Martin hussainfarzana schrieb: > Yes,the SQL prepared statement has got 14 placeholders. > > The statement is "INSERT INTO

Re: [sqlite] need a CURRENT_USER() function

2009-01-16 Thread Martin.Engelschalk
Hi Jeffrey, use something like this: struct passwd *who; if ((who = getpwuid(getuid ())) != NULL) { oUserName = who->pw_name; } where oUserName is the desired result. See http://www.sqlite.org/capi3ref.html#sqlite3_create_function how to define your function.

Re: [sqlite] Collation not used

2009-01-09 Thread Martin.Engelschalk
Hello Dan, yes, you are right, Thank you. Is there a reason for this? martin Dan schrieb: > On Jan 9, 2009, at 9:43 PM, Martin.Engelschalk wrote: > > >> Hello list, >> >> I definied a collation and used it in the order by - clauses of >> queries. >> I

[sqlite] Collation not used

2009-01-09 Thread Martin.Engelschalk
Hello list, I definied a collation and used it in the order by - clauses of queries. In one query, sqlite calls the collation function, and in the other query, it does not (i checked by inserting a printf inside the collation function). The queries differ only in the order by - clause. This

Re: [sqlite] Transfer data between databases

2009-01-09 Thread Martin.Engelschalk
Hi Pierre, you can open both database files at the same time and using the same connection: Look at the attach - Command: http://www.sqlite.org/lang_attach.html You can then use both databases in the same statement (insert into MyTable (... columns ...) select ... columns ... from

Re: [sqlite] Drop Trigger with Select

2008-12-30 Thread Martin.Engelschalk
Hi, My idea would be a to define a function which drops the trigger and returns some dummy value and call ist like this: SELECT MyDropFunction(name) from trigger_status where status = 1 However, i do not know if this will work. Martin timdbu...@gmail.com schrieb: > Hi, > Is there any way

Re: [sqlite] Maximum Size of Record

2008-12-10 Thread Martin.Engelschalk
regarding text and number.Can I assume the size > of number and text as unlimited. > > Regards, > G.Satish. > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Martin.Engelschalk > Sent: Wednesday, December 10, 2008 5:45 PM > To: General D

Re: [sqlite] Maximum Size of Record

2008-12-10 Thread Martin.Engelschalk
Hi, See http://www.sqlite.org/limits.html Martin Satish schrieb: > Hi Igor, > > Can I know the Maximum size of Record in sqlite or Can I > know the maximum size of NUMBER,TEXT and BLOB Data types. > > > > Regards, > > G.Satish. > >

Re: [sqlite] Valgrind, writeJournalHdr and Syscall param write(buf) points to uninitialised byte(s).

2008-12-09 Thread Martin.Engelschalk
Hi, i remember the posts you mention, and I know these error reports from valgrind. I get them outside of sqlite also, and have learned to ignore them. Martin Kent Dahl schrieb: > Hi. > > After running valgrind on my program that is using sqlite (3.6.6.2, > statically linked on Linux, Ubuntu

Re: [sqlite] how sqlite use index

2008-12-09 Thread Martin.Engelschalk
Hello Rachmat, by creating one and using a fitting where- or order-by - clause. See http://www.sqlite.org/lang_createindex.html perhaps you would like to ask you question with a litte bit morte detail? Martin Rachmat Febfauza schrieb: > how to make sqlite use index? > > > > >

Re: [sqlite] Syntax for sql 'insert' for text with comma

2008-11-27 Thread Martin.Engelschalk
Hi, text constants have to be set between single quotes: insert into sometable values ( 5 , 'text' ) If the text contains a single quote, double it: insert into sometable values ( 5 , 'Don''t do this' ) Martin Mauricio schrieb: > Hi, > > I would like to > > insert into sometable values (

Re: [sqlite] Request to check UNICODE support

2008-11-24 Thread Martin.Engelschalk
Hi, sqlite supports unicode. Internally, thext is stored in UTF-8 or UTF-16, depending on sqlite3_open or sqlite3_open16, respectively. See http://www.sqlite.org/c3ref/funclist.html, There functions named sqlite3_xxx16 are described , which take UTF-16 as arguments. Martin [EMAIL PROTECTED]

Re: [sqlite] test error

2008-11-24 Thread Martin.Engelschalk
hi, attachments do not reach this list, please specify the error. Martin AVINASH MITTAL schrieb: > > Hi, > > while executing tests for amalgamation for version 3.6.5 i got this error, > can somebody help me in this regard > > Regards > ___ >

Re: [sqlite] How to install SQLite on a shared linux hosting

2008-10-17 Thread Martin.Engelschalk
Hello Luigi sqlite cannot be installed or run, but only compiled and inked into an application. There is no server. See http://www.sqlite.org/about.html Martin [EMAIL PROTECTED] schrieb: > I have been trying to understand if and how it is it possible for me > to install SQLite, but due to my

Re: [sqlite] problem with sqlite3_exec() and select sql statemant

2008-10-14 Thread Martin.Engelschalk
Hello Hariom, - use single quotes around text constants: select * from my_table where Primarykey='google.com' - use sqlite3_prepare and sqlite3_step to select data. First call sqlite3_prepare for your statement and then sqlite3_step in al loop until it returns SQLITE_DONE - It is not an error

[sqlite] How does the database file grow?

2008-07-01 Thread Martin.Engelschalk
Hi all, i create and fill database files which reach quite a large size after a while, because i only add data and never remove it. The database files themselves become quite fragmented on the disk. Because I can in many cases calculate in advance the size to which the file will grow, i would

Re: [sqlite] REQ: How do I change one character in a field value for another

2008-04-29 Thread Martin.Engelschalk
Hi, look at the replace() - Function at http://www.sqlite.org/lang_expr.html#corefunctions and use a statement like update Aircraft set OperatorFlagCode = replace(OperatorFlagCode, '~','-') where ... OperatorFlagCode like '%~%' Martin > Hi All, > > I need to change all occurances of a

Re: [sqlite] selecting uncommited rows

2008-04-17 Thread Martin.Engelschalk
Hi, there is a pragma: PRAGMA read_uncommitted = 1; You can select the uncommitted data and show ist before commit. Have a look here: http://www.sqlite.org/pragma.html Martin Alex Katebi schrieb: > Hi All, > > Let's say I start a transaction and do bunch of insertions etc. Before my > commit I

Re: [sqlite] How to use function in binding parameters ?

2008-04-08 Thread Martin.Engelschalk
Hello Marten, do this: insert into persons(name, birthday) values( ?, date(?)) And bind the string '1964-04-01' Martin Marten Feldtmann schrieb: > I'm not sure how to use a function call in a prepared statement: > > insert into persons(name, birthday) values( ?,?) > > how to I bind the value