sqlite

Computing different sums depending on the value of one column

In psuedo-code, this is bascially what I would like to do: select if a1 >= 0 and a1 <= 2 a2 + a7 + a8 as sum else a2 + a8 as sum from table_name ; (The column names, etc. are just for illustration.) In English: I need to sum different columns for each of a few thousand records. I'd like to do the sum in SQL,...

Locking problems with sqlite and SubSonic when using transactions on a single thread

I'm getting locking exceptions when trying to use transactions with SubSonic and SQLite. I'm using this from a single thread and there are no other processes accessing my db, so I really didn't expect any such problems. If I write code like this below, I get an exception on the second call to Save() within the loop - so the third call ...

Any considerations before jumping into SQLLite?

I have a WCF application that at present is using XML based file storage to store data that gets used to generate reports. Besides this processing decisions are made based on information stored in these XML files. I'm now hitting volumes of around 30 000 text files. This is incredibly taxing, and the application at times comes to a gri...

Populating a Searchbar from SQLite

I want to search my tableview with a UISearchBar. My tableview is populated from a sqlite database and has over 1800 rows. I have seen a lot of examples that show how it works from a plist or character array, but not a SQLite datasource. If there is an existing example on the web, I can't find it. An example of how to do this would he...

Editing records with SQLite, DataMapper, and Sinatra.

I'm in the process of learning Sinatra and DataMapper. To do so, I've been playing with a "customer database" project. Creating and deleting records is trivial and now I'm working on editing records. So far I've managed to piece together a form in my views and a couple of routes that I thought would edit a record. Here's some code ...

SQLite, Exclusive Or. How do i clear a flag?

To set a flag i write SET status=status|? how do i clear a flag? Usually i write SET status=status&(-1^?) but ^ is illegal in sqlite. How do i clear a flag or use exclusive or? ...

gems: difference between sqlite3 and sqlite3-ruby?

I accidentally ran: sudo gem install sqlite3 instead of: sudo gem install sqlite3-ruby So now when I run gem list I get: gem list *** LOCAL GEMS *** sqlite3 (0.0.7) sqlite3-ruby (1.2.5) What is the difference between the two? And do I need both? ...

DRYing c++ structure

I have a simple c++ struct that is extensively used in a program. Now I wish to persist the structure in a sqlite database as individual fields (iow not as a blob). What good ways are there to map the attributes of the struct to database columns? ...

Standard Deviation for SQLite

I've searched the SQLite docs and couldn't find anything, but I've also searched on Google and a few results appeared. Does SQLite have any built-in Standard Deviation function? ...

How to drop all empty tables in SQLite?

I want to drop all tables that does not have rows. How to drop all empty tables in SQLite? EDIT I need to do this on a mobile phone (no shell there). On a Windows Mobile phone. ...

unable to update sqlite3 on mac osx?

hello all, i want to install newest sqlite3 on my mac osx. i am trying this from last 6 hours but still not succeed.Here are the steps i have followed.I have tried this site mkdir ~/src cd ~/src curl http://www.sqlite.org/sqlite-3.6.18.tar.gz | tar zx cd sqlite-3.6.18 autoconf ./configure --prefix=/usr/local make sudo make install //ch...

Datamapper doesn't save data into database

Hi! I'm writing a simple application with Sinatra and Datamapper in Ruby and I have a trouble — when I try to save data into my SQLite database nothing is changing. But when I try to install database or change data from irb it works perfectly. Here is my Datamapper's setup, model and database installing method (this works fine): DataM...

How to link a SQlite Extension Source File into Xcode for iPhone?

I use a statically linked library for Sqlite in an iPhone Xcode project. I am now trying to include a .C extension to Sqlite in this project. However, I am having trouble making the Sqlite in the build SEE the extension. The statically linked Sqlite library works fine. Also the .C extension works on my desktop, and builds fine as a stat...

Iphone SQlite - Populate Table from Text Field

Hi, I am trying to prepopulate my SQlite Table from a Text File - alltough it is compiling fine, no rows will be inserted: NSLog(@"Insert Table for English"); char *errorMsg; NSString *defaultDBPath = [[[NSBundle mainBundle] resourcePath ] stringByAppendingPathComponent:@"english.sql"]; NSLog(@"DefaultPath: %@", default...

Unit testing NHibernate w/ SQLite and DateTimeOffset mappings

Porting over an application to use NHibernate from a different ORM. I've started to put in place the ability to run our unit tests against an in memory SQLite database. This works on the first few batches of tests, but I just hit a snag. Our app would in the real world be talking to a SQL 2008 server, and as such, several models cur...

Django: sqlite for dev, mysql for prod?

Quick question: is it a good idea to use sqlite while developing a Django project, and use MySQL on the production server? ...

select with subquery takes about 1min in sqlite and < 1s in SQL Server

I already looked up many posts about this problem (subqueries being very slow in sqlite). but I'm not really good with sql and i don't know what i can do. i have this query: SELECT * FROM data d WHERE d.category = 3 AND (SELECT COUNT(id) FROM data_tag WHERE data = d.id AND (tag = 2136 OR tag = 8)) >= 2 ORDER BY id ASC i have 3 tabl...

Why does SubSonic 2.0 use System.Data.SQLite version 1.0.60.0?

Anyone know why Subsonic 2.2 uses System.Data.SQLite version 1.0.60.0 instead of the latest version 1.0.65.0? ie is it just because that's when it was released or is there anything in the newer version that doesn't work with SubSonic? What does everyone else use - do you just recompile from the latest branch of SubSonic using the lates...

sqlite select with condition on date

I have an sqlite table with Date of Birth.I would like to write a query to select those records where the age is more then 30 . I have tried following but it doesnot work. select * from mytable where dob > '1/Jan/1980' select * from mytable where dob > '1980-01-01' ...

Select from SQLite with Qt

I try to deal with SQLite database on Qt 4.5.3 on Linux. I've already created DB with another program and it looks like this: screenshot Then, I try to perform select on Qt: db = QSqlDatabase::addDatabase("QSQLITE"); db.setDatabaseName(filename); // Here is FULL path to the database. I've checked it twice :) bool ok = db.open(); qDebug...