sqlite3

sqlite remove non utf-8 characters

I have an sqlite db that has some crazy ascii characters in it and I would like to remove them, but I have no idea how to go about doing it. I googled some stuff and found some people saying to use REGEXP with mysql, but that threw an error saying REGEXP wasn't recognized. Here is the error I get: sqlalchemy.exc.OperationalError: (Ope...

Can I synchronize many records from sqlite database from iphone to mysql database on server.

Hi everyone, Currently I am developing an iPhone app with sqlite database, this database just has only one table with many records. And my server is using MySQL database. I would like to ask: Can I send many records from sqlite database to MySQL database to update the table in MySQL database. Because I think I can do update with just o...

sqlalchemy database table is locked

I am trying to select all the records from a sqlite db I have with sqlalchemy, loop over each one and do an update on it. I am doing this because I need to reformat ever record in my name column. Here is the code I am using to do a simple test: def loadDb(name): sqlite3.connect(name) engine = create_engi...

SQLite Database and Data Access Logic

Problem : I have to create a number of tables for caching some amount of textual data, obtained by reading XMLs. These tables need to be created only once - on the initial run of the application. The data in the tables should be cleared after fixed time period. There should be a class exposed to other classes that would allow CRUD opera...

Authlogic can't find user

I am integrating facebook connect with my application which uses authlogic, facebooker, and the authlogic_facebook_connect plugin. After I log in with facebook, I get redirected to the front page of the site (as per my code) - but the page never loads! - it hangs. Looking at the development log, I see that something is continuously tryin...

How to do multiple join / group by selects using sqlite3?

I have a sqlite3 database with one table called orig: CREATE TABLE orig (sdate date, stime integer, orbnum integer); What I want to do is select the first date/time for each orbnum. The only problem is that stime holds the time as a very awkward integer. Assuming a six-digit number, the first two digits show the hour, the 3./4. show ...

Android sqlite concurrency without exceptions

Sqlite on android lets you access the database from multiple procs for reads, but if you're currently writing from one process, reads and writes from other procs will throw an exception because the first write has a lock on the db. By "procs" I mean other threads in the same app. Is there a standard way to have the other threads simply...

app explosion with conflicting sql primary key

I have a table in a database where the _id column is the primary key. If I try to do an insert into this table using an _id that already exists, my application crashes. How can I do this? Is there a specific kind of Exception I can eat? I've tried SQLiteException to no avail. ...

How many connections can sqlite 3 handle?

Is it ever a good idea to let a large amount of people connect to your website while it is using sqlite? edit: I am using it in a critical ruby on rails application that may have hundreds of concurrent users. ...

SQL - columns for different categories

I am new to SQL. I have a database with data for different exams, for example: Student Test Grade -------------------- St1 T1 A St2 T1 B St3 T1 B St1 T2 B St2 T2 B St3 T2 A St1 T3 A St2 T3 C St3 T3 B Then, I would like to print a report using the Tests (T1, T2 and T3) as columns: Student ...

Debugging an ADO log4net appender (that won't append)

I've had this working before, but now it's not working and I've been tearing my hair out for the past two hours trying to figure it out. I have several appenders, where some are for a "main" log, and another is for another "task" log. The main log has 4 appenders: console, memory, file, and DB (sqlite3). The task log has 3 appenders: ...

iPad Dev: Turn a given Date or String from SQL into NSDate

I have an app that creates and stores a session with a given start date. The user would create a new work session and when they start it, the current time would get saved to the database. The app needs to count time between the start and end of a work session. However, I need to be able to pause, restart, and continue sessions, so I n...

In SQLite3, how can I do SQL-escaping in a LIKE clause?

I'd like to run a LIKE query in sqlite3 with the user's input safely escaped. Basically, I want to do something like this: char* query = "SELECT * FROM table WHERE LOWER(notes) LIKE '%?%'"; sqlite3_stmt* statement; sqlite3_prepare_v2( database, query, -1, &statement, NULL ); But the ? is not honored when inside the LIKE expression. ...

Is there any efficient way to make Android database query faster ?

In my android app i need to get 50,000 database entry(text) and compare them with a value when the activity started(in onCreate() ).I am doing this with the simplest way : i get the whole table from db to a cursor.However this way is too laggy.Are there any other way to do it more effective ? Edit :The app is "scrabble solver" that is w...

Query filtering in Django with sqlite

I've tried the following query with Django, def search(search_text): q = Info.objects.filter(title__contains=str(search_text)) print q.query The query that get printed is SELECT "d"."id", "d"."foo" FROM "d_info" WHERE "d_info"."title" LIKE %hello% ESCAPE '\' The query fails because the text after LIKE doesn't have quotes ...

Sqlite3_step() keeps returning SQLITE_MISUSE on this query. Any pointers?

I am trying to open a sqlite db in the viewDidLoad routine and trying to send a sql query through to the db, but the sqlite_step() fails every time. I am not sure what's wrong here. I am just trying this as a hello world attempt at sqlite3. #import "RootViewController.h" #import "sqlite3.h" static sqlite3_stmt *statement = nil; @imple...

Ruby interpreter 1.8.7.0 [i386-mingw32] keeps failing

I have had this problem for a while, but now it is getting so bad that every 2-3 pageloads my local server is failing. activesupport-2.3.5/lib/active_support/core_ext/module/introspection.rb:73: [BUG] gc_sweep(): unknown data type 0x0(0x950f868) ruby 1.8.7 (2010-01-10 patchlevel 249) [i386-mingw32] This application has requested the ...

Unable to get SQLite for iPhone to use the database file which I supply and instead it creates a new one under Macintosh HD.

I am creating a SQLite3 database project in Xcode for Iphone. I am using the Simulator 3.1.2. Although I have attached the database file in the Resources group of the project and passing the name alright in the Appdelegate file and also creating a local editable copy using: // Copy the database from the package to the user's filesystem...

Sqlite 3: How to DROP TABLE IF EXISTS?

My version of sqlite does not support IF EXISTS operator. So how can I drop a table which may or may not exist without getting an error slapped at me? EDIT: FYI, IF EXISTS and IF NOT EXISTS were added to SQLite 3.3.0 http://www.sqlite.org/releaselog/3_3_0.html. That's not my solution though, I can't update the version on a live applica...

Is it safe to close SQLite db more than once?

I'm using SQLite with python. My code for closing SQLite DB is as follows. def close(self): if not self.closed: self.db.closeDB() self.closed = True def closeDB(self): self.cursor.close() I have one variable 'closed' not to close the db twice. Is this variable necessary? What would happen if I call the close...