sqlite

How do you insert an image into SQLite on the iPhone?

hello, I want to insert an image in sqlite3, i have created table using "create table table1(photo blob,name varchar(10));" Now i want to insert an image in to it,so what is syntax for insert image into it? and in another table i want to store location of the image so for second table what is my create table and insert table syntax. Can ...

SQLite in Python 2.2.3

I've written a web-app in python using SQLite and it runs fine on my server at home (with apache and python 2.5.2). I'm now trying to upload it to my web host and there servers use python 2.2.3 without SQLite. Anyone know of a way to use SQLite in python 2.2.3 e.g. a module that I can upload and import? I've tried butchering the module f...

SQLite optimizing multi-select insert

Hi All, I've been using SQL for years now but rarely anything more that simple inserts and selects etc... so I'm no SQL expert. I'm wondering if I could get some help in optimizing a more complex SQL statement that I'm executing on SQLite, from PHP through PDO. The statement seems to work correctly, just seems to take longer that I wo...

How to bind literal text to an SQLite query?

I'm trying to use the SQLite C API in my iPhone app. I'm trying to query an SQLite database for the number of records that have been completed after a certain date. The database saves the completed date as text in YYYY-MM-dd format. For example the text 2009-04-10 might appear as a completed date. When I query the database from the comm...

"ImportError: No module named dummy" on fresh Django project

I've got the following installed through MacPorts on MacOS X 10.5.6: py25-sqlite3 @2.5.4_0 (active) python25 @2.5.4_1+darwin_9+macosx (active) sqlite3 @3.6.12_0 (active) python25 is correctly set as my system's default Python. I downloaded a fresh copy of Django 1.1 beta (I have the same problem with 1.0 and trunk, though) and instal...

SQLite - getting closest value

Hi, I have SQLite database and I have in it certain column of type "double". I want to get a row that has in this column value closest to a specified one. For example, in my table I have: id: 1; value: 47 id: 2; value: 56 id: 3; value: 51 And I want to get a row that has its value closest to 50. So I want to receive id: 3 (value = 51...

sqlite3_bind_xxxx, sqlite3_column_xxxx - first parameter

Hi, I have the following statement: SELECT title, price FROM table WHERE id=? Should I use to bind ID: sqlite3_bind_int(myStmt, 0, current_id); or do I have to use: sqlite3_bind_int(myStmt, 1, current_id); My question is - what should be the first binding parameter - 0 or 1? The same question about getting data with sqlite3_col...

getting a Webkit executeSql transaction to return a value

How can I get the following JavaScript to return row so I can access it outside the transaction? All of Apple's example code seems to have HTML written to the browser within the transaction instead of ever passing data back to a calling function. Along the lines of: function getData() { db.transaction(function(tx) { tx.executeSql...

Database recommendation

I'm writing a CAD (Computer-Aided Design) application. I'll need to ship a library of 3d objects with this product. These are simple objects made up of nothing more than 3d coordinates and there are going to be no more than about 300 of them. I'm considering using a relational database for this purpose. But given my simple needs, I don'...

sqlite, mono, C# cross platform

I am using sqlite in my C# project. MoMA complains about the DLLs and i am unsure what to do on the mac/linux side. What are things i generally need to do when porting external DLLs? ...

Inserting records with SQL Lite

What is the SQL Lite statement for "insert"? I have tried insert into table1 values(field1,field2) values (?,?) but this returns an error in the statement -- how do I do this? ...

SQLite - storing multiple values

Hi, how can I store and retrieve in SQLite database multiple values for the same row of the same column? i.e. I have a product column and another column is stores, where I put in all the stores, where it is possible to get this product: Product: iLamp; Stores: River's; McWay; Lonnie's; ... How can I implement this? Thank you in adva...

SQLite - increase value by a certain number

Hi, is it possible to increase a certain value in a table by a certain number without reading last value and afterwards updating it? i.e. I have columns "product" and "quality": product: iLamp quality: 50 I want to increase(or decrease) quality by x. To achieve this I am first reading last value (50), increasing or decreasing it, and w...

How to properly call SQLite functions from background thread on iPhone?

I'm using an SQLite database in my iPhone app. At startup, there are some database actions that I want to perform in a separate thread. (I'm doing this mainly to minimize startup time.) Occasionally/randomly, when these database calls are made from the background thread, the app will crash with these errors: 2009-04-13 17:36:09.932 Act...

sqlite, UPDATE OR REPLACE

I do something like UPDATE OR REPLACE someTable SET a=1, b=2 WHERE c=3 I expect if it doesnt exist it will be inserted into the DBs. But nothing happens and i get no errors. How can i insert data, replace it if it already exist and use a where for the condition (instead of replacing BC of a unique ID) ...

MySQL and SQLite differences in SQL

I'm writing java application that is using both SQLite and MySQL using JDBC. Are there any differences in SQL for those databases? Can I use same queries for both SQLite and MySQL, or is there any db specific stuff, that doesn't work on the other one? As far I've worked only with MySQL, so I don't really know much about SQLite. ...

sql query - how to apply limit within group by

hey guys assuming i have a table named t1 with following fields: ROWID, CID, PID, Score, SortKey it has the following data: 1, C1, P1, 10, 1 2, C1, P2, 20, 2 3, C1, P3, 30, 3 4, C2, P4, 20, 3 5, C2, P5, 30, 2 6, C3, P6, 10, 1 7, C3, P7, 20, 2 what query do i write so that it applies group by on CID, but instead of returning me 1 si...

SQLite - value at range

Hi, I am updating my table with the following statement: UPDATE table SET percentage = percentage + ? WHERE id = ? And the value that is being passed to the database may be positive and negative as well. Is there a way to make sure that the percentage value is going to lie in the range of 0..100? Desirable to accomplish it, using onl...

SQLite vs HSQLDB

What are the main differences between SQLite and HSQLDB? There are lots of applications using both of them, but I don't really see any major difference. ...

How to insert a SQLite record with a datetime set to 'now' in Android application?

Say, we have a table created as: create table notes (_id integer primary key autoincrement, created_date date) To insert a record, I'd use ContentValues initialValues = new ContentValues(); initialValues.put("date_created", ""); long rowId = mDb.insert(DATABASE_TABLE, null, initialValues); But how to set the date_created col...