sqlite3

SQL - Find patterns of records

Hi. Newbie here, so bear with me... Would it be possible to find patterns of records? I need to find repeating SEQUENCES of songs in the output of a radio programming software. The station manager wants to know if certain songs 'next' to certain other songs repeat over time, ie if the DJs are getting lazy and repeating certain sequenc...

how to add a row somewhere in the middle of a table

Hi folks, I have a requirement where I have to add a row somewhere in the middle of a table, if it does not exist. Can you please help me with this? ...

What determines where a sqlite3 database file will be stored when creating it from the command line utility?

Recently I was reading that when launching mac Terminal and typing in this: sqlite3 mydatabase.db it will create a mydatabase.db file on disk. But where? ...

Are there good iPhone SQLite3 tutorials which really start from scratch?

I always find something that starts somewhere in the middle, where the database already exists or where some special classes or files have already been added to the project. I want to see the first steps, since they're crucial. i.e. somebody said the database has to be copied into a readwriteable dir on the iphone. Anyone knows a complet...

Is there a tutorial about how to use FMDB, the sqlite3 wrapper class?

The FMDB page just offers the cvs checkout. Maybe someone out there wrote a good tutorial on how to use FMDB with sqlite3 on the iphone? ...

Any suggestions for a ruby solution for populating a sqlite database from a mysql source

I have a Rails application that uses MySQL. The application needs to populate sqlite databases to be distributed to client applications from the master mysql database. The schema for the sqlite database will be very similar to the mysql database, but not identical. The sqlite databases will be populated with a subset of the schema and ...

SQLite journal file not going away

Hi all I have an sqlite database I am writing and reading from. Most of the time I am writing, but occasionally I read something. The routine for writing (skeletonized, error checking removed etc..) goes something like this: st1 and st2 are already prepared along with the initialization of the database. -(BOOL) saveHvalue:(int) fid t...

does sqlite supports any kind of IF(condition) statement in the select

does anyone know if sqlite supports the sql function "if" in the select.. for example select if( length( a ) > 4 , a , ' ') as b from foo which would return a if the length was over 4 chars long.. or else it would return ' ' as b if it doe support a condition in the select what is the syntax is should be using? i have checked ht...

How to create a statically linked extension for sqlite?

sqlite3_auto_extension looks like a good way to register a statically linked extension. But I don't understand the callback declaration: void (*xEntryPoint)(void); Shouldn't the callback be like sqlite3_extension_init? int sqlite3_extension_init( sqlite3 *db, char **pzErrMsg, const sqlite3_api_routines *pApi ) ...

Versioned data store (sqlite?).

http://www.sqlite.org/lang%5Fsavepoint.html I'm looking for a datastore with the following properties: I need to 'mark' the state frequently (sub second interval). I need to be able to revert the datastore to a previous mark (with no appreciable delay). I only need to keep the last few hundred 'marks'. (i.e. I never need to revert to...

Date stored in table is wrong in SQLite

Can you tell my the date in the SQLite database is taking as 12/3/1899 instead of 12/3/2009. I am inserting correct date while it saving in this format. I can't understand what is the reason.What conversion has to be done in Insert Statement. Can any one help me out. CREATE TABLE [PIs] ( [PIGUID] GUID PRIMARY KEY NOT NULL, [CompanyGU...

Roulette Wheel selection with a SQL query.

I am implementing a roulette wheel selection, and I would like to keep as much code as possible in SQL. My attempt has yielded the query below. $1 is a random variable of the same range as weight I send to the SQL code (it was not clear how to make random() be called only once). Weight is the size of the row's slot on the wheel. rand...

Can I store HTML as XML in a Sqlite3 database?

Is it possible to do this? The HTML files in question all conform to: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; EDIT: How would you store a number of HTML pages with sequential IDs associated with them in a database? (Oh, I'm new to databases). EDIT: N...

Regexp for replacing quotes in database insert statements

I'm converting a sqlite3 database to mysql. I have a nice command file for sed that changes AUTOINCREMEMT and the other things needed, but I'm stuck on the last one: double quotes. sqlite3 dump format: CREATE TABLE "products" ( "id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "desc" varchar(255) ); INSERT...

Can't refresh iphone sqlite3 database

I've created an sqlite3 database from the command line and inserted several records. My app retrieves all of them and shows them just fine. I then go back and insert a few more records via the sqlite3 cli, erase the db file out of the simulator's documents directory so that it will be recopied from the main bundle, and the run the app ...

read-only sqlite database with temporary changes

I have an sqlite database, and I would like to keep it read-only without any write operations on the database file. Is there a way to make temporary modifications to the database, without flushing them to disk permanently? Right now I am doing this in a workaround way, by storing the temp data in an in-memory database with the same sc...

What should I do to refresh data with concurrent sqlite 3 access

I have two sqlite windows clients concurrently using a sqlite 3 base on the network. When one appends data the record is successfully appended (there's no the journal file at the moment). But another client doesn't see this record even when a fresh SELECT query is fired and starts to see this record of this table after some SELECT querie...

Opening SQLite3 as READONLY with PDO?

The SQLite3 Class has an option like this. $db = new SQLite3('mysqlitedb.db', SQLITE3_OPEN_READONLY); In PDO you would simply open with: $db = new PDO('sqlite:mysqlitedb.db'); My question is however, is there a way to open a database with PDO, in READONLY mode? ...

How to remove all TEXT/Numbers between ( and ) in sqlite3?

Hi there, I've been bashing my brains out trying to figure out how to remove text/numbers between the ( and ) in a column within my sqlite3 db. I've tried rtrim, ltrim, substr() all to no avail. Any expert sqlite3 guru care to help me? I'd appreciate it. Thanks. ...

C# handle multiple database types?

I have an app that needs to be able use either an sqlite3 datebase or an mysql database. The customer wants to be able to choose between the two (obviously one would be local and one would be online). My thoughts for doing this would be by creating a database interface that has all of the common methods (ExecuteReader, ExecuteScalar, et...