sqlite3

sqlite3 syntax error

I am having some problem with sqlite. I want to insert some data to database,however,when I use the function sqlite3_exec(db,sql,0,0,&zErrMsg);, the zErrMsg returns: near '\x90' syntax error. the code is : (void) ExecuteCommand:(NSString *)command DBRef:(sqlite3 *)db { const char *sql = [command UTF8String]; char *zEr...

Android: Accessing single database from multiple activities in application?

I have a todo list type application that stores all of the note data in a sqlite3 database. Each activity in the application needs access to the database to edit different parts of the data in real time. Currently, I have each activity open its own DBManager object (the helper class I created to manage the database). This is causing p...

(Iphone) Retrieve Id from a Cell and use it in another query to display entry

Hi, I have a TableView who display the name of some Categories by executing this simple query "select * from category" so my object contain id_category and name. When I click on a row, a new tableView will display somes names inside thoses different categories. "Select * from fiche_Category where id_category = ?" My only probl...

sqlite3_prepare_v2 throws SQLITE_ERROR in iPhone code

I have a piece of code that used to work, and other iterations of it that DO work within the same app, and have compared code, and they are identical in structure. This is driving me INSANE!!!!!! In this instance, sqlite3_prepare_v2 is throwing one of those useless SQLITE_ERROR exceptions. Apparently, it can FIND the database, and OPE...

SQLite3 problem since Rails 2.3.5 update

Hi, I was running Rails 2.3.4 with SQLite3 on a Snow Leopard box without any problems. I've just done a pull on a new project that requires 2.3.5 so I did a sudo gem update to get the latest version of Rails. This installed fine but when I ran rake db:migrate I got the following error: rake aborted! uninitialized constant SQLite3::Driv...

XCode copies blank database when doing build...

I've noticed that even though I placed my sqlite3 database in the "resources" folder, and even though I checked the "Copy file" box, when I do a build, XCode creates an empty database toi the application folder it's building...so it's FINDING the database, and OPENING it, but there's nothing IN it, so when I do a sqlite3_prepare_v2, I g...

sqlite join query

hii i am new to iPhone, I am using sqlite3 as my database. There are two tables in database as FriendInfo and ItemInfo. FriendInfo contain FriendId and some other field relative to friend info which are quine in this table and ItemInfo contain the ItemId as primary key and friend Id as Foreign Key, i want to execute the join query which...

Rails doesn't migrate one table out of 3 in production mode, runs fine in development.

I have three tables: Project, Tasks, and Tags. When migrate the databases in development mode, everything works. But when I run the rake db schema load command for production mode, it isn't migrating the "Tasks" table, hence the app doesn't work. I looked at my production.log file, but there isn't anything there. What am I missing he...

SQlite synchronization scheme

Hi, I know it is xmas eve, so it is a perfect time to find hardcore programers online :). I have a sqlite db fiel that contains over 10 K record, I generate the db from a mysql database, I have built the sqlite db within my iphone application the usual way. The records contains information about products and their prices, shops and the...

How can I get a list of results when sqlite returns more than one row?

Hello, this is how my table looks: key | driver | machine | result ----------------------------------- 1 | 1234 | abc_machine | pass 2 | 1234 | xyz_machine | fail when a user selects '1234' from driver and all from machine things get a little messy. (user makes selection from a gui) when i do: $getConfig = `sqlite3 ...

Data visualization tool for database-query results

Hi, i looking for a tool, that can visualize the result of database query (MySQL, SQLite3 etc.) For example, i would like to have results of following query (it is SQLite3 syntax) ... SELECT count(*) FROM visits v GROUP BY date(v.visit_time) ... to be plotted graphically. (number of visits for each day) Is there any tool for it ? ...

Ruby on Rails migrations are very slow

I have SQLite3 database, which is populated with some large set of data. I use migration for that. 3 tables will have following count of records: Table_1 will have about 10 records each record of Table_1 will be associated with ~100 records in Table_2 each record of Table_2 will be associated with ~2000 records in Table_3 The...

Problem install do_sqlite3 for DataMapper

sudo env ARCHFLAGS="-arch x86_64" gem install do_sqlite3 Building native extensions. This could take a while... ERROR: Error installing do_sqlite3: ERROR: Failed to build gem native extension. /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb checking for sqlite3.h... yes checking for sqlite3_open() i...

Saving and retrieeving numeric values from Sqlite3

How to properly save a numeric values into SQLite3. I've used Real type for storing numeric value. For example: when I store 233333.00 is fine. But when i store 23333333.00 it becomes 23333300.00. Why is it saved as 2.3333333E7 and retrieved as 2.33333e+07. Is there a way to overcome this? ...

Does sqlite3 support a trigger to automatically update an 'updated_on' datetime field?

I have a table that looks like this user_id | name | created_on | updated_on -------------------------------------------------- 1 | Peter D | 1/1/2009 | If I insert or update a record, I'd like a trigger to update the updated_on field with datetime('now'). But I can't find the function name to target the most re...

How to join SQL tables while selecting a COUNT() function?

I have two database tables, 'Lists' and 'Notes'. Lists has columns _id, listname Notes has columns _id, checked, list_id (which is a foreign key of Lists._id), and more columns that aren't relevant to this question. I would like to create a query that returns four columns: Lists._id, Lists.listname, the count of all checked Notes in thi...

Connecting to DSN created by SQLite driver

How to connect to DSN created by SQlite Driver using SQL anywhere APIs from C++ code? I am using db_string_connect() to connect to sybase adaptive server anywhere. I want to use the same function to connect to the DSN created by SQLite Driver as well but db_string_connect() API is returning sqlcode -103 ["You supplied an invalid user ID ...

"SQLite Version Error"

Hello, I tried to run webrat tests in selenium mode, but I got the following error: dyld: Library not loaded: /usr/lib/libsqlite3.dylib Referenced from: /System/Library/Frameworks/Security.framework/Versions/A/Security Reason: Incompatible library version: Security requires version 9.0.0 or later, but libsqlite3.dylib provides ver...

How do I take a backup of a sqlite data base?

Please help me understand how to take a backup of a sqlite database? ...

EntityManager.merge inserts duplicate entities

Hi all, I've got a pretty special setup: I create all the classes in Java, connect them in my application (several ManyToOne-relationships). Then, I'd like to iterate over my objects and save them into the database. Sometimes, an object is already in the database, then it should not be persisted again. I implemented the hashCode() and...