sqlite

How to run a query with regexp in Android

I want to run a query in SQLite with a regexp using Android. How do I do that? ...

Hi I need to write Insert Query in SQLite3 in iPhone

Hi need insert data in table if the record is not already exits Ex: IF NOT EXISTS (SELECT Id FROM table WHERE id=_Id) THEN INSERT INTO tbale(.....) This can be easily done using stored procedure in MySql. But I want to d same thing in SQLite by writing a single query statement. Pleas help ...

How to run SQLITE in a Windows Mobile Application developed with Qt

I am trying to run a simple SQLITE application on Windows Mobile developed with Qt. However I can't manage it, though I have developed other Windows Mobile apps with Qt. The fundamental error is Mobile Device/Emulator can't find SQLITE driver, as I get "Driver not found" error and the following code snippet proves it as well: #include <...

SQLite error: cannot commit transaction - SQL statements in progress using Java Code

Hi All, I am facing an SQLite error though I am not using any explicit AutoCommit true or false. can anyone provide any input on this error. What are the situation where you will get this error. Thanks in advance. Regards, Manasi Save ...

Does "insert" in SQLite return SQLITE_OK or SQLITE_DONE?

Hi, What does statement "insert" in SQLite return in case of success? I always believed that it should be SQLITE_DONE, but recently in my logs I found out the following string: sqlite3_step error: 'not an error' And here is the code that logs the mentioned string: prepareStatement(addTranslationStmt2, "INSERT INTO translations(lang...

Strange SQLite behavior

Hi, I am inserting data into a table and sqlite3_step returns SQLITE_DONE. But sometimes there is no new data in the table! Even if I do the check immediately after the data was added. Here is my code: sqlite3_stmt *addTranslationStmt2 = NULL; if(sqlite3_prepare_v2( database , "INSERT INTO translations(lang1_wordid, lang2_wordid) VAL...

How to commit changes in SQLite?

Hi, I've got a problem in my database - somehow changes sometimes are not being autocommitted so I need to COMMIT the manually. How can I do this? What code do I have to write in objective-C in order to commit changes in SQLite? I am developing an iPhone application. Thanks. ...

Are less tables better than more?

I'm implementing a small time tracking app and I can't decide between two database designs. The first has all the log entries in a single table, ie. TimeLog ------------- job_id : long timestamp start : boolean [or perhaps 'type : enum'] _id : long The other option is to have two tables, one for 'start' entries the other...

SQLite triggers and raising events in other processes

I'm new to triggers so I apologize if this is a stupid question. Is it possible to have a trigger (or some other database mechanism) raise an event in another process. For instance, I need an application to be made aware of a certain activity (update in a specific table with specific data), but I'd rather not have that process poll the...

SQLite query optimization (subquery and join) help

I have a table for a Statistical project. Structure is like this: CREATE TABLE NewStatHistory ( StatHistoryID uniqueidentifier PRIMARY KEY NOT NULL, DateEntered dateTime NOT NULL, DateApplies dateTime NOT NULL, WhoEnteredID uniqueIdentifier NOT NULL, PostingID uniqueIdentifier NULL, EnteredValue decimal(19,5) NO...

Can I download an SQLite db on /sdcard and access it from my Android app?

I already found out that there is no way to bundle files in an .apk and have them on /sdcard, the best option so far being to download the large files upon first run. I came accross a tutorial saying how to bundle an sqlite db with the apk and then copy it so that it can be accessed with SQLiteDatabase (thus doubling the space needed, an...

SQLite Parameter Issue with Guids

I am having issues with getting Guids to match in SQLite (0.4.8) when using parameters, when I use something like userGuid = 'guid here' it works, but userGuid = @GuidHere it does not. Anyone have any ideas? Create: CREATE TABLE Users ( UserGuid TEXT PRIMARY KEY NOT NULL, FirstName TEXT, LastName TEXT ) Sample Data: INSE...

Subsonic in Medium trust level

i host my web site in shared hosting server, this server use the default Medium trust level When i execute this ConfigurationDataCollection configurationDatumCollection = new ConfigurationDataCollection().Where(ConfigurationData.Columns.Name, configurationSectionName).Load(); i get this error That assembly does not allow partially t...

Updates to existing app

Hi, I have an App using sqlite. On first start, I copy the .db file into NSDocumentDirectory (so that I can make updates to it). In later versions, I plan to add new data to this database. How can I make sure, that with every application update (but not with every app start) the newest copy of this DB will be copied to NSDocumentDirecto...

Activerecord, select on string compare

Hi all, I have a table called Basic , start_time is one field with type :VARCHAR(5), which actually stores a 5 bytes time data: byte 0 and 1 map to the year , month and day, and byte 2 to 4 map to the hour, min and second. So, it could possible bytes 2 ,3 ,4 are all 0. And I want to do following query : Basic.find (:all , :conditions =...

SQL bulk update, a field increment

So i learned how to do a bulk insert using data from one table as the userId from another table. Now i tried to do the same thing but i have a SQL(ite) error. I took a guess at the syntax and i got it wrong. After i bulk insert into the subscription i want to add 1 to each of the users media count. I have a left join error. How do i corr...

Checking an empty Core Data relationship (SQLite)

I have a to-many relationship in my data model, and I'd like to get all the objects that have no corresponding objects in the relationship. For example: Customer -> Purchases I want to get all Customers that have 0 Purchases. I've read somewhere that I could use "Purchases[SIZE] = 0", but this gives me an unsupported function express...

Noob question on SQL and sqlite triggers

I’m trying to write a trigger for sqlite and just running into all kinds of problems. In truth I think my real problem is with my poor background in the sql language. Anyway here goes… I have two tables Table1 and Table2. Table1 has a column named time (which is a 64bit integer time). I need a trigger that watches for a new row bein...

Is it possible to do a bulk update?

Is it possible to bulk update? I did a build insert, now I would like to update each of the user IDs to increase the count. Here's a sample of my build insert void updateMediaForSubscribers(long userId, long mediaId, Media_Base.Catagory cat, DateTime currentDate) { command.CommandText = "INSERT INTO user_media_subscription ...

How do i fail when DELETE doesnt DELETE?

The problem i have is i could DELETE but then when i hit refresh and send the post data it will try to delete again. Which isnt a problem but now the second statment is a problem since it decreases when it shouldnt. What is a concurrent safe way to decrease but only if delete has removed an entry? note msgId is a PK so i'll either dele...