sqlite

SQLITE Blob OR file system for images

Hello, I am building an application based on a single table with a column with text. Occassionally, an adjacent column will have an image. Is it better to store this image as a BLOB in SQLITE or should I store them on the file system and reference them from my programs. Thanks! ...

how we can ensure caching to reduce file-system write cycle for SQLite databases

Hello, I would like to know how we can implement cashing in sqlite database.My primary objective is write data to ram and after when cache is filled i want to flush all the data to disk database.Whether it is possible? if yes Can i get any sample codes? Thanks Aneesh ...

information_schema.columns on sqlite

I would like to do a query like next: SELECT table_name, column_name, data_type, is_nullable, ... FROM information_schema.columns on a sqlite database. I checked PRAGMA table_info(table_name); but doesn't suit my needs, just check fields for one table. I checked select * from sqlite_master where type = 'table'; But this jus...

What are the disadvantages of having many indices?

I recently sped up a complicated query by an order of magnitude by giving SQLite a good index to work with. Results like this make me wonder if I should index a lot of other fields that are commonly used for JOINs or ORDER BY clauses. But I don't want to get overzealous and have it backfire on me: I assume there must be some reasons not ...

sqlite column width

Hello, i'm executing PRAGMA table_info over a sqlite db PRAGMA table_info(my_table); And these are the columns retrieved: name type notnull dflt_value pk I noted there is no column width in case of (n)(var)char data types, ¿is there any easy way to get this info? NOTE: I know there is no problem inserting large values in these co...

SQLite Performance Benchmark -- why is :memory: so slow...only 1.5X as fast as disk?

Why is :memory: in sqlite so slow? I've been trying to see if there are any performance improvements gained by using in-memory sqlite vs. disk based sqlite. Basically I'd like to trade startup time and memory to get extremely rapid queries which do not hit disk during the course of the application. However, the following benchmark giv...

How can I escape characters in SQLite via bash shell?

I am trying to send a query to SQLite from the command line using bash. I need to escape both single quotes and double quotes, and escape them so that bash does not misinterpret them. Here is a typical query: select * from contacts where source = "Nancy's notes"; How can I send this query from the command line? The basic syntax is som...

Are there known issues with using sqlite and file locking on different platforms?

I'm using sqlite to do an index of a proprietary file, and the database will be accessed with multiple threads (using different sqlite handles) for reading and writing. I know that sqlite locks the file in order to provide concurrency for readers/writers, and depends on the OS file api for locking. This is all fine on windows and linux...

Get specific "version" of a column

I have an app that uses SQLite to store data locally. There may be more than one file storing the data. All the files contain a list of items, but only one of them has the "correct" status for the current user (basically, there is a "user" db in $HOME and a "system-wide" one in /etc). Usually, both files will contain the same list of ...

Relative path to SQLite DB in context.xml

Is it possible to use a relative path to an SQLite database file in the context.xml file of a Java web application? At present, I have: <?xml version="1.0" encoding="UTF-8"?> <Context path="/mywebapp"> <Resource name="jdbc/mydb" auth="Container" type="javax.sql.DataSource" maxActive="100" maxIdle="30" maxWait="10000" ...

How to limit database flushing to disk?

Hello, I am using sqlite database in my arm9 embedded linux platform. I want to reduce writes to disk database because my disk is a flash memory and it needs minimum write cycles. So I tried to increment SQLITE_DEFAULT_CACHE_SIZE as 5000. My objective was to write data to cache and when the cache is filled, automatically flush to disk. B...

How do I create a trigger on multiple keys on sqlite3

As far as I am aware, there's no direct ability to have foreign key constraints in SQLite 3. I have a many-to-many table that needs this, so I'm creating a trigger that raises an ABORT when the foreign key constraint is violated. My statement looks like this: CREATE TRIGGER fkFooBar BEFORE INSERT ON Foo_Bar FOR EACH ROW BEGIN ...

What is a good tool for creating railroad diagrams?

I was very impressed by sqlite's syntax diagrams and was wondering if anyone could recommend software which would let me create similar graphs. ...

How do I make an UPDATE while joining tables on SQLite ?

I tried : UPDATE closure JOIN item ON ( item_id = id ) SET checked = 0 WHERE ancestor_id = 1 Then : UPDATE closure, item SET checked = 0 WHERE ancestor_id = 1 AND item_id = id Both works with MySql but gives me a syntax error in SQLite. How can I make this UPDATE / JOIN works with SQLite version 3.5.9 ? ...

What joins does SQLite support?

According to the join-op syntax, SQLite has 13 distinct join statements: , JOIN LEFT JOIN OUTER JOIN LEFT OUTER JOIN INNER JOIN CROSS JOIN NATURAL JOIN NATURAL LEFT JOIN NATURAL OUTER JOIN NATURAL LEFT OUTER JOIN NATURAL INNER JOIN NATURAL CROSS JOIN Are they all unique? Which are equivalent? ...

SQlite C warnings

I am using the sqlite3.c library. It compiles with 140 something conversion warnings. What's wrong with my set-up? Thanks. sqlite3.c c:\Projects\Lib\sqlite3.c(11311) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data c:\Projects\Lib\sqlite3.c(11312) : warning C4244: '=' : conversion from 'double' to 'in...

Can I search multiple table columns in SQLite using a wildcard?

I have a table, contacts, that has a dozen columns or so. I want to identify each row in which at least one column contains a regular expression. I'm wondering if it's possible to do something like this: select * from contacts where * like '%re%'; instead of this: select * from contacts where last_name like '%re%' or first_name like ...

Can I have an inner SELECT inside of an SQL UPDATE?

I have a database like where: Table foo has columns id and name Table bar has columns id and foo_id I have an incoming HTTP query with a foo.name, I'd like to insert a row into bar with bar.foo_id set appropriately. So, for example: > SELECT * FROM foo; id name ------ ------- 1 "Andrey" (1 row) > SELECT * FROM bar; (0 rows)...

How to implement the accent/diacritic insensitive search in Sqlite?

Is there a way to do an accent/diacritic insensitive search in sqlite? Googling, I've found this, but I sincerely don't know how to create my "collation function" in C#. I'm trying create the pt-br collation for Sqlite... ...

PRAGMA journal_mode = OFF is not working why?

Hello All, I am running SQLite3 version sqlite-3.6.12 and I have successfully ported it to my OS. The problem I am seeing is that when I execute the command "PRAGMA journal_mode = OFF" it returns "OFF" but I am still seeing *.db-journal files being created. It is critical that these files are not created for the purpose of my project....