Re: [sqlite] A sqlite c++ wrapper, sqlite3x

2012-02-06 Thread Truls Haaland
> Hello everyone,    My project used sqlite3x, a sqlite c++ wrapper. Now for 
> some reason, I wanna upgrade sqlite3 to version 3.7.10.
>  I search the Internet hours, but I don't find the sqlite3x that support 3.7. 
>Have someone used sqlite3x? I need some advice.

sqlite3x web site is at: http://wanderinghorse.net/computing/sqlite/

The author can be contacted at: http://wanderinghorse.net/home/stephan/

Send him an e-mail and see if he can help.

Truls.

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Delegates with linq

2012-02-03 Thread Truls Haaland
> I've reviewed your sample code.  It would seem that the difference between

> the two method overloads is that working one resolves to:

I will look into this. Thank you so much for all your effort and help.

Now I'm off to do some serious googling.

Truls.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Delegates with linq

2012-02-02 Thread Truls Haaland
> Without a more complete example, it's hard to say exactly.  
> However, I suspect it may have something to do with the type(s) of "Id" and 
> "firstId". 

Whole project is at: https://github.com/trulsu/SQLiteTest

The table is defined as:

CREATE TABLE SqLite (
Id UNIQUEIDENTIFIER PRIMARY KEY ASC,
Name TEXT NOT NULL,
Value FLOAT NOT NULL
);The EntityObject SqLite field is defined as:

public global::System.Guid Id
> Also, since the underlying storage is of the "Id" column is text,
> it could be related to case sensitivity.


The Guids are read correctly when using connection.SqLite.ToList() so I don't 
think this is the problem. I am comparing Guid to Guid, so case sensitivity in 
the LINQ statement should not be an issue.

> Also, did you get the results you expect with a previous version of
> System.Data.SQLite?

Same results with 1.0.78.

Truls.

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Delegates with linq

2012-01-31 Thread Truls Haaland
Given a table (SqLite) with an Id that is defined as a UNIQUEIDENTIFIER (stored 
as TEXT) I get the following results (firstId is a Guid matching the first 
entry):


This fails (returns zero rows):

  connection.SqLite.FirstOrDefault(s => s.Id == firstId )


This works (returns one row):

  connection.SqLite.FirstOrDefault(delegate(SqLite s) { return s.Id == firstId; 
});

There is one entry matching the Id in the table. I am using the latest version 
of system.data.sqlite (1.0.79.0), .NET 4, windows 7.

Does this have something with the first being C# 2 and the second C# 3?

Truls.

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] FirstOrDefault crashes using linq

2012-01-26 Thread Truls Haaland
--- Den ons 2012-01-25 skrev Joe Mistachkin :
> The supported alternative here is the ObjectContext class
> from the Entity Framework

Thank you. I will check this out.
I am not using the Entity Framework, so I will have to figure out how to create 
an ObjectContext manually. I guess I'm off Googling then.

What I am ultimately trying to do is replace MSSQL with SQLite in an existing 
application that uses LINQ. So I was hoping that I could do this with minimal 
changes to the application (otherwise I will probably not get the ok for this).

Again, thanks for helping.

Truls.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] FirstOrDefault crashes using linq

2012-01-25 Thread Truls Haaland
> Would it be possible to see the generated SQL statement (from inside
> the Prepare method) that is causing the exception?

I have tried unsuccessfully to create the debug version of System.Data.SQLite , 
so that is why I put the project on github. If anyone has the time to check out 
the project and debug then it would be greatly appreciated, otherwise a recipe 
for building a debug version and debugging a .net project would be great.

Truls.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] FirstOrDefault crashes using linq

2012-01-25 Thread Truls Haaland
I am trying out System.Data.SQLite.LINQ and I am getting crashes with 
FirstOrDefault().

I have created a table with the SQL:

CREATE TABLE Person(
  Id INTEGER PRIMARY KEY,
  Name TEXT NOT NULL,
  Age INTEGER NOT NULL
);

The C# class I am reading into is defined as:

  [TableAttribute(Name="Person")]
  public class Person
  {
    [ColumnAttribute(Name = "Id", DbType = "INT", IsPrimaryKey = true)]
    public int Id { get; set; }

    [ColumnAttribute(Name = "Name", DbType = "VARCHAR(MAX)", CanBeNull = false)]
    public string Name { get; set; }

    [ColumnAttribute(Name = "Age", DbType = "INT", CanBeNull = false)]
    public int Age { get; set; }
}

I know that the
 type of Name does not match the definition, but changing it to TEXT gives 
error on comparisons.

My project is at github: https://github.com/trulsu/SQLiteTest

I am using the latest official version (1.0.77.0) on Windows7 with .NET 4.0.

The full error message (including stack trace) is:

- BEGIN -
System.Data.SQLite.SQLiteException was unhandled
  Message=SQLite error
