sqlite

SQLLite, NOT EXISTS doesn't work

Ok, let's say from start I'm not a SQL ninja. Anyway I'm using SQLite in a tiny project of mine. I've this test table: CREATE TABLE [prova] ( [id] INTEGER PRIMARY KEY UNIQUE, [str] TEXT NOT NULL ) and this query won't work: insert into prova (id, str) select null as id, "foo" as str where not exists (select * from pr...

Nested transactions with SQLAlchemy and sqlite

I'm writing an application in python using sqlalchemy (and Elixir) with sqlite as the database backend. I start a new transaction using the code session.begin_transaction(), but when I call session.rollback() I get the following error: sqlalchemy.exceptions.OperationalError: (OperationalError) no such savepoint: sa_savepoint_1 u'ROLLBAC...

SQL scheme conversion script for MySQL, PostgreSQL, SQLite …

I’m looking for a script that allows me to define my database relations in a simple model file and have the possibility to convert this scheme definition to the explicit formats for MySQL, PostgreSQL and SQLite. The format could be similar to the definitions you would do in activerecord, so if all fails, I will somehow go with AR if I ca...

Binding command-based SQLite to a data source?

Hi. I'm trying to use SQLite in my application, and it's been bumpy. A few things, first off. Due to having VS 2008 Express, SQLite design-time support is nonexistent. I've done some reading and i'm rather confused about how to use command-based sql connections with standard data controls, ie gridview. If the views ask for data sources...

iPhone - Read password encrypted sqlite database

I can open a regular sqlite database on iPhone with sqlite3_open([filename UTF8String], &database); But how do I open a password encrypted database? ...

Sqlite3: Need to Cartesian On date

I have a table which is a list of games that have been played in a sqlite3 database. The field "datetime" is the a datetime of when game ended. The field "duration" is the number of seconds the game lasted. I want to know what percent of the past 24 hours had at least 5 games running simutaniously. I figured out to tell how many game...

Transfer MySQL to SQLite

I want to start using Core Date on iPhone with pre-existing MySQL databases. What's the easiest way to transfer a MySQL database to SQLite? I've tried using SQLite Migrator, but I don't know where to find the ODBC drivers for Mac (Snow Leopard). I found http://www.ch-werner.de/sqliteodbc/ which seems to have drivers, but they are for Po...

Foreign language characters in iPhone SQLite

I'm creating an app for the iPhone that will hold Portuguese characters. When I query the database from within my app I get a null for the field that contains a special character. Do I have to do something in special during the initial insertion of those records into the database? thanks, foreignerbr ...

Confusion about System.Data.SQLite.dll

The site, http://sqlite.phxsoftware.com/, talks about a mixed-mode assembly and a managed-only version of the provider. Are they both named System.Data.SQLite.dll? I installed the managed-only version in windows and it is working. Which, as I understand it, means that I must also have the native sqlite3.dll file somewhere on my machin...

Encoding problem in sqlite and objective-c

I have a file with contents something like this: INSERT INTO table VALUES (NULL,'° F','Degrees Fahrenheit'); INSERT INTO table VALUES (NULL,'° C','Degrees Celsius'); Now, to parse this, I have something like this: NSString *sql = [NSString stringWithContentsOfFile:filename]; Printing this string to the console looks correct. Then,...

Group by in SQLite over one subset of a set based on the elements of another subset of the set...

I have a dataset something like this A | B | C | D | E ----------------------------------------------- 1 | Carrot | <null> | a | 111 2 | Carrot | <null> | b | 222 3 | Carrot | zzz | c | 333 4 | Banana | <null> | a | 444 5 | Banana | ...

Creating database tables with "either or" type fields.

I have a database that tracks players through their attempts at a game. To accomplish this, I keep a table of users and store the attempts in a separate table. The schema for these tables is: CREATE TABLE users ( id BIGINT PRIMARY KEY, -- the local unique ID for this user name TEXT UNIQUE, -- a self-chosen username for the user ...

Convert SQLite DB files to "LINQ to SQL" like SQLMetal.exe

How do I convert SQLite DB files to LINQ ORM files? Is there any utility like SQLMetal.exe? ...

In Flex, is it posible to identify if the code is runing on Web or AIR?

Im doing an app that runs both in the web and on AIR, to avoid copying code arround, I figured I should do 3 kinds of proyects on flex builder: Library, Web and AIR proyects. So all my code is on the Library proyect. I have accessData.as that extends EventDispatcher to fetch web services and return them as an event, I plan on using thi...

Using SQLite How do i index columns in a CREATE TABLE statement?

How do i index a column in my CREATE TABLE statement? The table looks like command.CommandText = "CREATE TABLE if not exists file_hash_list( " + "id INTEGER PRIMARY KEY, " + "hash BLOB NOT NULL, " + "filesize INTEGER NOT NULL);"; command.ExecuteNonQuery(); I want filesize to be index and would like it to be 4bytes ...

How do i do an SELECT in an INSERT?

I want to do something like this INSERT INTO link_list(link, status, hash_type, hash_id) VALUES(@link, @status, @hash_type, @hash_id); INSERT INTO active_dl(fileId, orderNo) VALUES(last_insert_rowid(), SELECT COUNT(*) FROM active_dl); But obviously it is wrong and theres a syntax error on select. How do i write this? Using sqlite. ...

Strange result with

When i run this as my first commend i get an exception an error near "last_insert_rowid". This is referring to the last last_insert_rowid();. If i set the curser to the line command.CommandText = and run it again it is fine. What gives? The last_insert_rowid seems to be working properly why doesnt the last_insert_rowid after the 2nd ins...

SQLite , Derby vs file system

Hi All, I'm working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate to this system and embed a database in my application? are there real performance gains? Thanks a lot ...

How to use SQLite in a multi-threaded application?

I'm developing an application with SQLite as the database, and am having a little trouble understanding how to go about using it in multiple threads (none of the other Stack Overflow questions really helped me, unfortunately). My use case: The database has one table, let's call it "A", which has different groups of rows (based on one of...

JOIN after processing SELECT

Given the following schema: CREATE TABLE players ( id BIGINT PRIMARY KEY, name TEXT UNIQUE ); CREATE TABLE trials ( timestamp TIMESTAMP PRIMARY KEY, player BIGINT, score NUMERIC ); How would I create a SELECT that first finds the best scores from trials, then joins the name field from users? I've been able to get the score...