sqlite

Getting table schema doesn't seem to work with System.Data.SQLite

I'm using SQLite.NET to access my databases, and in one particular case, I need to get a table schema because it's application-specific. I've been looking through the SQLite.NET forum and google, and it seems very straightforward. If I have a table called MYTABLE, I should be able to do this: DataTable dt = Connection.GetSchema( SQLit...

SQLite for Android custom table view (SQL VIEW, not Android view) discrepancy?

I've created a custom view in an SQLite database for an Android application. I'm using Sqliteman on Ubuntu to test my SQL statements before I put them in my app. I'm trying to do a simple select statement on my view. The select statement works fine in SQLiteman but when I put the same statement in my code it throws an error. The state...

SQLite and Android. How do I use String Having in my query??

I have a query that pulls everything from a database into a list view. return mDb.query(DATABASE_TABLE, new String[] {KEY_ROWID, KEY_HEIGHT, KEY_BODY, KEY_HOMEID},null , null, null, null, null,null); | String Having is the 3rd from ...

SQLite query where clause with floating point numbers fails?

I'm putting a float in an Android based SQLite database, like so: private static final String DATABASE_CREATE = "create table " + DATABASE_TABLE + " (" + KEY_ID + " integer primary key autoincrement, " + KEY_FLOAT + " REAL, " + ... ... content.put(KEY_FLOAT, 37.3f); db.insert(DATABASE_TAB...

how to add WHERE clause to Query on android

I would like to limit the results to those whose KEY_HOMEID is equal to journalId. I've been on this for a couple days any help would be appreciated. public Cursor fetchAllNotes(String journalId) { return mDb.query(DATABASE_TABLE, new String[] {KEY_ROWID, KEY_HEIGHT, KEY_BODY, KEY_HOMEID},"FROM DATA...

GUID as uniq key with SQLite

I found GUID generation routine with python. Running the code gives me the following results. GUID: 00000129e0e72d9b2aab3c1500ac001000e90001 Time: Sat, 17 Jul 2010 09:55:33 (millis: 0.787) IP: 172.16.233.1 Counter: 715865109 The comments of this code has the following message. ### GUIDs make wonderful databas...

SQLITE user-defined functions in Lisp

In SQLITE there is a possibility to relatively easily create User-Defined Functions and Aggregates in (extension) languages such as C, Perl, Python and others. Is there also such possibility using common-lisp as SQLITE language extension? I know there are libraries like cl-sqlite and plain-odbc but they don't seem to offer this possibil...

Values stored using ContentValues are not in correct order, WHY???

Hi all, currently I'm working on my 1st Android app and I encounter something I cannot solve. When I try to insert data into my own database there is an error: 07-18 03:41:04.414: ERROR/AndroidRuntime(3480): java.lang.NullPointerException My code for inserting into table is: public long createRecord(String created_time, String modifie...

use CASE with SQLITE for matching fields

I have an SQLite database with student names. Each student has different classes. I have a table with student grades and classes and another table that defines class by type. I'd like to run a query (that I'll be saving as a CSV to use in OpenOffice as an Excel document for a mail merge). I need to list the student's Math grade, History ...

How to make an Android singleton and custom data class with database?

I want to use a singleton pattern to hold a database and some other data/methods for my Android application. I realize there are many reasons against singletons, but for this case I'd like to use it. I've sub-classed UIApplication and made a data class within it called MyAppData. MyAppData needs to have access to the SQLite database. ...

Android Widgets: Where would the 'insert' step for a database occur?

I have a widget that currently takes a random string from an array and sets it to text view on update. The issue here is that the same item can be re-used multiple times in a row due to the string being 'random' In order to solve this I was going to create a table that held String text, and int viewednum and increment the viewed number ...

Null Pointer Exception when using delete

AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); dDbHelper.deletedJournal(info.id); mDbHelper.deleteJournal(info.id); public boolean deletedJournal(long homeId){ return mDb.delete(DATABASE_TABLE, KEY_HOMEID + "=" + homeId, null )>0; } dDbHelper.deletedJournal(in...

Access contents of iPhone SQLite database for app that won't start?

I'm currently beta testing an application I'm working on. I've entered data into this app that I don't want to lose, however the current state of the app is that it will not even start (doesn't even generate crash log or connect to debugger). I would be OK just deleting it and re-installing if I could get the data in the SQLite databas...

Reading an sqlite database from Jython.

I am trying to run the jython sqlite examples posted here. ################################################################################ # # sqlite_using_ziclix - An example of using the Python DB-API 2.0 compliant # ziclix implementation to interact with a SQLite database. # Creates a ...

Best way to join tables using sqlite in android.

I am trying to find out the best way to do a simple table join on my two tables using a sqlite database in an android application. Is the simplest way to use CursorJoiner or is there any easier way? ...

Open file which is stored in SQLite as blob.

As the title, I create a ByteArray to store the file in blob like this: byte[] red_buf = myCursor.getBlob(1); But I don't know what's the next step to open the file :( ...

Is it possible to structure a SQL query to automatically create a table if it doesn't already exist?

I'm a complete SQL novice, and I'm trying to accomplish the following (pseudo-code) with a single query: if (a table named "config_data" does not exist) { create a table named "config_data" } if ("config_data" has no rows) { add a row to "config_data" with some default data } return all rows in "config_data" How would I go about it?...

SQLite how to declare as Byte Array?

Hey guys, I've got a SQLite database. I'd like to create a field and declare it as type Byte array but I don't know what SQLite calls something that would be of type Byte Array. How would I do this? ...

Open file stored in SQLite as blob.

As the title, I create a ByteArray to store the file in blob like this: byte[] red_buf = myCursor.getBlob(1); And I wanna use FileOutputStream to open. But I don't know how to do. Can anyone give me a example or website please ?? ...

How to save an image in Sqlite

Hi frnds.. i want to save an image in Sqlite in BOMB format first & then want to dispaly it in the tableviewController's cell plaese suggest me something for that. I m rookie in Iphone development. ...