sqlite

Can you achieve a case insensitive 'unique' constraint in Sqlite3 (with Django)?

So let's say I'm using Python 2.5's built-in default sqlite3 and I have a Django model class with the following code: class SomeEntity(models.Model): some_field = models.CharField(max_length=50, db_index=True, unique=True) I've got the admin interface setup and everything appears to be working fine except that I can create two Som...

How can I use SQLite to open a database from memory?

It looks like all the methods for loading SQLite involve loading from a named file using a string. I would like to load SQlite database from memory. The database is already loaded into memory. ...

Difference between 2 dates in SQLite

How do I get the difference in days between 2 dates in SQLite? I have already tried something like this: SELECT Date('now') - DateCreated FROM Payment It returns 0 every time. ...

PowerBuilder app with embedded database?

Is it possible to use e.g. SQLite with PowerBuilder? I need an embedded open source database (no additional costs). ...

SQLite non-exclusive RESERVED lock?

I've been looking into improving SQLite performance for my site, especially with regard to transactions. In essence what I'm looking for is a way to defer database writes in a process so that they can all be done at once. However, while I'm accumulating update queries, I would like other processes to be able to both read from and write t...

Light weight alternative to Hibernate?

I have a single user java program that I would like to have store data in a light weight database such as Derby or Sqlite. I would like to use a data abstraction layer in my program. Hibernate appears to require a lot of configuration and is overkill for what I need. What are light weight alternatives to Hibernate? ...

Objective-C and sqlite's DATETIME type.

I have a sqlite3 table that I'm trying to map to an object in objective-C. One attribute of the table is 'completed_at' which is stored as a DATETIME. I want to create a property on my objective-C class (which inherits from NSObject) that will map well to the 'completed_at' attribute. Objective-C has an NSDate type but I'm not sure if ...

Bug in SQLite self-join on id?

I'm trying to generate pairwise combinations of rows on based on their ids. SQLite version is 3.5.9. The table contents are the following: id|name|val 1|A|20 2|B|21 3|C|22 with table schema being: CREATE TABLE mytable ( id INTEGER NOT NULL, name VARCHAR, val INTEGER, PRIMARY KEY (id) ); Then there's the self-jo...

How do I create a sqllite3 in-memory database?

One of the appropriate uses for sqlite3 is "in-memory databases". This sounds like a really useful tool for my C++ applications. Does anyone have an example of how this is done in C or C++? I'm specifically looking for a canonical way to slurp several flat-files into an in-memory database, then do some joins. ...

Does SQLite support SCOPE_IDENTITY?

I'm trying to perform a simple INSERT and return the identity (auto-incrementing primary key). I've tried cmd.CommandText = "INSERT INTO Prototype ( ParentID ) VALUES ( NULL ); SELECT SCOPE_IDENTITY();"; and I receive the following error EnvironmentError: SQLite error no such function: SCOPE_IDENTITY Does SQLite support SCOPE_IDENTI...

get list of tables, db schema, dump etc in Python sqlite3

For some reason I can't find online or in the docs the way to get the equivalents of sqlite's interactive shell commands: .tables .dump in Python's sqlite3 API. Is there anything like that? Am I missing something? -N. ...

Importing a SQLite3 dump back into the database

I feel like this is a stupid question because it seems like common sense . . . but no google search I can put together seems to be able to give me the answer! I know how to get data OUT of a sqlite3 database using the .dump command. But now that I have this ASCII file titled export.sqlite3.sql . . . I can't seem to get it back INTO the...

how can I determine the number of affected rows in a SQLite 2 query in PHP

I'm writing an application in PHP 5. I want to delete some rows in a SQLite v2 database file. I'm doing something like this: $sqliteConnection = new SQLiteDatabase('path/to/db'); $queryString = "DELETE FROM myTable WHERE status='not good'"; $result = $sqliteConnection->query($queryString); how can I know how many rows were affected by...

With System.Data.SQLite how do you specify a database file in the connect string using a relative path

Wanting to deploy my project on different servers I would prefer to be able to specify a connect string using a relative path. I can't seem to get that to work and want to know if there is some trick to it...? ...

How do you use LINQ with Sqlite

Would someone explain how to get LINQ working with Sqlite. ...

SQLite C/C++ API unsigned char *

Why does the SQLite C/C++ API return unsigned char *s for text values as opposed to the more de-facto char * type? This is somewhat related to the unsigned char question, except that the SQLite API's decision seems opposite of the conventional char * advice given for string-like values. For example: const unsigned char *sqlite3_column...

Column names for a table formed by a UNION

Given a couple of simple tables like so: create table R(foo text); create table S(bar text); If I were to union them together in a query, what do I call the column? select T.???? from ( select foo from R union select bar from S) as T; Now, in mysql, I can apparently refer to the column of T as 'foo' -- the name ...

Is sqlite suitable for use in a production website?

I'm rewriting a PHP+Mysql site that averages 40-50 hits a day using Django. Is sqlite a suitable database to use here? Are there any advantages/disadvantages between them? I'm just using the db to store a blog and the users who can edit it. I am using fulltext search for the blog search, but no complex joins anywhere. ...

Does the pointer get from sqlite3_column_blob() method need to be delete?

Like this: const void * test = sqlite3_column_blob(stat, 1); Can I delete or delete[] test? ...

What is the best way to sync 2 sqlite tables over http and json?

I have a fairly simple sync problem. I have a table with about 10 columns that I want to keep in sync between a sqlite file on 3 different clients: an Iphone client, a browser client, and a Ruby on Rails client. So I need a simple sycing solution that will work for all 3, i.e. I can easily implement it in Javascript, Objective C, and R...