sqlite

Entity Framework: Inserting new entity associated with another entity

I have two tables FilesystemEntries and CacheEntries where there is an association of 0..1 CacheEntry per FilesystemEntry (that is a FilesystemEntry can have a null CacheEntry, but not vice-versa). Initially, the CacheEntry for all FilesystemEntries is null. I'm having trouble changing this (adding a new CacheEntry). The code (truncated)...

SQLite equivalent of SQL Server DateAdd function

I need help reproducing the following SQL statement to a statement that SQLite understands. SELECT * FROM SomeTable WHERE [Date] >= DATEADD(day, -14, GETDATE()) Any help is much appreciated! ...

SQLLite not inserting into

I have the following code block SQLiteConnection cnn = new SQLiteConnection("Data Source=" + getDBPath()); cnn.Open(); SQLiteCommand mycommand = new SQLiteCommand(cnn); string values = "'" + this.section + "','" + this.exception + "','" + this.dateTimeString + "'"; string sql = @"INSERT INTO Emails_Pending (Section,Message,Date_Time) va...

Sql Query Solution

I have a query as follows. select strftime('%Y-%m',A.traDate) as Month,sum(A.TraAmt) as Total,C.GroupType from TransactionTbl A left join TransactionCategory B on A.CategoryID = B.CategoryID left join CategoryGroup C on B.CatGRoupID=C.CatGRoupID where A.UserID=1 and A.ProfileID=1 and date(A.TraDate) between date('2009-12-01') and dat...

Using SQLite from Objective-C

I am having problems writing statements, especially when updating. I want to update a column with a parameter, but I don't know the special characters to use like @ or %d. I tried to do: const char *sqlStatement = [[NSString stringWithFormat: @"update lugar set frecuencia ='d%'aumentador Where idLugar = '%d'", idLugarParametro] ...

can we property/synthesize to a sqlite3 *database object ?

Hi, I have code snippet, which is like this... #import <sqlite3.h> @interface DatabaseClass : NSObject { sqlite3 *database; } @property ( nonatomic, retain ) database;//////this////// @end In the implementation file; #import "DatabaseClass.h" @implementation DatabaseClass @synthesize database;//////this/////// @end My...

SQLite ADO .NET: how to specify a default value for GUID?

Hello. As i previously discovered, SQLieParameter (parametrized query) can't be used for "create table" in SQLite ADO .NET. I need to create a table with GUID field and i want a default value to be all zeroes. But the following query: create table test ( name text default 'no name', id guid default 0 ) Creates a table where adding an...

Dependable insert with SQLite

I'm writing a program in C# that needs to insert data in multiple tables. The first insert returns a last insert rowid, which is in turn used to perform an insert on the other tables. In pseudo code: INSERT INTO TableFoo (Col2, Col3, Col4, etc.) VALUES (@Bla2, @bla3, @bla4); Immediately after this insert I get the last insert id by: ...

Simple multi-user database solution

I've written a Windows desktop application that works with Sqlite very nicely. It was a single user app, and the database sits right on the machine where the app runs. However, the application has grown, and now multiple users should be able to run the app and connect to one shared database. I'd like to just be able to share the sqlit...

iphone sqlite NSDate bug

Hi, i use core data in my iphone app, but in some case i use sqlite to access to data and ia have a problem with NSDate. NSDate *now = [NSDate date]; NSCalendar *calender = [NSCalendar currentCalendar];; NSDateComponents *comp = [calender components:NSYearCalendarUnit fromDate:now]; [comp setDay:1]; [comp setMonth:1]...

How to pass a value from Cocoa to an SQLite query

Hi, first of all please let me say that I am quite new to objective c development. I am writing a small app for personal use for the iphone, but I have some problems executing the following code: NSString *sql = [[NSString alloc] initWithFormat:@"select color_r, color_g, color_b from Calendar where ROWID = %@", [calendarsID objectForKe...

Retrieving and Presenting SQL Joined Table Records with PHP, Sqlite (or MySql), and HTML

Hello: Please bare with me while I try to explain my question. I have a Sqlite database that has a table consisting of company information (Companies) and a table consisting of product information (Products). The Companies table id is Company_Name. It is joined with the Products table by Company_Name. For example, Company "A" can ha...

SQLIte help need

What is an alternative in SQLite as STR_TO_DATE() funciton in MySQL? ...

sqlite Indexing Performance Advice

I have an sqlite database in my iPhone app that I access via the Core Data framework. I'm using NSPredicates to query the database. I am building a search function that needs to search six different varchar fields that contain text. At the moment, it's very slow and I need to improve performance, probably in the sqlite database. Would ...

Sqlite API boolean access

This should be an easy question I figure, but I hadn't found this answered else where surprisingly, so I'm posting it here. I've inherited a Sqlite driven database which contains boolean columns in it, declared like this: CREATE TABLE example ( ex_col BOOLEAN NOT NULL DEFAULT 0, ); This table is trying to be accessed via the sqlite...

Convert from tailf XML DB to SQLite DB

I have a project which is composed of a board with 2 CPUs that have access to 2 different memories (FLASH and DDR), and the 2 CPUs can communicate by ethernet among themselves. one CPU is running XML hierarchical DB files handled by "tail-f" and the other is running SQLite DB and also a CLI which is exposed to the user through which he...

How Fast would a SQLite join be compared to a custom tree search?

Continuing some themes in this question, I would like to know if I could get a performance of O(log n) on the size of the table from somes sqlite queries. The first would get the mth element of a table ordered by weight: select id, weight from items order by weight limit 1 offset m The second would do the opposite, get mth position o...

Get and display HTML data from SQLite3 (Iphone)

Hi, I try to retrieve HTML data from my database and display them in a UITextView, the only problem is that I don't know how to tell him that its HTML code and not only text, for the moment I have that: NSString *aDescription = [NSString stringWithUTF8String:(char *)sqlite3_column_text(getFicheStatement , 1)]; Thanks, ...

iPhone - Core Data crash on migration

I have problems, when i install app from Xcode all works but if I build app and install it from iTunes I have an error with the database at launch. This happens only than i have changes in the core data model and need to migrate to a new version. At first launch at crashes with message: Thread 0: 0 libSystem.B.dylib 0x0...

Does SQLite have Cursors?

Hi there, i wonder if i could run the following procedure in SQLite: set nocount on select T.ID, max(T.SerialNo) as SerialNo into #Tmp_Ticket_ID from Ticket as T, Ticket as inserted where t.ID = inserted.ID group by T.id having count(*) > 1 declare zeiger cursor for select SerialNo from #Tmp_Ticket_ID declare @SerialNo int ...