sqlite

Replacing Core Data sqlite file while app is running, data does not update

I am developing a backup/restore system for my app in which the user can download a backed-up version of the core data store (sqlite file) and replace the currently-used data store with the downloaded file. However, once the user downloads the file and replaces the current data store, none of the data appears to have been updated. But wh...

SQLITE Selection and order by causing errors

Hi, i'm trying to get a query that returns rows only with a specified name, and sort descending by week (integer). Everytime I try and run it it gives me a FC and logcat says ERROR/AndroidRuntime(728): android.database.sqlite.SQLiteException: no such column: New: , while compiling: SELECT Name, Week, Total FROM notes WHERE Name=New OR...

Storing binary data as a string in a Web Sql Database

Ok, so I am downloading chunks of data via xhr and I want to store it locally for a chrome extension. At first I was able to store it in localStorage, but then I needed to move on to larger chunks that localStorage can't handle.So I decided to store it in a Web Sql Database. However I was able to store the data in localStorage exactly a...

Replace SQLite with SQL Server?

Hi everyone. Does anyone know if it's good solution to use SQLite in multi-thread environment. I want to replace SQL Server with more simple and built-in database as there is no need to feed such big server DB. The supposed max size of DB would be 4 gigabyte after 4-5 years of usage. Is it normal for built-in DB? Could it affect performa...

Query select a bulk of IDs from a table - SQL

I have a table which holds ~1M rows. My application has a list of ~100K IDs which belong to that table (the list being generated by the application layer). Is there a common-method of how to query all of these IDs? ~100K Select queries? A temporary table which I insert the ~100K IDs to, and Select query via join the required table? Tha...

[SQL] Related rows based on text columns

Given that I have a table with a column of TEXT in it (MySQL or SQlite) is it possible to use the value of that column in a way that I could find similar rows with somewhat related text values? For example, I if I wanted to find related rows to row_3 - both 1 & 2 would match: row_1 = this is about sports row_2 = this is about study row...

Python and sqlite trouble

Hello, I can't show the data from database sqlite in python. connection = sqlite3.connect('db') connection.cursor().execute('CREATE TABLE IF NOT EXISTS users ( \ id TEXT, \ name TEXT, \ avatar T...

Writing blob from SQLite to file using Python

Hello, A clueless Python newbie needs help. I muddled through creating a simple script that inserts a binary file into a blog field in a SQLite database: import sqlite3 conn = sqlite3.connect('database.db') cursor = conn.cursor() input_note = raw_input(_(u'Note: ')) input_type = 'A' input_file = raw_input(_(u'Enter path to file...

Is an index needed for a primary key in SQLite?

When an integer column is marked as a primary key in an SQLite table, should an index be explicitly created for it as well? SQLite does not appear to automatically create an index for a primary key column, but perhaps it indexes it anyway, given its purpose? (I will be searching on that column all the time). Would the situation be any d...

SQL: check to see which id's already exist

Let's say I have a list of IDs and I want to see if rows already exist with those IDs in my SQL database. Is there a single SQL command that I can issue to get back the subset of the ID list that's not already represented in the database? I could iterate over each ID in my code and issue a separate SQL check for each ID, but that sounds ...

Replacing value in all cursor rows

Hi there, Using SQLite and Python 3.1, I want to display currency data in a HTML table via. a template which accepts a cursor as a parameter. Hence all currency values must have 2 decimal places, but SQLite stores them as float type (even though the structure states decimal :-( ) so some must be converted before display (eg. I want 12....

SQLite query - using [] in SQLite queries

Dear Sirs I would like to know if it is possible to use [] in SQLite query as we used to in Access and other DB. e.g. SELECT * FROM mytable WHERE fwords like '%b[e,i,a]d%' this will retrieve all rows have fwords containing bad, bed, bid Thanks a lot ...

In-memory/Embedded DB solution

I'm currently using the in-memory option for SQLite and while it works (a bit slow right now but I'm still exploring ways to optimize my usage of it like batching and such), I'm just curious whether there are other alternatives to SQLite that support in-memory DBs and are embedded solutions. I don't necessarily need a schema-based DB (N...

Help with showing data on spinner.

Hi , i would like to show data from my database onto a spinner. how would that be possible? As there is an null error in my logcat. Booking.java public class Booking extends Activity { private DBAdapter db; private Spinner colourSpinner; private String txtArrival; /** Called when the activity is first created. */ ...

How to query two different fields from a table, and make it appear in the same row?

I have two tables. Say: This is table 1 +--------+-----------------------+ | stuff | foreing | foreing2 | +--------+-----------------------+ | bazzzz | 555 | 666 | +--------+-----------------------+ This is table 2 +-----------------------+ | id_table | values | +-----------------------+ | 555 | Foo | +-...

SQLite - Is it possible to make a non-integer Primary Key work?

Thanks for reading and hopefully answering, Due to legacy issues and company policy, I am working with SQLite 2.8.17 and have a few varchars as primary keys. But when I run a *"pragma integrity_check"*, it reports "rowid missing from index" and "wrong # of entries in index" on the tables with the varchar primary key but the returned re...

Deleting the primary index of a SQLite database

Hi All, I am building an iPhone app which has a quite big SQLite database. In order to make it lighter I thought I could delete the Primary index, and then add it on the first launch. How is would that be possible ? Thank you ...

Qt and SQLite can't handle 'NULL' values or i'm doning something wrong?

Hello. If i create a table using Qt and SQLite that has a nullable columns (columns without "NOT NULL") and add a null value into it (using NULL QVariant) retrieving such value back will return not and NULL QVariant, but QVariant of type String and value "". Am i doing something wrong or Qt with SQLite can't distinguish between NULL val...

Calculate the number of direct children in a hierarchy

I have a simple hierarchy of categories in an SQLite3 database, each row storing a parent ID or NULL as appropriate. I would like to find out whether a particular category is a leaf, essentially by determining, for each row, whether it has a parent ID defined. Or rather, determining a count of child rows for each row. Table definiti...

SQLite Data Types

Hi all, I am using SQLite in a Java application through Zentus. In this context I need to save and queries Java long values in my database. Coming from other RDBMS I created table as following to stor long values: CREATE TABLE myTable (id INTEGER PRIMARY_KEY, longValue LONG) This solution produces the excepted behavior but after rea...