sqlite

What does the COLLATE keyword do when creating a sqlite index?

According to the sqlite3 documentation, The COLLATE clause following each column name defines a collating sequence used for text entries in that column. The default collating sequence is the collating sequence defined for that column in the CREATE TABLE statement. Or if no collating sequence is otherwise defined, the bu...

Clean way to find ActiveRecord objects by id in the order specified

I want to obtain an array of ActiveRecord objects given an array of ids. I assumed that Object.find([5,2,3]) Would return an array with object 5, object 2, then object 3 in that order, but instead I get an array ordered as object 2, object 3 and then object 5. The ActiveRecord Base find method API mentions that you shouldn't expect ...

Using Sqlite InMemory DB for unittesting MSSQL-DB

Hallo, i am trying to implent this solution NHibernate-20-SQLite-and-In-Memory-Databases the only problem is that we have hbm's like this <class name="aTable" table="[dbo].[aTable]" mutable="true" lazy="false"> with [dbo] in the tablename because we are working with mssql and this does not work with Sqlite. i found also this postin...

How do I rename a column in a SQLite database table?

I would need to rename a few columns in some tables in a SQLite database. I know that a similar question has been asked on stackoverflow previously, but it was for SQL in general, and the case of SQLite was not mentioned. From the SQLite documentation for ALTER TABLE, I gather that it's not possible to do such a thing "easily" (i.e. a s...

SQLite - remove row with a lowest id

Hi, How can I remove a row from a table that has lowest rowid? Thank you. ...

try-catch SQLite .NET: open connection

I have the following method inside class DBConnection. I call the method like this: SQLiteConnection conn = DBConnection.OpenDB(); when I want to open an connection, so that I can execute my queries. I can call a similar method when I want to close the connection. The method: public static SQLiteConnection OpenDB() { try { ...

SubSonic connection string for SQLite

I'm writing a desktop app which needs a simple persistence layer - I found out about SubSonic and it's capability to work with SQLite. However I need to keep the database file in user's AppData folder and don't know how to put such value into app.config - I don't want to use absolute paths. Can app.config somehow access enviroment varia...

SQLIite - update two columns

Hi, how can I update 2 columns at a time? I tried the following statement, which doesn't work: UPDATE exercises SET times_answered = times_answered + 1 AND av_answeringTime = av_answeringTime + ( (av_answeringTime / (times_answered) ) + ?) * (times_answered + 1) WHERE name = ? Thanks. ...

SQlite extension name

I know there is no specific naming convention but what extension do you recommend when using SQlite? The most common appears to be .sqlite, .db or .db3? .sqlite makes most sense but is it just down to personal choice? ...

Adding parameters in SQLite with C#

Im just learning SQLite and I can't get my parameters to compile into the command properly. When I execute the following code: this.command.CommandText = "INSERT INTO [StringData] VALUE (?,?)"; this.data = new SQLiteParameter(); this.byteIndex = new SQLiteParameter(); this.command.Parameters.Add(this.data); this.command.Parameters.Ad...

Sqlite and Python -- return a dictionary using fetchone()?

I'm using sqlite3 in python 2.5. I've created a table that looks like this: create table votes ( bill text, senator_id text, vote text) I'm accessing it with something like this: v_cur.execute("select * from votes") row = v_cur.fetchone() bill = row[0] senator_id = row[1] vote = row[2] What I'd like to be able...

Using Multiple Tables, Multiple Values with Min() SQL

HI, New to StackOverflow... I am using SQLite in an application that I am developing. I am trying to run a pretty complex query (complex for me!!) and I have gotten the basic results i need but I am stuck on getting over the last hurdle. I presently have this query that does what i need it to do... SELECT SUM(activity) FROM activitie...

SQLite C++ Access Columns by Name

Is there a way to access SQLite results by column name (like a C++ Map) instead of index number in C/C++? For example, Python's SQLite access allows dictionary access Results = Query("SELECT * FROM table"); print Results['colname'] print Results['anothercol'] Any similar methods available in C++ for the SQLite's interface? ...

SQLite Alternatives for C++

I am developing a application that needs to store data with many writes and reads as requiring fast searching of data (the need for indexes of some sort), and also be able to serialize and save the data. Currently I am thinking about using SQLite, which gets the job done, but I am open for alternatives. The SQLite's syntax really doesn...

android: ORDER BY in query

I've got an android app using a local sqlite database. private SQLiteDatabase mDb; when I run this query I get my Cursor over rows with pid equal to id, as desired: mDb.query(true, PT_TABLE, new String[] {KEY_PID, KEY_TID}, KEY_PID+" = "+id, null, null, null, null, null); when I run the following query, aiming to get that same...

Is there a way to correctly sort unicode strings in SQLite using Python?

Is there a simple way to order rows with unicode data in SQLite? ...

Sqlite + 80K rows + LIKE = keyboard lag

I've had this problem that I have been putting off solving, but now is the time. I have a basic dictionary program. It has a UISearchBar and a UITableView. It works the way that it should except when running on the device it causes Keyboard lag. (Simulator is fine, of course) I have two types of searching. As-you-type and On-return. I f...

What is the precedence of multiple JOIN statements in sqlite?

The following two queries are returning different results, to my surprise: SELECT * FROM foo JOIN bar ON bar.id=foo.bar_id JOIN baz ON baz.id=foo.baz_id LEFT JOIN zig ON zig.foo_id=foo.id; and: SELECT * FROM foo LEFT JOIN zig ON zig.foo_id=foo.id JOIN bar ...

Display large result set

Hi, This is my problem: I need to store a lot of log messages and thought it would be smart to keep it in a SQLite3 database to be able to search and filter it easily. I will display the log messages in a standard list widget (using wxWidgets). The list will have several columns and can be sorted and filtered by the user. Now, I'm not...

C# sqlite syntax in ASP.NET?

-edit- This is no longer relevant and the question doesnt make sense to me anymore. I think i wanted to know how to create tables or know if the syntax is the same from winform to ASP.NET I am very use to sqlite http://sqlite.phxsoftware.com/ and would like to create a DB in a similar style. How do i do this? it doesnt need to be the ...