sqlite

Can you read pragma statements on command line startup in SQLite

I use the command line sqlite3 executable to check queries I make from my code. Is there a way to read in pragma statements or other session setup (".mode csv" for example) when the executable starts up? I know I can do a ".read " once I'm in, but that's tedious. ...

How do i insert 1000 times in one statement? with SQLITE?

-edit- to make it more clear, i was just using a cmd line (actually ide in this case) and wanted to do quick testing with ram and didnt feel like making a full blown prj for a quick throwaway test. I want to fill this table with 10000000 values but first i want only 1000. I tried this in sqlite database browser but 3 isnt inserted unle...

Core Data, Bindings, value transformers : crash when saving

Hi, I am trying to store a PNG image in a core data store backed by an sqlite database. Since I intend to use this database on an iPhone I can't store NSImage objects directly. I wanted to use bindings and an NSValueTransformer subclass to handle the transcoding from the NSImage (obtained by an Image well on my GUI) to an NSData contain...

Populate Android Database From CSV file?

Is it possible to take a csv file stored in the res/raw resource directory and use it to populate a table in the sqlite3 database? My thought was that, if there was a way to do a bulk import for the entire file into the table then that would be cleaner and faster than iterating over each line in the file and executing individual insert ...

sqlite database help

I have some questions regarding database in android. In my project, I would like to create a database with single table. I would also like to insert data on this table from word or excel document. is it possible? if so please how can I do it? some code snippets would be of great help. I have four different activities which I would like...

Using a ICollection Value in sqlite SELECT parameterized statment

Im trying to get all the entrys from a sqlite Database which have the same name as the keys in a Hashtable. My Statement looks like this. // the keys from the hashtable are names equivalent // to name entrys in the SomeTable Names Collumn Hashtable names; String query = "SELECT Id, Name FROM SomeTable WHERE Name LIKE (@Names)"; SQLit...

Importing a CSV file into a sqlite3 database table using Python

Hi, I have a CSV file and I want to bulk-import this file into my sqlite3 database using Python. the command is ".import .....". but it seems that it cannot work like this. Can anyone give me an example of how to do it in sqlite3? I am using windows just in case. Thanks ...

Core Data No Longer Updating Sqlite Schema

I am using core data for my app and I never had any problems adding or removing columns until recently. But now even if I make changes to my xcdatamodel and generate new and updated entity h/m files, sqlite doesn't seem to be picking up the changes. I actually went over to the documents folder and inspected the create statement for th...

Best way to access a sqlite database file in a web service.

First question from me on stack overflow. I have created a java web application containing a web service using netbeans (I hope a web application were the correct choice). I use the web application as is with no extra frameworks. This web service use a sqlite JDBC driver for accessing a sqlite database file. My problem is that the file...

Getting error that the database is locked when refreshing the page

I am running apache with mod mono and my asp.net app is using mono sqlite as its db. When i refresh the page twice i get the DB is locked error. The folder it is in is chmod 777. The webapp is creating sqlite.db and sqlite.db-journal but it doesnt seem to be able to delete the journal. Also it has problems when i load the page once. It d...

Getting records from a table based on a filter field and Between but also having the OR logic for multiple rows

I have a this table, where I store multiple ids and an age range (def1,def2) CREATE TABLE "template_requirements" ( "_id" INTEGER NOT NULL, "templateid" INTEGER, "def1" VARCHAR(255), "def2" VARCHAR(255), PRIMARY KEY("_id") ) Having values such as: templateid | def1 | def2 ------------------------------- 100 | 7 | ...

get records from sqlite group by month

hi i hve an sqlite db which contain transactions each transaction has an price and has an transDate i want to retrieve the sum of the transaction group by month so the retrieved records should be like the following Price month 230 2 500 3 400 4 pleas any help ...

Can i store sqlite db as zip file in iphone application

My sqlite file has a size of 7MB. I want to reduce its size. How i can do that ? When am simply compressing it will come around only 1.2 MB. Can i compress my mydb.sqlite to a zip file ? If it is not possible, any other way to reduce size of my sqlite file ? ...

Using PRAGMAs as sources in SQLite in getting column names

Problem: I want to do this operation select name from pragma table_info(my_awesome_table) However, it yields a syntax error. I have the sneaking suspicion this is possible, but it doesn't seem to be documented as usable in the SELECT docs with sqlite. ...

I need to alter a sqlite3 table to add FTS3

I need the ability to add FTS3 to a sqlite3 table after it was created, not as it is created. Does anyone know the ALTER syntax to accomplish this? ...

Drawing information from relational databases in Rails

I am trying to pull the name of the Artist from the Albums database. These are my two models class Album < ActiveRecord::Base belongs_to :artist validates_presence_of :title validates_length_of :title, :minimum => 5 end class Artist < ActiveRecord::Base has_many :albums end And here is the Albums Controller def index ...

Use combobox value as query value (VC# 2k8 / ADO SQLITE)

Hi, I'm a newbie in VC# and ADO SQLITE... I'm trying to change the content of a combobox according to the value present in another one... My problem is here : SQLiteCommand cmd3 = new SQLiteCommand("select distinct(ACTION) from ACTION_LIST where CATEGORY='comboBox1.text'", conn2); What to use to do the job ? Here 'comboBox1.text' is...

Rails: three most recent comments with unique users

what would I put in the named scope :by_unique_users so that I can do Comment.recent.by_unique_users.limit(3), and only get one comment per user? class User has_many :comments end class Comment belongs_to :user named_scope :recent, :order => 'comments.created_at DESC' named_scope :limit, lambda { |limit| {:limit => limit}} na...

proper Django ORM syntax to make this code work in MySQL

I have the following django code working on an sqlite database but for some unknown reason I get a syntax error if I change the backend to MySQL...does django's ORM treat filtering differently in MySQL? def wsjson(request,imei): wstations = WS.objects.annotate(latest_wslog_date=Max('wslog__date'),latest_wslog_time=Max('wslog__time'...

Refining data stored in SQLite - how to join several contacts?

I'm storing contacts between different elements. I want to eliminate elements of certain type and store new contacts of elements which were interconnected by the eliminated element. Problem background Imagine this problem. You have a water molecule which is in contact with other molecules (if the contact is a hydrogen bond, there can b...