sqlite

Mystery Key Value Coding Key

Hello, I'm attempting to load data from an undocumented API (OsiriX). Getting the NSManagedObject like this: NSManagedObject *itemStudy = [[BrowserController databaseOutline] itemAtRow: [[BrowserController databaseOutline] selectedRow]]; works just fine. But getting the NSManagedObject like this: seriesArray = [_context executeFetchR...

Distance between Long Lat coord using SQLITE

I've got an sqlite db with long and lat of shops and I want to find out the closest 5 shops. So the following code works fine. if(sqlite3_prepare_v2(db, sqlStatement, -1, &compiledStatement, NULL) == SQLITE_OK) { while (sqlite3_step(compiledStatement) == SQLITE_ROW) { NSString *branchStr = [NSString stringWithUTF8Str...

get last insert id when using Activerecord

Hi, For Sqilte3 C API, I would use sqlite3_last_insert_rowid. How to get this id when using ActiveRecord after insert a new record? I use following way to insert a new record : Section.new |s| s.a = 1 s.b = 2 #I expected the return value of save to be the last_insert_id, but it is NOT s.save end ...

Only first table in create table statement being created

The table "credentials" does show up in the adb shell. I've checked logcat and it doesn't seem to report a problem... private static final String DATABASE_CREATE = "create table credentials (_id integer primary key autoincrement, " + "username text not null, password text not null, " + "lastup...

How to read LARGE Sqlite file to be copied into Android emulator, or device from assets folder?

I guess many people already read this article: Using your own SQLite database in Android applications: http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/comment-page-2/#comment-12368 However it's keep bringing IOException at while ((length = myInput.read(buffer))>0){ myOutput.write(buffer, 0, l...

datatable works in winform but not ASP.NET

I have created a class that returns a datatable, when I use the class in a c# winform the dataGridView is populated correctly using the following code DataTable dt = dbLib.GetData(); if (dt != null) { dataGridView1.DataSource = dbLib.GetData(); } However when I try the same thing with ASP.NET I get a Objec...

SQLite on the iPhone, strange linking errors

I've been reading through this tutorial for using a SQLite database within an iPhone app. This is great and I've got everything working nicely, in the Simulator. As soon as I build to device I get the following linker errors: ld: warning: in /Developer/SDKs/MacOSX10.6.sdk/usr/lib/libgcc_s.1.dylib, missing required architecture ar...

How to compare sqlite TIMESTAMP values

I have an Sqlite database in which I want to select rows of which the value in a TIMESTAMP column is before a certain date. I would think this to be simple but I can't get it done. I have tried this: SELECT * FROM logged_event WHERE logged_event.CREATED_AT < '2010-05-28 16:20:55' and various variations on it, like with the date functio...

iphone “EXC_BAD_ACCESS” when doing sqlite3_open(":memory:", &memory_db)

Hi there! While developing for iphone i get “EXC_BAD_ACCESS” when doing sqlite3 *memory_db; if (sqlite3_open(":memory:", &memory_db) != SQLITE_OK) { sqlite3_close(memory_db); NSAssert(0, @"Failed to open in-memory database"); } also doing NSString * memory_db_filename = @":memory:"; if ...

sqllite problem when i am acessing in asp.net

i have created database in sqlite.when i am acessing this in web application i am getting this error. SQLite error no such table: emp but i a have that table in my database. ...

How to use SQLite3 with Java

I am trying to build a simple java program which creates a db file, then a table and inserts dummy values in the table. I found this page http://www.zentus.com/sqlitejdbc/index.html and tried out the example given on the page but I am getting the following error - Exception in thread "main" java.lang.NoClassDefFoundError: Test Caused b...

How to fetch a random record from SQLite database?

I am working on PHP. I was working with MySQL before. Here is the code I used - $offset_result = mysqli_query($con, " SELECT FLOOR(RAND() * COUNT(*)) AS `offset` FROM students "); $offset_row = mysqli_fetch_object( $offset_result ); $offset = $offset_row->offset; $result = mysqli_query($con, " SELECT name FROM students LIMIT $offse...

Store date object in sqlite database

Hello, I'm using a database in my Java project and I want to store date in it, the 5th and the 6th parameter are Date Object. I used the solution below but I have errors in the indicated lines: PreparedStatement creerFilm = connecteur.getConnexion().prepareStatement( "INSERT INTO FILM (ID, REF, NOM, DISTRIBUTEUR, DATEDEBUT, DAT...

Endless saving of CoreData Context

Sometimes I noticed that a 'save:' operation an a ManagedObjectContext never returns and consumes 100% CPU. I'm using an SQL Store in a GarbageCollected environment (Mac OS X 10.6.3). The disk activity shows about 700 KB/s writing. While having a look at the folder that contains the sqlite database file the "-journal" file appears and d...

Connecting CoreData to my App on an iPhone Device

I apologize ahead of time for what I'm sure is a complete newbie lapse. Running my iPhone app on iPhone simulator - no problem. But I loaded the app on an iPhone device for the first time and it appears as if the SQLite database I'm using (NSManagedObjectContext) isn't connected or didn't upload. The app installs but with no data. How do...

sqlite eatingup memory on iPhone when doing insert

I am having problem with inserting data to sqlite database. char *update="INSERT OR REPLACE INTO ct_subject (id,id_parent, title, description, link, address, phone, pos_lat, pos_long, no_votes, avg_vote, photo, id_comerc, id_city, placement, type, timestamp, mail) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);"; sqlite3_stmt ...

Querying with foreign key

Say I have 2 tables whose structures are as follows: tableA id | A1 | A2 tableB id | tableA_id (foreign key) | B1 Entries in A have a one-to-many relationship with entries in B. What kind of query operation would I need to achieve "something like this: select all objects from table B where A1="foo""? Basically, apply a que...

Implementing a 1 to many relationship with SQLite

I have the following schema implemented successfully in my application. The application connects desk unit channels to IO unit channels. The DeskUnits and IOUnits tables are basically just a list of desk/IO units and the number of channels on each. For example a desk could be 4 or 12 channel. CREATE TABLE DeskUnits (Name TEXT, NumChanne...

How to prevent updating duplicate rows in SQLite Database?

I'm inserting new rows into a SQLite table, but I don't want to insert duplicate rows. I also don't want to specify every column in the database if possible. I don't even know if this is possible. I should be able to take my values and create a new row with them, but if they duplicate another row they should either overwrite the existi...

sqlite compiler errors

Hello, when including "sqlite3.c" into my project, I get lots of compiler errors: error C2027: use of undefined type "_ht" d:\...\sqlite3.c line 19556 ... fatal error C1003: Errors in the program are too numerous to allow recovery. The compiler must terminate. When inlcuding "sqlite3.c" into an empty test project, I have no pro...