sqlite

Dumping a table's content in sqlite3 to be imported into a new database

Is there an easy way of dumping a SQLite database table into a text string with insert statements to be imported into the same table of a different database? In my specific example, I have a table called log_entries with various columns. At the end of every day, I'd like to create a string which can then be dumped into an other database...

UITableView grouping sections

I have a UITableView that's populated using core data & sqlite. I'd like to have sections grouped in the UITableView based on an attribute from the database table. e.g If i had a category field in the database table called "type", what would be the best way of sectioning that data out? I've seen examples using arrays, but I'm getting...

Android thinks I'm not closing my database! Why?

I have a SQLiteDatabase data member that I initialize in onCreate and call .close() on in onPause(), onStop(), and onDestroy(). It is re-initialized in onResume(). It seems to run just fine but when I looked at the debugger it see this: 08-24 20:23:50.014: ERROR/Database(6767): Leak found 08-24 20:23:50.014: ERROR/Database(6767): java.l...

Random exception android.database.sqlite.SQLiteException: unable to open database file

My app uses a uncaught exception handler that sends the stack trace to me when the app crashes. Often I get this report from random users. I cannot replicate it, the opening of the database always succeeds in my case. This is not a database stored on external SD card, only a database opened with SQLiteOpenHelper(context, "SomeName", nu...

SQLite & MySQL - Same Query - Different Resluts - Multiple Joins

I have 2 databases with the same data, but slightly different data types in some fields (eg SQLite DB has TEXT where MySQL DB has varchar(50)) I run the following query: SELECT * FROM audio a, audiocodec ac, fileproperties f, transportstream t, transportservice ts, video v, videocontent vct, videoFrameRate vf, ...

Android: SQLite Not able to delete a specific record

Hi All, I m trying to delete a record from a SQLiteDB via Android Application,This is the way that i used the code to delete the record //Snippet of code in my DBAdapter Class public boolean DeleteRecord(String ContactName) { Log.i(TAG, "DeleteRecord(String ContactName)"); Log.i(TAG, ContactName); return db.delete(TABLE_...

Help with a loop

I'm looking for the best way to do the following.. I've got a loop like so... while(mcursor.moveToNext()){ String tname = mcursor.getString(4); String tmessage = mcursor.getString(7); String tlink = mcursor.getString(5); String tsname = mcursor.getString(3); Double tlat = mcursor.getDoubl...

Extended ContentProvider not behaving properly

I'm trying to implement a ContentProvider wrapped around an SQLite database. I've followed the tutorial here in building my ContentProvider: tutorial I want to test what I have; so I'm attempting to instantiate my new ContentProvider, retrieve a Cursor from the query handler, and attach it to my CursorAdapter. Currently, I'm doing th...

Selecting Sets of Contiguous Events in SQL

Okay so right now I'm working on a program that has a whole bunch of event objects. Each event object has a start time and end time (both full timestamps). A lot of the events are contiguous (one event's endTime is the same as the next event's startTime) showing that the two events happened in succession. If I were to store all my events...

Multiple request to a SQLite-based web page

Hi all, I develop web applications and I always used client/server databases (like MySQL) to store the application data. I would switch to an integrated DB engine like SQLite. I have a question. What happens if I have for example 1000 users visiting the web site and typing text in a textbox with suggestions (lots of request to the serv...

String concatenation does not work in SQLite

I am trying to execute a SQlite replace function, but use another field in the function. select locationname + '<p>' from location; In this snip, the result is a list of 0s. I would have expected a string with the text from locationname and the '<p>' literals. ...

sqlite - programmatically determine primary key(s)

I need to programatically determine what the primary key field(s) are for a given sqlite table (using sqlite api, not command line). I can get a list of tables and a list of columns, but only see the column type using the Column_Type() function. Need to know if a given column is the primary key (or part of the primary key if a compound...

Optimize getting counts of rows grouped by first letter in SQLite?

My current query looks something like this: SELECT SUBSTR(name,1,1), COUNT(*) FROM files GROUP BY SUBSTR(name,1,1) But it's taking a pretty long time just to do counts on a table that's already indexed by the name column. I saw from this question that some engines might not use indexes correctly for the SUBSTR function, and in fact, sq...

SQLite and elisp?

Is there SQLite wrapper for elisp? If not, is it a good idea to call python code that takes control of SQLite through start-process or something? Is there better way to use SQLite from elisp? ...

proper syntax for multiple values in a column in sqlite database browser

so i know this is a ridiculously silly question but im brand new to sql/sqlite and only 2 weeks into android programming.. but how to i enter multiple values into a single column in sqlite database browser? is there a proper syntax for it? ive got 2 columns.. groups and names and each group contains multiple names.. ie - group 1 = "john...

problem in sqlite database ,help!!!!

i have a problem in sqlite database connected with iphone sdk for eg. when i put values in lets say upto 5 primary key.but when i delete them all and put new values ,then the integer primary key start from 6 and not from 1 or 0?what is the reason for that? ...

C++/Qt Multiline strings; also, multiple queries

Hello, Two [hopefully] quick questions regarding C++/Qt. Is the following proper for writing a string on multiple lines? QString strQuery; strQuery="\ CREATE TABLE foo\ (bar integer primary key,\ baz varchar(20))"; I believe this is right, but in Qt Creator it doesn't highlight as though it is one ...

Prepared Statement with Select? Possible?

Hello, is it possible to use prepared statements with the SELECT command? I wrote in C++ following code: sqlite3_bind_int(this->ppGetStmt, 1, id); int rc = sqlite3_step(this->ppGetStmt); //sqlite3_result_int(this->ppGetStmt, &value); sqlite3_reset(this->ppGetStmt); The SQL statement looks like following SELECT value FROM test WHER...

Database calls in services

I've been watching Virgil's presentation at the Google I/O on REST-heavy applications. Google I/O 2010 - Android REST client applications Though the notepad tutorial makes database calls directly from the UI layer, Virgil suggests making database calls in a Service. At the moment, my Activity's onCreate method uses an extended Content...

Unexpected tables appearing in my SQLite database

Still beavering away, slowly sorting out how things work. Today I've been looking at persistent stores and managed objects. I think I understand the basics of it all, but I've noticed something odd. When I save my managed object context and open up the resulting sqlite file in an editor, there are three tables there I don't expect. They'...