sqlite

synchronize android sqlite database

What is the best way to synchronize android sqlite database with MSSql/MySQL database at the backend (over http?).? ...

Trace SQLite queries (.NET & NHibernate)

I'm using System.Data.SQLite with NHibernate & Fluent NHibernate. I encountered some strange bug and I would like to log all queries executed on the SQLite database. I already know about the ShowSQL NHibernate configuration option but I would like to log directly from SQLite. I found out about sqlite3_trace() but how to use it from .Ne...

Sqlite 3: How to DROP TABLE IF EXISTS?

My version of sqlite does not support IF EXISTS operator. So how can I drop a table which may or may not exist without getting an error slapped at me? EDIT: FYI, IF EXISTS and IF NOT EXISTS were added to SQLite 3.3.0 http://www.sqlite.org/releaselog/3_3_0.html. That's not my solution though, I can't update the version on a live applica...

sqlite filtering by sum

I have a database with 1000 records containing a file name and a file size on each row. If the SUM of all file sizes exceeds a specific limit, then: - I need to create a sql query to delete all the remaining rows, from oldest to newest Any suggestions? Thanks ...

how do I override the autoincremented primary key when doing an insert

In MS SQL I would use SET IDENTITY INSERT ON How do I do something similar in SQLite. I am trying to upgrade a database and want to maintain the IDs from the original Thanks ...

Exception while reading an empty table

Iam trying to read data from a table. Initially it is empty. If i tried to read at that time it will cause an exception. My code is given Below -(NSMutableArray *) selectDataFrom:(NSString *) tableName { NSString *qsql = [NSString stringWithFormat:@"SELECT * FROM '%@' ",tableName]; sqlite3_stmt *statement; if (sqlite3_p...

Django South removes foreign key REFERENCES from SQLite3 schema. Why? Is it a problem?

When using syncdb the following schema is created: CREATE TABLE "MyApp_supervisor" ( "id" integer NOT NULL PRIMARY KEY, "supervisor_id" integer NOT NULL REFERENCES "MyApp_employee" ("id"), "section_id" integer NOT NULL REFERENCES "MyApp_section" ("id") ); When using migrate, it is changed to: CREATE TABLE "MyApp_superviso...

Sqlite Memory issue

Hello, I am using the following lines to insert statement . [self initiateFMDB]; const char * sql = "INSERT INTO DrawingInfo(title, data, size, red_comp, green_comp, blue_comp) VALUES(?, ?, ?, ?, ?, ?)"; sqlite3_stmt *insert_statement = nil; int dbrc; // database return code const char* dbFilePathUTF8 = [path UTF8String]; dbrc = ...

How to save cursor in activity?

Hi everyone, I'm population my listView using Cursor, but when I navigate away from my activity and then return back my listview is empty. Here is my code: @Override public void onCreate(Bundle savedInstanceState) { ... DBAdapter db = new DBAdapter(context); db.open(); Cursor c = db.getAll(); db.close(); startManagingCursor(c); Stri...

sqlite encryption/decryption + sqlcipher + iPhone

Hi everyone, I have been trying to encrypt/ decrypt a sqlite database in my iPhone project. I am able to encrypt the database by using the reKey method. But I am unable to decrypt it. I have kept my sqlite.db file in a folder. Currently trying it on a simulator. Code snippet: [[SQLiteDB sharedSQLiteDB] open: withKey:@""]; [[SQLiteDB ...

Best practices of working with multiple sqlite DB tables in Android

Hi guys, in my android app I use a DB with multiple tables, I have an XML parser which needs to write data to 2 tables while parsing. I created 2 DBadapters for 2 tables, but now I have a problem. When working with one table it's easy, I can do: FirstDBAdapter firstTable = new FirstDBAdapter(mycontext); firstTable.open(); // open and ...

Staggering sqlite records with Objective C

An iphone app we are producing will potentially have a table with 100,000+ records (scaling wise) and I am concerned that loading all this data via a SELECT * command into an array, or an Object will either make the app very slow; or will leave me with memory issues later on. Obviously loading 100,000+ records into an array when the vie...

export & import blob between sqlite3, xml and iPhone

I have problems with download and upload blob data in my iPhone app using Sqlite. Everything seems to be ok if I insert the photos in the blob field with SQLite manager: I can read the image and manage it with my app. When I export the table to xml with the SQLite manager's feature, it creates a file that contains in the photo field a v...

Querying Android db for specific piece of data

I'm creating a method that will see if a column in a database row is populated; and if so, it returns the varchar in that row, else it calls a web service to return that data. My question is: What is the standard way of simply selecting a column with Android? (select mycolumn from mytable where _id = x;) I've created a ContentProvider...

Does Sqlite on the Iphone reorder database rows when I delete a row?

I'm quite new to iphone programming. I would like some information with you. Here is the structure of my database: ID_song : auto-int (primary key) txt_song : text When we do delete some data from a table view, and when the data is deleted from the SQLite database, let's say I have only 3 songs in my database id_song:1 txt_song:Song_...

Encryption / Decryption sqlite database using java

Hello, Is there any free library / Java API to encrypt and decrypt sqlite database in java ? I am using SQLite JDBC driver as part of xerial project. Thanks, Deep ...

Is it safe to close SQLite db more than once?

I'm using SQLite with python. My code for closing SQLite DB is as follows. def close(self): if not self.closed: self.db.closeDB() self.closed = True def closeDB(self): self.cursor.close() I have one variable 'closed' not to close the db twice. Is this variable necessary? What would happen if I call the close...

Why do we need connector.commit() after execution?

I have a SQLite/Python code that runs the query command as follows. def queryDB(self, command_):_ self.cursor.execute(command_) self.connector.commit() # <---- ??? ... it works pretty well, but I have some questions. Why connector.commit() is needed? What does it do? What does cursor.execute() do? ...

How to get queried results with Python/SQLite?

I'm using Python/SQLite for accessing database. After running the query, and getting the result, I want to know the number of rows, the number of columns, and the name of the column from the queried result and database. For example if I run "SELECT * from table", and I get id name number -------------------- 1 John 10 2 ...

How do I find the count of columns before the first occurrence of LIKE?

Sorted on column Y X Y Z ------------------------ | | A1 | | ------------------------ | | B2 | | ------------------------ | | C3 | | ------------------------ -----Page 1 | | D3 | | ------------------------ | | E4 | | ------------------------ | | ...