sqlite3

How can I get the column names when querying with DBI in Perl?

I'm using DBI to query a SQLite3 database. What I have works, but it doesn't return the columns in order. Example: Query: select col1, col2, col3, col4 from some_view; Output: col3, col2, col1, col4 3, 2, 1, 4 3, 2, 1, 4 3, 2, 1, 4 3, 2, 1, 4 ... (values and columns are just for illustration) I know this i...

How do I drop a table from SQLite3 in DJango??

I made a model, and ran python manage.py syncdb. I think that created a table in the db. Then I realized that I had made a column incorrectly, so I changed it, and ran the same command, thinking that it would drop the old table, and add a new one. Then I went to python manage.py shell, and tried to run .objects.all(), and it failed, say...

Use of Mutex between a c# exe and an c++ dll

Is it possible to use a Mutex Object for a application which users c++ dll to do background work and a c# to display it. Bot these use a common resource ie db . So can Mutex be used to lock this resource. In my db c++ will insert to db and c# will read it. ...

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,...

how to create triggers in sqlite3?

Hello all, i am new to this topic. i want something like this. i have two tables in my sqliteDatabase one is master and another is child. Now if i delete a record from master suppose i delete a row from master where id=5, then all the records from the child table whose id = 5 deleted automatically. I don't know how to create triggers a...

Reading from a locked SQLite3 database

I am looking at a SQLite database owned by a third party process. It appears locked and has a *-journal file. What I don't know, is if the lock is shared or exclusive. I am hoping to read from the database even though it is currently locked by that other process. I will only ever read from the database. Currently I fail at this. I get ...

Create View with Mutliple Tables in SQL Server 2008

I'm converting an app to use SQL Server 2008 that is currently using SQLite. How would I do the following view in SQL Server 2008? I can't seem to figure out the syntax for calling multiple tables: CREATE VIEW new_mimetypes AS SELECT DISTINCT fd.mimetype AS 'newMimetype' FROM files_detail AS fd WHERE ...

HOW TO sqlite3_load_extension from within Objective-c [error: dlopen(...) image not found]

I am trying to load an extension to sqlite3 for use within iPhone application objective-c code. I successfully compiled the c file of new functions into a dylib named libsqlitefunctions.dylib. Here is where I am a bit lost. I call sqlite3_load_extension as follows: char *error = sqlite3_malloc(MAX_SQLITE_ERROR_MESSAGE_SIZE); const char ...

Sqlite3_bind for LIKE statement (Objective-C)

Hi, I try to bind a NSString value into my SQL query but its not working, and I don't know what I'm doing wrong. Here is my query: Select * from fiche where fichetype = 'EVENT' and sdate like '?%' ORDER BY cdate DESC And I'm using this part of code to bind the value: sqlite3_bind_text(getEventStatement, 1, [value UTF8String], -1, ...

Rails Question: Sqlite3 dll not found on windows (even the old 1.2.3 version)

I followed the suggestion here: and the gem seemed to install correctly, but when I ran rake:db:migrate from the windows command line, I got a full on pop up saying: "This application has failed to start because sqlite3.dll was not found. Re-installing the application may fix this problem" which is really weird, because normally (when ...

How do I insert data with SQLite?

Total newbie here, regarding sqlite, so don't flame too hard :) I have a table: index name length L breadth B height H 1 M-1234 10 5 2 2 M-2345 20 10 3 3 .... How do I put some tabular data (let' say ten x,y values) corresponding to index 1, then another table to index 2, and...

String equality and SQLite3

I'm experiencing a very strange issue with string equality in SQLite3. I have a table with a text column named type. If I run select distinct type, 2 from mytable order by type (the 2 is there to get the pipe separator), I get: ... Tops|2 ... Tops|2 i.e., the same column appears twice. This is causing me problems because queries wi...

Get number of modified rows after sqlite3 execute

When performing SQL statements such as UPDATE, and INSERT, the usual .fetch*() methods on the Cursor instance obviously don't apply to the number of rows modified. In the event of executing one of the aforementioned statements, what is the correct way to obtain the corresponding row count in Python, and the corresponding API in the Sqli...

Connect to a remote sqlite3 database with Python

I am able to create a connection to a local sqlite3 database ( Using Mac OS X 10.5 and Python 2.5.1 ) with this: conn = sqlite3.connect('/db/MyDb') How can I connect to this database if it is located on a server ( for example on a server running Ubuntu 8.04 with an IP address of 10.7.1.71 ) , and is not stored locally? e.g. this doe...

Calling sqlite3_close for a static sqlite3* handle

I want to provide access an sqlite database in Objective C. I don't want the caller to bother about the DB itself and so I intend to do something like this in my DataStore.m: #import "DataStore.h" #import <sqlite3.h> static sqlite3 *database = nil; @implementation DataStore + (void) initialize { if(self != [DataStore class]) r...

Migrate a SQLite3 database table to MySQL with Python without dump files

I need to migrate information that I created in SQLite3 to a MySQL database on my website. The website is on a hosted server. I have remote access to the MySQL database. I initially thought it would be easy, but I am not finding any good info on it, and everything I read seems to imply that you need to dump the SQLite3 file, convert i...

Attempt to write a read-only database - System.Data.SQLite

Hi guys, I'm having a little bit of a problem that I thought was related to Security but, turns out can't be as I did almost everything ... Plenty of information on this on the web but nothing has an answer to fix the issue. Let me tell my steps: Have a Website on VS2k8 that when I debug or start from Cassini, all works fine When se...

Ruby On Rails ActiveRecord model not showing "blacklist" field

So I'm trying to rough out a design in Ruby, and so I ran ruby script/generate scaffold item name:string description:text model:string manufacturers_name:string category:string weight:decimal upc:string ebay_cat_id:string blacklist:bool in_discovery:bool archived:bool The only problem is that none of the bool fields are on the model....

Data Storage Problem in sqlite3

I am developing trading software, front end qdevelop and back end sqlite3. There was a problem that is when save the record through the application that doesn't store in a database after close the application. I think the problem is in db-journal file. And how could i commit the data from db-journal file to original .db file. Any fix the...

Objective-C: Do You Have to Escape Single Quotes in Strings Destined fo SQL?

Hi, I'm an iPhone developer. I'm writing my unit test cases, one of which checks if the app accepts UTF8 strings to be written to a sqlite3 database. I created a test case to generate random UTF8 strings and I can see the ones that fail do so because they contain an apostrophe (') which I need to be accepted. I'm writing to the databa...