sqlite

Android sqlite concurrency without exceptions

Sqlite on android lets you access the database from multiple procs for reads, but if you're currently writing from one process, reads and writes from other procs will throw an exception because the first write has a lock on the db. By "procs" I mean other threads in the same app. Is there a standard way to have the other threads simply...

app explosion with conflicting sql primary key

I have a table in a database where the _id column is the primary key. If I try to do an insert into this table using an _id that already exists, my application crashes. How can I do this? Is there a specific kind of Exception I can eat? I've tried SQLiteException to no avail. ...

SQL - columns for different categories

I am new to SQL. I have a database with data for different exams, for example: Student Test Grade -------------------- St1 T1 A St2 T1 B St3 T1 B St1 T2 B St2 T2 B St3 T2 A St1 T3 A St2 T3 C St3 T3 B Then, I would like to print a report using the Tests (T1, T2 and T3) as columns: Student ...

Is there a faster way to read from a file and insert into SQLite.

Afternoon everyone. I'm not that familiar with SQLite so I haven't messed with all of the settings of the database. I'm rather familiar with SQL Server, Oracle and even some Access and mySQL. Well, currently, I'm taking a file with 110,000+ records and reading the file line by line, parsing the data and running an insert statement to ...

Import MySQL-DB-Dump into a Rails app using a migration file

I have an old PHP application with a bunch of MySQL tables. I want to rewrite it with Rails(3) and want to import the old data. How can I write a migration-script to import the MySQL-Dump into a sqlite DB? ...

SQLite to XML via PHP

Hi, I am sure this can be done. I need to pull data from a SQLite db & convert it to XML on the fly, so it can be read by fusioncharts to display pretty graphs. I have seen it done with mysql but am finding it difficult to find information about SQlite to XML. <?php header("Content-type: text/xml"); $host = "localhost"; $user = ...

SELECT *, COUNT(*) in SQLite

Hello. If i perform a standard query in SQLite: SELECT * FROM my_table I get all records in my table as expected. If i perform following query: SELECT *, 1 FROM my_table I get all records as expected with rightmost column holding '1' in all records. But if i perform the query: SELECT *, COUNT(*) FROM my_table I get only ONE row...

How do I always use the 'remote' version of a file in mercurial?

Mercurial newbie here, I'm working on a Django project that uses Sqlite as the database. I develop templates & UI stuff while my colleague works on the back-end code. We both push changes to Bitbucket. He is the only one who actually modifies the models and correspondingly, the SQLite file, however just by virtue of my testing the app, ...

SQLite - Create and index for every field

Hi, I'm creating a application that will fetch data from an SQLite database and display it in a table. I want the table to be updated in real-time as the user makes a selection (via multiple dropdown box). Every time the user selects an option from the dropdown boxes, the application will have to create a new SELECT query with a new W...

Best SQLite administrator

What is the best SQLite administrator for iPhone SQLite databases? Developer User Administrator Mac x x Windows x x iPhone/iPad x x Could you get to app databases with and admin on the phone? ...

Problem writing to a database on iphone in mobile safari

Hi, I have got a web app working in Safari 5 on the desktop that writes to a local storage database - not problems! Able to add, update and delete records fine. I then set the web app up on the iphone, but it seems to be ignoring all database transcattions except creating and dropping tables. It does not matter whether the app is on...

Using PDO Sqlite in-memory Db for PHPUnit tests

Hello I recently got PHPUnit working with xDebug for testing my Zend Framework applications. The fact I use ZF shouldn't make any difference to this question- just mentioned it for completeness. Anyway, it all works fine, but now I want to set up an in-memory database using PDO SQLite. I have done this successfully and have created tab...

sqlite select where empty?

Select in sqlite where some_colum is empty. empty counts as both NULL and "". ...

Database solution for client server application with encrypted database?

Hello, We have a Windows application on .net 2.0 that uses embedded encrypted database. The database consists of secret data - around 350mb, which is read-only and is updated with new one each 4 months. Untill now we use SQLite file as a database and it worked good, but we need to move to client-server version since some customers have...

MySQL - SQLite How to improve this very simple query ?

Hi, I have one simple but large table. id_tick INTEGER eg: 1622911 price DOUBLE eg: 1.31723 timestamp DATETIME eg: '2010-04-28 09:34:23' For 1 month of data, I have 2.3 millions rows (150MB) My query aims at returning the latest price at a given time. I first set up a SQLite table and used the query: SELECT ma...

Android. ExpandableListAdapter and Sqlite

hi, are there any good examples out there of using an expandablelistadapter with the results of an sql query? The docs give 3 examples of using expandablelistadapter, but none of them deal with sqlite Thanks Kevin ...

The ids of a table in my sqlite database have been reset

I have an iPhone app and one of my users found a really strange problem with my application. I can't reproduce the problem and I can't figure out why it's happening. Maybe you can? In Sqlite I have a table with about 1000 rows, each with a unique id. But for some reason the id of that table has restarted, before it was around 1000 but n...

coredata sqlite malformed DB

hi, I have problems with my coredata sqlite DB, which hosts a book DB. After a crash a user experiences has the problem, that the data isn't shown properly any more in his/her tableview. This is due to the fact, that the performFetch method returns an error: [NSFetchedResultsController deleteCacheWithName:nil]; if (![[self fetchedResu...

Finding rows with the maximum

Hi - I have a pretty simple table in SQLite, with the following schema: CREATE TABLE IF NOT EXISTS Palettes (id INTEGER PRIMARY KEY AUTOINCREMENT, class TEXT, count INTEGER, name TEXT); These represent color palettes, and several palettes can have the same name, but different counts (i.e. sizes). What I wa...

In SQLite3, how can I do SQL-escaping in a LIKE clause?

I'd like to run a LIKE query in sqlite3 with the user's input safely escaped. Basically, I want to do something like this: char* query = "SELECT * FROM table WHERE LOWER(notes) LIKE '%?%'"; sqlite3_stmt* statement; sqlite3_prepare_v2( database, query, -1, &statement, NULL ); But the ? is not honored when inside the LIKE expression. ...