sqlite

How can I get dict from sqlite query?

db = sqlite.connect("test.sqlite") res = db.execute("select * from table") With iteration I get lists coresponding to the rows. for row in res: print row I can get name of the columns col_name_list = [tuple[0] for tuple in res.description] But is there some function or setting to get distionaries instead of list? {'col1': 'v...

SQLite Complex Query Help

Hi, I have a very complex query going on in SQLite, and I need a bit of help understanding how to do it. The following example is of my Database: Category: CatID | CatTitle ---------------- 1 | XYZ 2 | Sample Content: ItemID | ItemCatID | ItemText | ItemText2 | ItemText3 | ItemText4 -----------------------------------------...

Alternative to ZIP as a project file format. SQLite or Other?

My Java application is currently using ZIP as a project file format. The project files contain a few XML files and many image and sound files. The project files are getting pretty big, and since I can't find a way with the java.util.zip classes to write to a ZIP file without recreating it, my file saves are becoming very slow. So for e...

Is SQL Server Compact Edition a sensible alternative to SQLite?

What are the differences, other than a file size restriction in SQL Server Compact, and Windows only usage? ...

Can NHibernate detect when another program has written new data to a shared SQLite database?

I have two C# programs that share a single SQLite database file. One program (let's call it Writer) writes new data to the database. The other program (Reader) reads it. Both programs use Fluent NHibernate and System.Data.SQLite to access the DB. Currently, I've just got a big Refresh button on my Reader program, and the user has t...

SQLite and custom order by

I have a table with categories: ID Category "1","Baking" "3","Family" "4","Entertaining" "5","Children" "6","Desserts" Now I would like to order the result of the select statement to ID Category "4","Entertaining" "3","Family" "1","Baking" "5","Children" "6","Desserts" for example. In MySQL, you'd do ...

Insert into a table if a condition is met with sqlite3

if I have two tables: files(id, owner) and share(file_id, user), where owner and user would be primary IDs from a theoretical user table, how can I insert an entry into share only if the user doing the sharing owns that file? This is a stripped down example, so I'll just use a literal for the one doing the share operation -- normally th...

How to change SQLite DB path for each request in Django?

I would like to dynamically change path to sqlite database depending on currently logged user using Django framework. Basically each user should have his own sqlite database file. Anyone with experience? Thanks. ...

Insert binary file in SQLite database with Python

I trying to write a simple Python script that inserts .odt documents into an SQLite database. Here what I have so far, but it doesn't seem to work: f=open('Loremipsum.odt', 'rb') k=f.read() f.close() cursor.execute="INSERT INTO notes (note) VALUES ('%s')" %(sqlite.Binary(k)) cursor.close() conn.close() I don't get any error messages, ...

Android Database Access Across Tabs

I have four tabs (reports, review reports, map and settings). I have an sqlite database populated with report information. I wish to have the database accessible throughout the application. The reports tab successfully adds data to the database however using the same methodology crashes the application. The Android debugger points to the...

Compile error when attemping to get value of QSqlQuery?

Just trying to mess around with Qt and SQLite to get familiar with how things work- I haven't really done DB programming since my vb6 days, so please be easy ;] I'm just trying to get the result of a query and I'm trying to follow some examples I found online (namely this one). The process seems simple enough: create the QSqlQuery objec...

sharing a :memory: database between different threads in python using sqlite3 package

I would like to create a :memory: database in python and access it from different threads. Essentially something like: class T(threading.Thread): def run(self): self.conn = sqlite3.connect(':memory:') # do stuff with the database for i in xrange(N): T().start() and have all the connections referring to the sam...

How do you use "?" with sqlite statements in an executeQuery method?

I assume that you can include "?" in your sqlite statement, provided in the "executeQuery" method, you pass additional arguments corresponding to each "?". But when I put this to practice, the results are not consistent. This statement works: SELECT * FROM answers WHERE test_id = ? and question_id = ? with this method FMResultSet *...

No data shown on listview

Here is my Arrival.java package one.two; import java.io.IOException; import java.util.ArrayList; import java.util.List; import android.app.ListActivity; import android.database.Cursor; import android.os.Bundle; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.SimpleCursorAdapter; public class ...

Does anybody know how to access a remote sqlite database using objective-c?

I'm developing a simple macosx application and it needs to access a remote sqlite database (must be sqlite). I've been looking for an example on how to do it through ODBC (I don't know if ODBC is the best or easy way). Does anybody have any idea? Thanks! ...

PDO SQLite: read-only database

I have a SQLite database that I am using for a website. The problem is that when I try to INSERT INTO it, I get a PDOException SQLSTATE[HY000]: General error: 8 attempt to write a readonly database I SSH'd into the server and checked permissions, and the database has the permissions -rw-rw-r-- I'm not that familiar with *nix permis...

Connecting to sqlite in iphone development

Hi all, I have used sqlite database in some of my iphone applications but as you know it is a lot harder than other languages such as java and php to use database. Is there any way to use database easier !? I found a framework in sourceforge here : http://mysql-cocoa.sourceforge.net/ but I think it is not for cocoa-touch. Is there any ot...

Failing NHibernate test causes ReSharper test runner to hang for 30+ seconds

I have some NUnit integration tests to test my FluentNHibernate mappings using a SQLite in-memory database. I am using the ReSharper test runner (v5.0.1659.36) in Visual Studio 2008. When one of the NHibernate tests fails, the ReSharper test runner and Visual Studio freezes for 30+ seconds. (It will show that it failed but not show the...

Optimize SQL statement for android sqlite

I'm developing an application that tracks the user's current position and stores it into a SQLite database. Everything works fine, but now I have the problem when querying the database for a track with more than 1000 records it takes nearly 1.5 minutes. On my Desktop it just takes 1 second. I know it's a query with many subselects but I...

SQLite suitable for concurrent reading?

Will an SQLite database perform well to around 50 reads/second without locking? I'm trying to decide whether it'd be feasible for use on a PHP website that won't get 'written' to very often - it'll be mostly reads of the same data from a small handful of tables Thanks ...