sqlite

SQLite: How to calculate age from birth date

What is the best way to calculate the age in years from a birth date in sqlite3? ...

SQLite iPhone - Insert Fails

Hi, I am trying to insert a value to a SQLite db, but everytime I try my program simply crashes with no error message at all. Here is my code: - (void) insertToDatabase:(NSString *) refName { // The Database is stoed in the application bundle NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomai...

Can SQLite handle large amount of data.

Hi! I will be making a mobile application in Android. My application is like Google Map's Get Direction feature, but a lot more complex, so I need to store data about points in the map. So I'm worried that SQLite may not be able to handle these large amount of data(or considering the limited storage of the phone). I have no background in...

How to protect SQLite database from corruption

I'm trying to figure out which is the safest strategy for protecting my (file-based) SQLite database from corruption (in this case, I'm working with Adobe Air, but this could apply to any webkit browser that uses SQLite, including Mobile Safari). I'm thinking about creating a database connection, keeping it around for only maybe 5 or 1...

Query to get records based on Radius in SQLite?

I have this query which does work fine in MySQL SELECT ((ACOS(SIN(12.345 * PI() / 180) * SIN(lat * PI() / 180) + COS(12.345 * PI() / 180) * COS(lat * PI() / 180) * COS((67.89 - lon) * PI() / 180)) * 180 / PI()) * 60 * 1.1515 * 1.609344) AS distance, poi.* FROM poi WHERE lang='eng' HAVING distance<='30' distance is...

Feeding Data into ListView from SQLite Database

I have millions of records that need can be searched and then appear in a ListView. Currently, these items are stored in an SQLite internal database. Does anyone have a recommendation on the best method to feed these items into a ListView and have people scroll through them? Speed is critical here. I don't want to do a "SELECT *" off o...

How to fetch records in pages in Android

I want to use the SQLite clause LIMIT and OFFSET, so that I can fetch my records in pages. But, though I can find the LIMIT clause in the SQLiteQueryBuilder.query() which would effectively limit the number of record in my result. Couldn't find the OFFSET clause anywhere so that I can continue fetching from the point I left. Also, can so...

Pysqlite setup error

When intalling pysqlite on my Mac I get permission denied when it tries to create pysqlite2-doc dir. Any ideas why? Tia, FR ...

Sqlite .NET and Entity Framework - "attempt to write a readonly database"

---edit--- Is there any additional information I can give to help solve this problem? I'm trying to get up and running with a Sqlite and Entity Framework within a .NET WCF web service. When I try to save anything to the database, I'm getting the error "attempt to write a readonly database". Here's the full error information: System...

sqlite: go to previous record in result set?

In SQLite, with the standard C interface -- is there an easy way (even if a bit hack-ish) to iterate backwards in the result set? I'm trying to avoid caching the results myself. A solution I thought about was executing an extra query that would return the reverse results, but I'm not sure how efficient it would be. ...

Help with a SQL Query

Hey Guys, I'm looking for a SQLite query which will return values that are great or less than 0.014763 for the lng and 0.008830 for the lat. I'm using the following code... $latupp = $_REQUEST['currlat'] + 0.008830; $latlow = $_REQUEST['currlat'] - 0.008830; $lngupp = $_REQUEST['currlng'] + 0.014763; $lnglow = $_REQUEST['currlng']...

How to get records in upcoming birthdays order?

I am struggling to find a working query in SQLite, that will return my records in their upcoming birthday along with the number of days it will happen CREATE TABLE contact_birthday ('contact_id' varchar,'data1' varchar,'display_name' varchar) data1 holds the birthday in YYYY-MM-DD format Something like: "1986-06-28","Angel","0" "197...

SQLite migration and administration

I wanted to migrate my production MySQL database to any other RDBMS. Someone suggested me to use SQLite. I have following queries: Is there any tool to migrate MySQL to SQLite? Any GUI tool to manage SQLite databases? How reliable it is for large production databases? ...

Join with Pythons sqlite module is slower than doing it manually

I am using pythons built-in sqlite3 module to access a database. My query executes a join between a table of 150000 entries and a table of 40000 entries, the result contains about 150000 entries again. If I execute the query in the SQLite Manager it takes a few seconds, but if I execute the same query from python, it has not finished aft...

Using ASP.NET tables generated by aspnet_regsql.exe in a SQLite database

I'm building a small ASP.NET MVC site where I want to use SQLite. While I already know how I will be connecting to the database (using DbLinq), I don't understand how to put the ASP.NET tables generated by aspnet_regsql.exe into an SQLite database. I've used the regsql tool before with SQL Server, but never with SQLite. How do I create ...

I get frequently SQLiteDoneException when querying one value, why?

I get frequently SQLiteDoneException, 06-29 02:03:34.816: WARN/System.err(30470): android.database.sqlite.SQLiteDoneException: not an error 06-29 02:03:34.816: WARN/System.err(30470): at android.database.sqlite.SQLiteStatement.native_1x1_string(Native Method) 06-29 02:03:34.816: WARN/System.err(30470): at android.database.sqlite...

Inventory SQL Query without UNION ?

I'm designing an inventory system, it has users, products, buy_leads, orders (authorized buy_leads), inputs and outputs. class Product < ActiveRecord::Base has_many :buy_leads end class BuyLead < ActiveRecord::Base belongs_to :product has_one :order end class Order < ActiveRecord::Base belongs_to :buy_lead belongs_to :user, ...

Error with android database program

06-29 01:24:15.882: ERROR/AndroidRuntime(747): Uncaught handler: thread main exiting due to uncaught exception 06-29 01:24:15.922: ERROR/AndroidRuntime(747): java.lang.RuntimeException: Unable to start activity ComponentInfo{one.two/one.two.Arrival}: java.lang.NullPointerException 06-29 01:24:15.922: ERROR/AndroidRuntime(747): at and...

SQLite and hierarchy in one request, how to do so?

Facts I have a pretty simple table: ID, name, PARENT_ID I would like to retrieve the hierarchy from down to top in one query using SQLite. Question : How can I do that ? Is there any request that will let me do that in One request? I´ve read about the 'Modified Preorder Tree Traversal', it is straight forward to get the hierarchy ...

Like query in sqlite

NSString * strSearchSql = [NSString stringWithFormat:@"SELECT pdf_id,pdf_name,page_no,pdf_image,pdf_text FROM search WHERE pdf_text LIKE '\%%@\%'",strSearchString]; In This Query i got the String like given below SELECT pdf_id,pdf_name,page_no,pdf_image,pdf_text FROM search WHERE pdf_text LIKE '%@' I want like this SELECT pdf_id,p...