sqlite

Use cid in sqlite instead of column name?

When creating a view, the name assigned to a column is not always usable in sqlite, in order to perform a specific operation afterwards. For instance, I created the following view: CREATE VIEW myview AS SELECT amount, count(name), name FROM mytable GROUP BY name HAVING count(name) > 1; Then I would like to do the following...

What is the best method to store this small read-only data table in an android phone?

I need to store data to use in my android program. Here are the details about the data: There will be one table. Each "row" of data will have a unique INT identifier. Other then that field, there will be four other INT fields and a text field. The string field will probably be a 2 or 3 sentences long. Each of the 4 INT fields will corr...

iPhone stringWithCString is deprecated

hi all, I use this code to read data from sqlite database: keyFromSql = [NSString stringWithCString:(char *)sqlite3_column_text(preparedStatement, 1)]; but the compiler give me the warning wrote in the title... so, what is the right and not deprecated method to retrieve a value from sqlite? thanks! ...

Location of SQLite Database when application is executed on real device

I have trouble with finding my SQLite Database. As we can access the SQLite databases on a running emulator like below: adb -s emulator-5554 shell sqlite3 /data/data/package_name/databases/database_name But what if I am testing my application on real device(HTC Here-Android) ? where does i find my database? ...

Sqlite LIMIT / OFFSET query doubt

Hello, I have simple question with Sqlite. What is the difference between this: Select * from Animals LIMIT 100 OFFSET 50 and Select * from Animals LIMIT 100,50 thanks in advance ...

SQLite Query: How to find out the Average of last X records for every person

Let's say I have two SQLite tables: Table Players id|name Table Scores id|player_id|score|timestamp What would an SQLite query looks like, if I want to calculate the average scores for every players, but only from 5 of their latest scores. I've a working query that only works to calculate the average from all scores (using GROUP BY ...

Benefits, etc of using mySQL over SQLite (RoR)

I'm building a web application right now for my company and for whatever reason, can't get mySQL working on my Mac w/ my Ruby install (OSX 10.5). SQLite works fine though, so would it be a problem to use SQLite for now so I can get to work on this and then just change up my database.yml file to point to a mySQL database when I deploy (a...

Passing an Orderby

I have a list view with several columns; things such as name, date, etc. I want to be able to click on the header TextView and sort the list by that field. When the list loads the variable works, and a list is queried and sorted by the field _id (no surprise other than it works), but when i click on the header TextView i get a force clos...

Optimizing Sqlite query for INDEX

Hello, I have a table of 320000 rows which contains lat/lon coordinate points. When a user selects a location my program gets the coordinates from the selected location and executes a query which brings all the points from the table that are near. This is done by calculating the distance between the selected point and each coordinate poi...

Android SQLite database being deleted on "SQLiteDatabase.openDatabase"

I copy over a valid Android SQLite database from the apk to the databases folder on my AVD. I verify with the DDMS FileExplorer that it is there and the size is correct. When I call the following function to open it, mDb = SQLiteDatabase.openDatabase(mDatabase_path, null, SQLiteDatabase.OPEN_READONLY); The SQLite DB file is deleted ...

Android SQLite Insert working, Query not working

Hello, this is my first time posting to this site so hopefully it will be a positive experience. I have an Android SQLite/ContentProvider problem that I have been beating my head against the wall for over the past 3 hours. Below is the ContentProvider code: public class IncidentProvider extends ContentProvider { private static final ...

Sqlite equivalent to MySQL's DESCRIBE [table]?

I'm just getting started learning Sqlite. It would be nice to be able to see the details for a table, like MySQL's DESCRIBE [table]. PRAGMA table_info [table] isn't good enough, as it only has basic information (for example, it doesn't show if a column is a field of some sort or not). Does Sqlite have a way to do this? ...

How do I drop a column from a sqlite database table?

I want to remove a column from a table. How can I do this? ...

AIR Sqlite: SQLEvent.RESULT not firing, but statemet IS executing properly

Ok it looks likes like I have stumbled upon a strange timing issue... I made a quick SQL wrapper class for executing sql statements. However after .execute() is called, the SQLEvent.RESULT event is never fired, but the new entry in the DB is created as it should be. The really really odd part is if I put a setTimeout() just after calli...

SQLite multiple table INNER JOIN with USING (...) Errors

I am trying to run a query on a SQLite database that INNER JOINs two additional tables: SELECT usages.date AS date, usages.data AS data, stores.number AS store, items.name AS item FROM usages INNER JOIN stores USING (store_id) INNER JOIN items USING (item_id) However, I get the error SQL error: cannot join using colum...

No data appearing in ListView, using SimpleCursorAdapter

With the below code, nothing appears in the ListActivity as I would expect. No errors are shown in logcat. 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.ArrayA...

which mobile platforms supports SQLite Database

As i am being an Android developer, and android is supporting SQLite database, i would like to know that which are the other mobile platforms supports the SQLite Database so that i can make SQLite database common and can place it at one place, and thereafter i can make database transaction from different mobile platforms. ...

Aggregate functions return wrong values when joining more tables

I want to display all customers and their addresses and the number and total sum of their orders. My query looks like this: select *, sum(o.tota), count(o.total) from customer c natural join orders o group by c.custId; which works fine. but if I add a new table to the query: select *, sum(o.tota), count(o.total) from customer c ...

iPhone: Making a simple high score system using SQLite.

I want to make a simple highscore system for my game. No posting online, just storing your best scores on the device, maybe being able to share them on Twitter or something like that. My table is like this: CREATE TABLE highscores ( name VARCHAR(10), score INT ) and then I want to find an easy way to retrieve the name, score and orde...

Creating stored procedure and SQLite?

Hey, is it somehow possible to create a stored procedure, when using SQLite? Thanks? ...