sqlite

Using GROUP BY to fetch rows from SQLiteDatabase and then render them using SimpleCursorAdapter

I want to display total amount of seconds that was spent each day on a project. I want to use SQLiteDatabase to fetch rows using the query below and then use SimpleCursorAdapter to fill a ListView. SELECT projectId, date, sum(endedAt-startedAt) as hours FROM project_reports WHERE startedAt >= 1270098000 AND endedAt <= 1272776399 GROUP ...

How do manage the limit of executions to be done by hour (Max: 1000 requests per hour) without a database

I am currently developing a script in PHP to fetch webpages. The fact is that by doing so, I occasionally do too much requests to a particular website. In order to control any overflow, I would like to keep trace of how many requests have been done in the last hour or so for each domain. It doesn't need to be perfect, just a good estimat...

Cursor returns zero rows from query to table

I've created an SQLiteDatabase in my app and populated it with some data. I can connect to my AVD with a terminal and when I issue select * from articles; I get a list of all the rows in my table and everything looks fine. However, in my code when I query my table, I get a cursor back that has my tables columns, but zero rows of data. ...

create a indexed column in sqlite

Can I create index on a column in the create table command in sqlite? I tried this command below in sqlite3 in Android shell. It seems to work. sqlite> create table mytest (id integer indexed); sqlite> .schema CREATE TABLE mytest (id integer indexed); But, in sqlite's query language specification, specifying a column to be indexed is...

How to update SQLite DB on iPhone app update?

I currently have an iPhone app in the iTunes app store that uses a SQLite database as a datastore. The user can sync the app against a web service and data that is returned is then stored in the SQLite database. The user can also insert new items into the database and sync their changes back up to the web service. When a connection is o...

[Android] Putting Serializable Classes into SQL?

Here's the situation. I have a bunch of objects that implement Serializable that I want to store in a SQL database. I have two questions Is there a way to serialize the object directly into the database Is that the best way to do it or should I Write the object out to a formatting String and put it in the database that way and then...

SQLite get the 12th record - most efficient?

What's the best SQL query in SQLite to get the Nth item from a list of data. The data does not have numeric keys ...

Excel/SQLite date serial numbers

How can I get SQLite to convert excel-type serial numbers to dates, e.g. I want the integer 40074 in a table to somehow get the date 18-Sept-2009? The dates are already in SQLite. ...

SQLite and PostgreSql longtext

Hello all, Does anyone know how to change a column in SQLite and PostgreSQL to LONGTEXT? I have done so in MySQL successfully with: "ALTER TABLE projects MODIFY description LONGTEXT;" But this clause doesn't seem to work on SQLite. I tried hard to find documentation on PostgreSQL, but that site's format really makes people puke. SQLi...

Create sqlite3 database at prompt

I tried using the following commands to create a database file at prompt, but none of them would work. $ sqlite3 test.db sqlite3 test.db test.db does it require a semi-colon at the end or is it that hard to create a database file using sqlite3 prompt? Edit: When I start the sqlite3 prompt, I get SQLite version 3.6.22 Enter ".help" ...

Cannot commit in sqlite using a wrapper

- (IBAction)SetupButtonPressed:(id)sender { Sqlite *sqlite = [[Sqlite alloc] init]; NSString *writableDBPath = [[NSBundle mainBundle]pathForResource:@"Money"ofType:@"sqlite"]; if (![sqlite open:writableDBPath]) return; [sqlite executeNonQuery:@"CREATE TABLE test (key TEXT NOT NULL, num INTEGER, value TEXT);"]; } He...

Luasql and SQLite?

Hello I just got started looking at Lua as an easy way to access the SQLite DLL, but I ran into an error while trying to use the DB-agnostic LuaSQL module: require "luasql.sqlite" module "luasql.sqlite" print("Content-type: Text/html\n") print("Hello!") Note that I'm trying to start from the most basic setup, so only have the follo...

Android SQLite database gets corrupted

This link describes my problem exactly: http://old.nabble.com/Android-database-corruption-td28044218.html#a28044218 There are about 300 people using my Android App right now and every once and while I get a crash report to the server with this stack trace: android.database.sqlite.SQLiteDatabaseCorruptException: database disk image is m...

SQLite multi process access

Hello, We are using SQLite in a multi processes and multi threaded application. The SQLite database files are encrypted using the embedded SQLite encryption. The FAQ states that SQLite should be able to manage multi process accesses using locks mechanism. We are experiencing a strange problem: When many threads are accessing the same da...

is there a limit to the size of a sqlite database ?

I have read their limits faq, they talk about many limits except limit of the whole database. ...

SQLite locking file even though connection is closed

Shouldn`t the following statement be autocommited? I get an IOException trying to delete the file after executing the query. using (SQLiteConnection connection = new SQLiteConnection("Data Source=" + AppDomain.CurrentDomain.BaseDirectory + "data\\test.db;Version=3;")) { connection.Open(); SQLiteCommand command = new SQLiteComman...

SQLite Query to Insert a record If not exists

I want to insert a record into a sqlite table if its actually not inserted. Let's say it has three fields pk, name, address I want to INSERT new record with name if that name not added preveously. Can we do with this in a single Query. Seems like its slightly different from SQL Queries sometimes. ...

Android Cursor strange behaviour

After many houres of bug searching in a big app, I have finally tracked down the bug. This logging captures the problem: Log.d(TAG,"buildList, DBresult.getInt(1): "+DBresult.getInt(1)); Log.d(TAG,"buildList, DBresult.getString(1): "+DBresult.getString(1)); Log.d(TAG,"buildList, DBresult.getInt(4): "+DBresult.getInt(4)); Log.d(TAG,"build...

UISearchDisplayController

Well, i don't find any good tutorial or anything on the search bar. I don't understand how it works. Can you help me or give me a good link, or a sample code (i see the sample code TableSearch by Apple and it's definitively bad ^^) ...

SQLite Step Failed: attempt to write a readonly database , using wrapper

I keep getting an error "SQLite Step Failed: attempt to write a readonly database" when using this code to copy a database: -(void)createEditableCopyOfDatabaseIfNeeded { // Testing for existence BOOL success; NSFileManager *fileManager = [NSFileManager defaultManager]; NSError *error; NSArray *paths = NSSearchPathFo...