sqlite

SQLite unit testing NHibernate generated cascade relationships

The following is some background info on this post. You can just skip to the question if you like: In this excellent article (http://ayende.com/Blog/archive/2009/04/28/nhibernate-unit-testing.aspx) the author contends that "When using NHibernate we generally want to test only three things: 1) that properties are persisted, 2) that casca...

When to use SQLITE_TRANSIENT vs SQLITE_STATIC?

I would like to create/update text columns in sqlite3. When i retrieve rows after the create/update, the text is '?'. Integer values are properly persisted however. My text statements look like this: sqlite3_bind_text(update_statment, 5, [[dt stringFromDate:self.updated] UTF8String], -1, SQLITE_TRANSIENT); I've tried SQLITE_TRAN...

Store specific interactions with Core Data

I was reading the docs on core data looking to speed up my search. I found the following and was slightly confused as to what it meant: The SQL store, on the other hand, compiles the predicate and sort descriptors to SQL and evaluates the result in the database itself. This is done primarily for performance—databases are mu...

Rails : Rake Test:functionals cannot access DB (Sqlite3 on winXP)

Hi, I am unable to run rake test:functionals with SQLite3, it gives me this error : rake aborted! Permission denied - db/test.sqlite (See full trace by running task with --trace) My setup is on Windows XP. Tests were working a few weeks ago. Rails 2.3.2, Rake 0.8.7, sqlite3-ruby 1.2.5 gems I am using Netbeans for development, but e...

Pivot in SQLite

I'd like to get a table which shows students and the marks they receive for all of their subjects in one query. This is my table structure: Table: markdetails ## studid ## ## subjectid ## ## marks ## A1 3 50 A1 4 60 A1 5 70 B1 ...

Primary Key Effect on Performance in SQLite

Hi, I have an sqlite database used to store information about backup jobs. Each run, it increases approximately 25mb as a result of adding around 32,000 entries to a particular table. This table is a "map table" used to link certain info to records in another table... and it has a primary key (autoincrement int) that I don't use. sqli...

Windows Pre-Caching SQLite problem

SQLite is a great little database, but I am having an issue with it on Windows. It can take up to 50 seconds to perform a query on a 100MB database the first time the application is launched. Subsequent loads take 10% of that time. After some discussions on the SQLite mailing list, I am told "The bug is in Windows. It aggressively pre-...

Sqlite : Sql to finding the most complete prefix

I have a sqlite table containing records of variable length number prefixes. I want to be able to find the most complete prefix against another variable length number in the most efficient way: eg. The table contains a column called prefix with the following numbers: 1. 1234 2. 12345 3. 123456 What would be an efficient sqlite query ...

SQLite query in android application

Hi, I use this query in my android database, but It return no data. Am I missing something? SQLiteDatabase db = mDbHelper.getReadableDatabase(); String select = "Select _id, title, title_raw from search Where(title_raw like " + "'%Smith%'" + ")"; Cursor cursor = db.query(TABLE_NAME, FROM, select, null, null, null, n...

Importing CSV file in SQLITE3 results in a blinking cursor with no action!

Hello, I ran the following command in SQLITE3 command line tool. sqlite> .import out.txt Test And the following is the result: sqlite> .import out.txt Test ...> "...>" keeps showing up if I hit enter. It looks like it's expecting another parameter, except I can't find anything on Google. Thanks always ...

Importing CSV file into Rails sqlite3 database

Hi, I have created Rails database using the following schema: ActiveRecord::Schema.define(:version => 20090807141407) do create_table "trunks", :force => true do |t| t.integer "npa" t.integer "nxxFrom" t.integer "nxxTo" t.string "trnk" t.datetime "created_at" t.datetime "updated_at" end end In my CSV...

SQLite insert query giving error after 246 records

hi everyone , need urgent help. i am trying to insert 1916 records in sqlite database in iphone, but after inserting 246 records i am getting an error "Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error while inserting data. 'unable to open database file'' ". plz help me. is there any settin...

SQL adding composite primary key through alter table option

I have already created a table to the database. Table is something like following (I am using sqlite on mac for iPhone dev) create table ( attendanceDate varchar, studentNo integer, absentDetail varchar ); Now I have already committed this statements. What I need is the following: Add a composite primary key (attandanc...

Difference when using last_insert_row() in Javascript function vs. in DB Query Tool?

I have created a table in Google Gears (Sqlite): db.execute('create table if not exists SPALINKS (link_id int PRIMARY KEY, sid1 int, sid2 int, label text, user text, Timestamp int'); When using the Google Gears Database Query Tool (in FF), INSERT with 'last-insert-rowid' work fine. Inserts from Javascript work fine, as long a I don't...

Where should I create my DbCommand instances?

I seemingly have two choices: Make my class implement IDisposable. Create my DbCommand instances as private readonly fields, and in the constructor, add the parameters that they use. Whenever I want to write to the database, bind to these parameters (reusing the same command instances), set the Connection and Transaction properties, th...

How to use SQLite :memory: database in webpy for unittesting

I want to use a SQLite in memory (":memory:") DB for the tests in my webapp. I'm using nosetests for the tests, and webpy as framework. I want to populate the DB in the setup() function, and then run all my tests. My problem is that webpy closes all the open DB connections after each request, and the SQLite :memory: DB only lasts until ...

How do I configure FluentNHibernate to not overwrite an existing SQLite db file?

Here is my configuration: this.factory = Fluently.Configure(). Database(SQLiteConfiguration.Standard.UsingFile("foo.db"). ShowSql()). Mappings(m => m.FluentMappings.AddFromAssemblyOf<Bar>()). ExposeConfiguration(BuildSchema). BuildSessionFactory(); BuildSchema looks like this: private static void BuildSchema(C...

SQLite - ORDER BY RAND()

In MySQL I can use the RAND() function, is there any alternative in SQLite 3? ...

Preparing SQL Statements with PDO

My code looks like this: // Connect to SQLite DB DB('/path/to/sqlite.db'); DB('BEGIN TRANSACTION;'); // These loops are just examples. for ($i = 1; $i <= 10000; $i++) { for ($j = 1; $j <= 100; $j++) { DB('INSERT INTO "test" ("id", "name") VALUES (?, ?);', $i, 'Testing ' . $j); } } DB('END TRANSACTION;'); And here i...

How to get any update from Mysql to sqllite in iphone

I have to download only updated data from my mysql database that I have created at server. i also have sqllite database for iphone . Now i want any changes in database would prompt the user for doing updation. Also an update button will be there for updating . how to identitfy the data is updated in the database . Also is there any...