sqlite3

sqlite3 date and interval functions

Hi, I wonder whether sqlite3 supports interval function. The following statement is accepted by PostgreSQL, however sqlite3 failed to parse it; select ... from orders where ... and o_orderdate < date '1995-03-01' + interval '3' month Error: near line 4: near "'1995-03-01'": syntax error Then, I modified the statement a little ...

large databases in sqlite - file size considerations?

I'm using a sqlite db which is very convenient and seems to meet all of my needs at this point. Currently my db size is <50MB, but I now need to add a new table which will store large text blobs, which will cause the db to reach up to 5GB within the next year. Would sqlite be able to deal with a 5GB db size? Any caveats to that, compar...

The Risks involved in Re-creating a table on Sqlite3

I have an Sqlite3 table with a composite key that's not compatible with an upgrade I want to make. So I want to remove the composite key and replace it with a single integer rowid. According to http://www.sqlite.org/faq.html#q11, the only way to do this is to drop the table and recreate it with the new key: BEGIN TRANSACTION; CREATE T...

Ruby on Rails workaround for the mySQL max int: 2147483647 ?

I'm trying to use this number: 294670251400 This number will be an attribute in a model that is keeping counter tabs on membership cards. The membership cards have three four digit vanity sets. But when I update_attribute to contain this, the number is reset to mySQL's max int : 2147483647 Anyone have a workaround to this ? ...

Compiling SQLite into programs that run on Symbian 9.1 and above?

How can I use SQLite C API’s on any device running Symbian OS 9.1 or above? While it appears that 9.4 comes with SQLite built in prior versions do not. Looking at http://sourceforge.net/projects/sqlites60/ it appears that sQLite has been ported to older Symbian releases. The only problem is this code assumes you want to use SQLite with ....

Optimising Database Calls

I have a database that is filled with information for films, which is (in turn) read in to the database from an XML file on a webserver. What happens is the following: Gather/Parse XML and store film info as objects Begin Statement For every film object we found: Check to see if record for film exists in database If no film rec...

iPhone app crashes with sqlite3_bind_text()

I'm attempting to make a simple app that stores and displays flash cards, however I'm having an awful time getting my SQLite to work. The database connection is fine, but when I try an insert, it crashes and gives no indication of what went wrong. This is the code I am using to insert the flash card into the table. const char *insert =...

how to write sqlite update operation in two tables?

I am using SQLite, TABLE A ( ID FileNAME FOLDERID ) TABLE B ( FOLDERID FOLDERPATH ) I want to write a sql statement to delete all files in A where its Folder is subfolder of C:\ABC\; How Can I make it in one sqlite statement, and is it the best way to do? Many thanks! ...

how to build a index table(python dict like) in python with sqlite3

Suppose I have one string list may have duplicated items: A B C A A C D E F F I want to make a list can assign an unique index for each item, looks like: 1 A 2 B 3 C 4 D 5 E 6 F now I created sqlite3 database with below SQL statement: CREATE TABLE aa ( myid INTEGER PRIMARY KEY AUTOINCREMENT, name STRI...

Understanding how large sqlite databases works on top of jffs2

I am considering using sqlite3 on embedded Linux with JFFS2/NAND instead of using a file based approach. My concern is NAND wear and number of erase operations. So how will e.g. the scenario of deleting or inserting a row in a 12MB database work: Will the whole 12 MB database be re-written when I commit, thus queueing all 12MB of NAN...

sqlite3 timestamp column

Hi I feel stupid, but I can't get a TIMESTAMP column to be shown in human understandable way in a SELECT. I could do that in MySQL, not in sqlite3. Could someone show me an example please? Thanks ...

Heroku throws SQLITE3 Read only exception

After I deploy an app to Heroku, I run migration scripts and get this error message ...ites\padrino\prophetmargin> heroku rake ar:migrate rake aborted! SQLite3::ReadOnlyException: attempt to write a readonly database: CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) /disk1/home/slugs/215264_925fd2c_65a3/mnt/.bundle/gem...

choosing between requery or firing the query again in SQLite

hi Friends, i have been using a SQLite database, Theres a situation where i have a list which displays all the "name" field data of a table "table1". Now i have a button to insert data in "table1". The list is populated using a simple cursor adapter which is passed a cursor "cursor1" populated with the data. "cursor1" is prepared using ...

Switching Django project from sqlite3 backend to postgresql failes when loading datadump

I am currently using sqlite3 as the DB for one of my Django projects. I want to change this to use postgresql, and I would like to keep all the data intact. I used ./manage.py dumpdata > dump.json to create a dump of the data, and changed my settings to use postgresql. Trying first with an empty database to do ./manage.py loaddata dump....

Creating initial SQLiteDatabase when app is installed

I am writing an app that displays fun-facts (and the source they are from). The user can browse through the facts one by one. Here is the design I thought of : Create a table in SQLiteDatabase with a text column that stores the fun-fact and a second column that stores it's source. (not sure if this is the best way to go about doing it...

Sqlite database is not updating

Hi am new in this field.i am trying out one app. i am storing data in sqlite database. i am only using sqlite for my app when i add data into table from my app, I can see changes in my simulator but when i check my database there is no change and when i reset my simulator all my added data is gone. Please help me. i don't know what is w...

Can I start logging application-initiated sql queries so I can learn what it's doing?

Hey, I'm learning an ecommerce package (Spree). The problem arises after I delete a product thru the GUI. I try to manually undo the delete by changing/adding rows back in, but I fail. My question is this: is there any way I can add application or dbms code/config/software to log transactions? Preferably, this will work with sqlite3,...

SQLite count(*) how to get the result?

i've done this code to count the numbers of row in a db int rows = 0; if (sqlite3_open([[SqliteManager getDBPath] UTF8String], &database) == SQLITE_OK) { const char *sql = "select count(*) from artheca"; sqlite3_stmt *countstmt; if(sqlite3_prepare_v2(database, sql, -1, &countstmt, NULL) == SQLITE_OK) { ...

Problem with sqlite3 prompt,plz help me

Hi guys, i have problem with sqlite3 shell prompt i.e I have created 2 tables called table1 and table2 in sqlite3 shell prompt and also i have imported table1.dat and table2.dat in table1,table2 respectively.If i close the sqlite3 window and open it again it is not showing tables it is giving error as "no such table". Is there any solu...

SQLiteDatabase.insert() returns incorrect rowid for virtual tables

Hello, When I insert a row into a full-text search database declared like: CREATE VIRTUAL TABLE foo USING fts3 (bar); the SQLiteDatabase.insert() method returns an incorrect rowid. If the table is declared like: CREATE TABLE foo (bar VARCHAR(10)); it returns the correct rowid value. The problem is when I query the database soon af...