sqlite

Python: Inconsistent behaviour using sqlite3.Row to index into results by name

Hi all. In my Python application I have been using sqlite3.Row as the row factory to index results by name for a while with no issues. Recently I moved my application to a new server (no code changes), and I discovered this method of indexing is now unexpectedly failing on the new server given quite a specific condition. I cannot see ...

Executing multiple statements with SQLiteDatabase.execSQL

I've followed a standard tutorial for building a database with Android. I've created a class called DbHelper which extends SQLiteOpenHelper. I've Overridden the create handler to execute a string. @Override public void onCreate(SQLiteDatabase db) { db.execSQL(DbDefinitions.DB_CREATE); } DbDefinitions.DB_CREATE is a static String...

ms logparser export to sql statements

is it possible to use the logparser commandline utility to output sql statements as text? it seems bent on actually connecting to sqlserver and performing the inserts automatically. i just want a text file with the table creation and insert statements so that i can run them against sqlite instead of sqlserver. or if you know how to ge...

SQLite Optimization for Millions of Entries?

I'm trying to tackle a problem by using a SQLite database and Perl modules. In the end, there will be tens of millions of entries I need to log. The only unique identifier for each item is a text string for the URL. I'm thinking of doing this in two ways: Way #1: Have a good table, bad table, unsorted table. (I need to check the html an...

Elixir - deleting rows in a ManyToMany intermediate table

Hi, I have two tables with a ManyToMany relation between them. Sometimes I need to refresh the database so I delete elements from both tables. However relations between deleted rows are still stored inside the automatically created intermediary table. To clarify the problem, here is a small code: from elixir import * metadata.bind =...

Select most recent rows that match a condition in SQLite

Let's say I have a table: Name, status, timestamp And I want to select the rows that match status='active' but only those that have the most recent timestamp for each of them. So if there were rows like this: Bob, active, 5/10/2010 Bob, active, 6/12/2010 Ann, inactive, 6/12/2000 Ann, active, 9/3/2009 Ann, active, 9/25/2010 I'd wan...

PHP SQLite errors

I'm using cURL to pull selected data out of web pages, until recently I've been recording the output to plain text files but now that I have a better appreciation of MySQL/SQLite I've decided to make the full switch to relational databases, just makes managing data so much easier. But I've run into a couple of issues I haven't been able...

Android content providers as SQLite virtual tables

Short of building a Linux machine and writing C code, is there a way to create a SQLite virtual table using a module which reflects one of android's content providers? It will be very handy to be able to JOIN such table as part of my database query. ...

Inconsistent results between NHibernate Query and intended results

Hello all, I have the following query in HQL : public IEnumerable<Player> PlayersNotInTeam(Team team) { return Session.CreateQuery("from Player p where p.Sex = :teamSex and p.Visible and p.Id not in (select pit.Player from PlayerInTeam as pit join pit.Roster as roster join roster.Team as team where team = :teamId)") .SetPar...

SQLite Query in Android Application

It is giving error at runtime : Application stopped unexpectedly - Am I going wrong anywhere ? Please help. Any help is appreciable. public Cursor getdata(String passTask) { //Cursor cursor = this.db.query(TABLE_NAME, new String[] { "totalHr" }, // "where task = ", passTask ,"", "", ""); //return cursor; String p_quer...

Monotouch and SQLite database won't retain changes

I am trying to learn Monotouch and have an SQLite db with information. Using the examples here I can open, fill and query the database (which is set as "Content" in my project), but when I rerun the program, no data exists in the database again. I am guessing that somehow I have to save the database file to the Documents directory after...

Best practices for exposing multiple tables using content providers in Android

I'm building an app where I have a table for events and a table for venues. I want to be able to grant other applications access to this data. I have a few questions related to best practices for this kind of problem. How should I structure the database classes? I currently have classes for EventsDbAdapter and VenuesDbAdapter, which pr...

UTF-8 Corrupted from MySQL to SQLite

I'm porting a PHP Web application I wrote from MySQL 5 to SQLite 3. The text encoding for both is UTF-8 (for all fields, tables, and databases). I'm having trouble transferring a geo database with special characters. mb_detect_encoding() detects both as returning UTF-8 data. For example, Raw output: MySQL (correct): Dārāb, Iran SQLit...

SQLite Max of Count problem

I have the following query: SELECT M.movieId, COUNT (*) AS mcount FROM Movies M, Rentals R WHERE M.movieId = R.movieId GROUP BY M.movieId I have a Movies DB and a Rentals DB, the resulting table currently shows the movie ID and how many times it has been checked out but i just can't figure out how to incorporate a MAX call on the m...

iphone sdk: Adding data to sqlite database not working !?

hi, i use the code below to insert data into my sqlite-database but for some reason the application always crashes as soon as the method gets called and the problem seems to be the "sqlite3_open" statement. Does anyone have any idea what i might be doing wrong? - (void)viewDidLoad { [super viewDidLoad]; self.title = @"Animals"; animals...

how to get error code from sqlite3_exec

I have an update that is failing due to a constraint on the table, but sqlite3_exec only returns an error code of 1 instead of 19. How do I get the correct error code? ...

sqlite subquery syntax error

I have a syntax error in this subquery that I cannot seem to figure out why it won't work. All the parens are matched select min(max_s) from (select max(salary) from instructor group by dept_name) as s(max_s); Error: near "(": syntax error ...

Using hashtable or SQL Lite in my android application

Initially I use hashtable in my android application. The key point I love hashtable is it is able to store complex item such as: coordinate-->float[2], velocity-->float[2]. But from many samples, using SQLlite table in android seems more efficient but it may only store all the values in one row defined by rowID. So can anyone enlighte...

Android 2.2 (Froyo) SQLite missing some IN clause functionality?

Recently I updated my Nexus One to Froyo (2.2) and I've noticed some significantly different behavior with SQLite. For example, I had been using a subquery (returning string data) as part of an IN clause, and the subquery portion no longer appears to function correctly. I've attached an example SQL query working with the contacts databa...

Improper retrieval of Spanish text from SQlite in Blackberry

Hi Folks, I have stored Spanish text into the SQlite database and I am retrieving the same through the java code using row.getString() method of BlackBerry API, But I am unable to fetch the exact text from the database, only the accent characters are displaying differently in to the device(BlackBerry bold 9700). Where I am doing wr...