near ".": syntax error
  Source=System.Data.SQLite
  ErrorCode=-2147467259
  StackTrace:
  
 at System.Data.SQLite.SQLite3.Prepare(SQLiteConnection cnn, String 
strSql, SQLiteStatement previous, UInt32 timeoutMS, String& 
strRemain)
   at System.Data.SQLite.SQLiteCommand.BuildNextCommand()
   at System.Data.SQLite.SQLiteCommand.GetStatement(Int32 index)
   at
 System.Data.SQLite.SQLiteDataReader.NextResult()
   at System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, 
CommandBehavior behave)
   at System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior 
behavior)
   at System.Data.SQLite.SQLiteCommand.ExecuteDbDataReader(CommandBehavior 
behavior)
   at System.Data.Common.DbCommand.ExecuteReader()
  
 at System.Data.Linq.SqlClient.SqlProvider.Execute(Expression query, 
QueryInfo queryInfo, IObjectReaderFactory factory, Object[] parentArgs, 
Object[] userArgs, ICompiledSubQuery[] subQueries, Object lastResult)
  
 at System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(Expression query, 
QueryInfo[] queryInfos, IObjectReaderFactory factory, Object[] 
userArguments, ICompiledSubQuery[]
 subQueries)
   at 
System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression
 query)
   at 
System.Data.Linq.Table`1.System.Linq.IQueryProvider.Execute[TResult](Expression 
expression)
   at System.Linq.Queryable.FirstOrDefault[TSource](IQueryable`1 source, 
Expression`1 predicate)
  
 at SqLiteTest.Program.PersonTest(SqLiteDataContext connection) in 
C:\source\Prototypes\SqLiteTest\SqLiteTest\Program.cs:line 77
   at SqLiteTest.Program.Main() in 
C:\source\Prototypes\SqLiteTest\SqLiteTest\Program.cs:line 17
   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] 
args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence
 assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
  
 at System.Threading.ExecutionContext.Run(ExecutionContext 
executionContext, ContextCallback callback, Object state, Boolean 
ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext 
executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 
- END -

Any help would be greatly appreciated,

Truls.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] LINQ - FirstOrDefault() crashes

2012-01-25 Thread Truls Haaland
I am trying out System.Data.SQLite.LINQ and I am getting crashes with 
FirstOrDefault().

I have created a table with the SQL:

CREATE TABLE Person(
  Id INTEGER PRIMARY KEY,
  Name TEXT NOT NULL,
  Age INTEGER NOT NULL
);

The C# class I am reading into is defined as:

  [TableAttribute(Name="Person")]
  public class Person
  {
    [ColumnAttribute(Name = "Id", DbType = "INT", IsPrimaryKey = true)]
    public int Id { get; set; }

    [ColumnAttribute(Name = "Name", DbType = "VARCHAR(MAX)", CanBeNull = false)]
    public string Name { get; set; }

    [ColumnAttribute(Name = "Age", DbType = "INT", CanBeNull = false)]
    public int Age { get; set; }
}

I know that the type of Name does not match the definition, but changing it to 
TEXT gives error on comparisons.

My project is at github: https://github.com/trulsu/SQLiteTest

I am using the latest official version (1.0.77.0) on Windows7 with .NET 4.0.

The full error message (including stack trace) is:

- BEGIN -
System.Data.SQLite.SQLiteException was unhandled
  Message=SQLite error
near ".": syntax error
  Source=System.Data.SQLite
  ErrorCode=-2147467259
  StackTrace:
   at System.Data.SQLite.SQLite3.Prepare(SQLiteConnection cnn, String 
strSql, SQLiteStatement previous, UInt32 timeoutMS, String& strRemain)
   at System.Data.SQLite.SQLiteCommand.BuildNextCommand()
   at System.Data.SQLite.SQLiteCommand.GetStatement(Int32 index)
   at System.Data.SQLite.SQLiteDataReader.NextResult()
   at System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, 
CommandBehavior behave)
   at System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior 
behavior)
   at System.Data.SQLite.SQLiteCommand.ExecuteDbDataReader(CommandBehavior 
behavior)
   at System.Data.Common.DbCommand.ExecuteReader()
   at System.Data.Linq.SqlClient.SqlProvider.Execute(Expression query, 
QueryInfo queryInfo, IObjectReaderFactory factory, Object[] parentArgs, 
Object[] userArgs, ICompiledSubQuery[] subQueries, Object lastResult)
   at System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(Expression query, 
QueryInfo[] queryInfos, IObjectReaderFactory factory, Object[] userArguments, 
ICompiledSubQuery[] subQueries)
   at 
System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression
 query)
   at 
System.Data.Linq.Table`1.System.Linq.IQueryProvider.Execute[TResult](Expression 
expression)
   at System.Linq.Queryable.FirstOrDefault[TSource](IQueryable`1 source, 
Expression`1 predicate)
   at SqLiteTest.Program.PersonTest(SqLiteDataContext connection) in 
C:\source\Prototypes\SqLiteTest\SqLiteTest\Program.cs:line 77
   at SqLiteTest.Program.Main() in 
C:\source\Prototypes\SqLiteTest\SqLiteTest\Program.cs:line 17
   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] 
args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence 
assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext 
executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext 
executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 
- END -

Any help would be greatly appreciated,

Truls.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users