Dotnet C# support

classic Classic list List threaded Threaded
20 messages Options
Reply | Threaded
Open this post in threaded view
|

Dotnet C# support

Darren Lodge
Hi there,
 
Is there a version which will work for dotnot?
 
Darren Lodge
Software Engineer
CAP
 
0113 222 2058 (direct)
0113 222 2000 (switchboard)
0113 222 2001 (fax)
 
Reply | Threaded
Open this post in threaded view
|

Re: Dotnet C# support

Wilfried Mestdagh
Hi Darren,

> Is there a version which will work for dotnot?

If not then you can use every win32 dll in C# using P/Invoke

---
Rgds, Wilfried
http://www.mestdagh.biz

Reply | Threaded
Open this post in threaded view
|

Re: Dotnet C# support

Peter Berkenbosch
In reply to this post by Darren Lodge
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Sigh..

http://www.google.com/search?hl=nl&q=SQLite+C%23&btnG=Google+zoeken&meta=


Darren Lodge wrote:

> Hi there,
>  
> Is there a version which will work for dotnot?
>  
> Darren Lodge
> Software Engineer
> CAP
>  
> 0113 222 2058 (direct)
> 0113 222 2000 (switchboard)
> 0113 222 2001 (fax)
>  
>


- --
+-------------------------------+--------------------------+
: Peter Berkenbosch :   :
: : t: +31 (0) 64 84 61653   :
: PeRo ICT Solutions : f: +31 (0) 84 22 09880   :
: Koemaad 26 : m: [hidden email]     :
: 8431 TM Oosterwolde : w: www.pero-ict.nl       :
+-------------------------------+--------------------------+
: OpenPGP 0x0F655F0D (random.sks.keyserver.penguin.de)   :
+----------------------------------------------------------+





-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (MingW32)

iD8DBQFDYd7g9bwznA9lXw0RAnb4AJ9oRUkvbXX5aX0HhXZEl6Lv4KNPyACgiUrq
yXTEUWDFVPk97iM5u14V1B4=
=0ECQ
-----END PGP SIGNATURE-----
Reply | Threaded
Open this post in threaded view
|

RE: Dotnet C# support

Darren Lodge
In reply to this post by Darren Lodge
Thankyou!


Darren Lodge
Software Engineer
CAP
 
0113 222 2058 (direct)
0113 222 2000 (switchboard)
0113 222 2001 (fax)

-----Original Message-----
From: Peter Berkenbosch [mailto:[hidden email]]
Sent: 28 October 2005 09:19
To: [hidden email]
Subject: Re: [sqlite] Dotnet C# support

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Sigh..

http://www.google.com/search?hl=nl&q=SQLite+C%23&btnG=Google+zoeken&meta
=


Darren Lodge wrote:

> Hi there,
>  
> Is there a version which will work for dotnot?
>  
> Darren Lodge
> Software Engineer
> CAP
>  
> 0113 222 2058 (direct)
> 0113 222 2000 (switchboard)
> 0113 222 2001 (fax)
>  
>


- --
+-------------------------------+--------------------------+
: Peter Berkenbosch :   :
: : t: +31 (0) 64 84 61653   :
: PeRo ICT Solutions : f: +31 (0) 84 22 09880   :
: Koemaad 26 : m: [hidden email]     :
: 8431 TM Oosterwolde : w: www.pero-ict.nl       :
+-------------------------------+--------------------------+
: OpenPGP 0x0F655F0D (random.sks.keyserver.penguin.de)   :
+----------------------------------------------------------+





-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (MingW32)

iD8DBQFDYd7g9bwznA9lXw0RAnb4AJ9oRUkvbXX5aX0HhXZEl6Lv4KNPyACgiUrq
yXTEUWDFVPk97iM5u14V1B4=
=0ECQ
-----END PGP SIGNATURE-----


Reply | Threaded
Open this post in threaded view
|

Re: Dotnet C# support

Gregory Letellier
i'm trying tu use sqli3 with vb. net
he create the db but not the table..
what is the mistake ?

i've this code

Imports System.Runtime.InteropServices

Public Class Form1
       
        <StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Ansi)> _
    Public Structure sqlite_callback
        Public Void As Long
        Public I1 As Long
        Public s1 As String
        Public s2 As String
    End Structure
 
    Public Declare Function sqlite3_open Lib "sqlite3.dll" (ByVal
Filename As String, ByRef Handle As Long) As Long
    Public Declare Function sqlite3_exec Lib "sqlite3.dll" (ByVal Handle
As Long, ByVal Query As String, ByRef CallbackFunction As
sqlite_callback, ByRef CallBackArgs As Long, ByRef Erreur As String) As Long
    Public Declare Function sqlite3_close Lib "sqlite3.dll" (ByVal
Handle As Long) As Long
    Public Declare Function sqlite3_errmsg Lib "sqlite3.dll" (ByVal
Handle As Long) As String
       
        Public Sub Main()
 
        Dim lRet As Long
        Dim lHandle As Long
        Dim sErreur As String
        Dim sSQL As String
 
        lRet = sqlite3_open("c:\test.db", lHandle)

        sSQL = "CREATE Table Toto(titi varchar(15));"
        lRet = sqlite3_exec(lHandle, sSQL, Nothing, Nothing, sErreur)
   
        sqlite3_close(lHandle)
    End Sub
End Class



Darren Lodge a ?crit :

>Thankyou!
>
>
>Darren Lodge
>Software Engineer
>CAP
>
>0113 222 2058 (direct)
>0113 222 2000 (switchboard)
>0113 222 2001 (fax)
>
>-----Original Message-----
>From: Peter Berkenbosch [mailto:[hidden email]]
>Sent: 28 October 2005 09:19
>To: [hidden email]
>Subject: Re: [sqlite] Dotnet C# support
>
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>Sigh..
>
>http://www.google.com/search?hl=nl&q=SQLite+C%23&btnG=Google+zoeken&meta
>=
>
>
>Darren Lodge wrote:
>  
>
>>Hi there,
>>
>>Is there a version which will work for dotnot?
>>
>>Darren Lodge
>>Software Engineer
>>CAP
>>
>>0113 222 2058 (direct)
>>0113 222 2000 (switchboard)
>>0113 222 2001 (fax)
>>
>>
>>    
>>
>
>
>- --
>+-------------------------------+--------------------------+
>: Peter Berkenbosch :   :
>: : t: +31 (0) 64 84 61653   :
>: PeRo ICT Solutions : f: +31 (0) 84 22 09880   :
>: Koemaad 26 : m: [hidden email]     :
>: 8431 TM Oosterwolde : w: www.pero-ict.nl       :
>+-------------------------------+--------------------------+
>: OpenPGP 0x0F655F0D (random.sks.keyserver.penguin.de)   :
>+----------------------------------------------------------+
>
>
>
>
>
>-----BEGIN PGP SIGNATURE-----
>Version: GnuPG v1.2.1 (MingW32)
>
>iD8DBQFDYd7g9bwznA9lXw0RAnb4AJ9oRUkvbXX5aX0HhXZEl6Lv4KNPyACgiUrq
>yXTEUWDFVPk97iM5u14V1B4=
>=0ECQ
>-----END PGP SIGNATURE-----
>
>
>
>
>  
>
Reply | Threaded
Open this post in threaded view
|

Re: Dotnet C# support

Justin Greenwood
I've used the C# .net provider for SQLite quite a bit. You can use SQL3
with these providers, you just have to add something to the connection
string to tell the driver which version you're using and also the text
encoding (UTF8Encoding=true;Version=3;). To create a new database, you
just have to add the "New=True" key/value pair to the connection string.
Here are some links to get you started:

Microsoft.Net 1.x ADO.Net Provider
http://sourceforge.net/projects/adodotnetsqlite

Here's some sample code:
-------------------------------------------------------------------

SQLiteConnection Conn = new SQLiteConnection();
Conn.ConnectionString = "Data
Source=diary.db;New=True;Compress=True;Synchronous=Off";
Conn.Open();

SQLiteCommand Cmd = new SQLiteCommand();
Cmd = Conn.CreateCommand();
Cmd.CommandText = "CREATE TABLE GOALS(GOALS_ID integer primary key ,
CATEGORY varchar (50), PRIORITY integer , SUBJECT varchar (150) ,
DESCRIPTION varchar (500),START_DATE datetime , COMPLETION_DATE datetime)" ;
Cmd.ExecuteNonQuery();

Cmd.CommandText="CREATE TABLE NOTES (NOTES_ID integer primary key
,NOTES_DATE datetime ,NOTES_TEXT varchar (8000) )";
Cmd.ExecuteNonQuery();

Cmd.CommandText =" CREATE TABLE REMINDERS (REMINDER_ID integer primary
key ,REMINDER_DATE smalldatetime ,SUBJECT varchar (150) ,DESCRIPTION
varchar (500) , ALARM1_DATE datetime ,ALARM2_DATE datetime ,ALARM3_DATE
datetime ,EMAIL_ALARM bit )";
Cmd.ExecuteNonQuery();

Cmd.CommandText ="CREATE TABLE TODO ( TODO_ID integer primary
key,CATEGORY varchar (20),PRIORITY int, PERCENT_COMPLETE float,
START_DATE datetime ,END_DATE datetime , SUBJECT varchar (150) , DETAILS
varchar (8000) ";
Cmd.ExecuteNonQuery();

Cmd.CommandText ="CREATE TABLE CATEGORIES (CATEGORY_ID INTEGER PRIMARY
KEY,CATEGORY_NAME varchar (25))";
Cmd.ExecuteNonQuery();

Cmd.Dispose();
Conn.Close();
-------------------------------------------------------------------------

There is also a new .net 2.0 provider:

Microsoft.Net 2.0 ADO.Net Provider
http://sourceforge.net/projects/sqlite-dotnet2



Gregory Letellier wrote:

> i'm trying tu use sqli3 with vb. net
> he create the db but not the table..
> what is the mistake ?
>
> i've this code
>
> Imports System.Runtime.InteropServices
>
> Public Class Form1
>              <StructLayout(LayoutKind.Sequential,
> CharSet:=CharSet.Ansi)> _
>    Public Structure sqlite_callback
>        Public Void As Long
>        Public I1 As Long
>        Public s1 As String
>        Public s2 As String
>    End Structure
>
>    Public Declare Function sqlite3_open Lib "sqlite3.dll" (ByVal
> Filename As String, ByRef Handle As Long) As Long
>    Public Declare Function sqlite3_exec Lib "sqlite3.dll" (ByVal
> Handle As Long, ByVal Query As String, ByRef CallbackFunction As
> sqlite_callback, ByRef CallBackArgs As Long, ByRef Erreur As String)
> As Long
>    Public Declare Function sqlite3_close Lib "sqlite3.dll" (ByVal
> Handle As Long) As Long
>    Public Declare Function sqlite3_errmsg Lib "sqlite3.dll" (ByVal
> Handle As Long) As String
>              Public Sub Main()
>
>        Dim lRet As Long
>        Dim lHandle As Long
>        Dim sErreur As String
>        Dim sSQL As String
>
>        lRet = sqlite3_open("c:\test.db", lHandle)
>
>        sSQL = "CREATE Table Toto(titi varchar(15));"
>        lRet = sqlite3_exec(lHandle, sSQL, Nothing, Nothing, sErreur)
>           sqlite3_close(lHandle)
>    End Sub
> End Class
>
>
>
> Darren Lodge a ?crit :
>
>> Thankyou!
>>
>> Darren Lodge
>> Software Engineer
>> CAP
>>
>> 0113 222 2058 (direct)
>> 0113 222 2000 (switchboard)
>> 0113 222 2001 (fax)
>>
>> -----Original Message-----
>> From: Peter Berkenbosch [mailto:[hidden email]] Sent: 28 October
>> 2005 09:19
>> To: [hidden email]
>> Subject: Re: [sqlite] Dotnet C# support
>>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Sigh..
>>
>> http://www.google.com/search?hl=nl&q=SQLite+C%23&btnG=Google+zoeken&meta
>> =
>>
>>
>> Darren Lodge wrote:
>>  
>>
>>> Hi there,
>>>
>>> Is there a version which will work for dotnot?
>>>
>>> Darren Lodge
>>> Software Engineer
>>> CAP
>>>
>>> 0113 222 2058 (direct)
>>> 0113 222 2000 (switchboard)
>>> 0113 222 2001 (fax)
>>>
>>>
>>>  
>>
>>
>>
>> - --
>> +-------------------------------+--------------------------+
>> : Peter Berkenbosch        :               :
>> :                : t: +31 (0) 64 84 61653   :
>> : PeRo ICT Solutions        : f: +31 (0) 84 22 09880   :
>> : Koemaad 26            : m: [hidden email]     :
>> : 8431 TM Oosterwolde        : w: www.pero-ict.nl       :
>> +-------------------------------+--------------------------+
>> : OpenPGP 0x0F655F0D (random.sks.keyserver.penguin.de)       :
>> +----------------------------------------------------------+
>>
>>
>>
>>
>>
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1.2.1 (MingW32)
>>
>> iD8DBQFDYd7g9bwznA9lXw0RAnb4AJ9oRUkvbXX5aX0HhXZEl6Lv4KNPyACgiUrq
>> yXTEUWDFVPk97iM5u14V1B4=
>> =0ECQ
>> -----END PGP SIGNATURE-----
>>
>>
>>
>>
>>  
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: Dotnet C# support

Clay Dowling
In reply to this post by Darren Lodge

Darren Lodge said:
> Hi there,
>
> Is there a version which will work for dotnot?

I've had good luck with some of the ADO.NET providers.  They work pretty
much like other ADO.NET providers.  It's been a year or more so I can't
say exactly how long ago it was, but I was reasonably happy with the
result.  Fair warning though that I'm not exactly a .NET power user, so
what was acceptable to me may be a steaming pile to you.

Clay Dowling
--
Simple Content Management
http://www.ceamus.com

Reply | Threaded
Open this post in threaded view
|

RE: Dotnet C# support

jreidthompson
In reply to this post by Darren Lodge
----Original Message----
From: Darren Lodge [mailto:[hidden email]]
Sent: Friday, October 28, 2005 4:01 AM
To: [hidden email]
Subject: [sqlite] Dotnet C# support

> Hi there,
>
> Is there a version which will work for dotnot?
>
> Darren Lodge
> Software Engineer
> CAP
>
> 0113 222 2058 (direct)
> 0113 222 2000 (switchboard)
> 0113 222 2001 (fax)

http://sourceforge.net/projects/adodotnetsqlite

http://www.phpguru.org/static/SQLite.NET.html

reid
Reply | Threaded
Open this post in threaded view
|

RE: Dotnet C# support

jreidthompson
In reply to this post by Darren Lodge
----Original Message----
From: Darren Lodge [mailto:[hidden email]]
Sent: Friday, October 28, 2005 4:01 AM
To: [hidden email]
Subject: [sqlite] Dotnet C# support

> Hi there,
>
> Is there a version which will work for dotnot?
>
> Darren Lodge
> Software Engineer
> CAP
>
> 0113 222 2058 (direct)
> 0113 222 2000 (switchboard)
> 0113 222 2001 (fax)

http://docs.codehaus.org/display/BOO/SQLite+Database

reid
Reply | Threaded
Open this post in threaded view
|

Re: Dotnet C# support

Robert Simpson
In reply to this post by Darren Lodge
----- Original Message -----
From: "Darren Lodge" <[hidden email]>

>Hi there,
>
>Is there a version which will work for dotnot?
>

The WIKI page is the best place to look ... There are probably half a dozen
providers for SQLite.  Two ADO.NET providers (for ADO.NET 1.1 and ADO.NET
2.0) and several non-ADO.NET providers designed to be more streamlined.

Robert


Reply | Threaded
Open this post in threaded view
|

Re: Dotnet C# support

Robert Simpson
In reply to this post by Gregory Letellier
----- Original Message -----
From: "Gregory Letellier" <[hidden email]>


> i'm trying tu use sqli3 with vb. net
> he create the db but not the table..
> what is the mistake ?
>
> i've this code
>
> Imports System.Runtime.InteropServices
>
> Public Class Form1
>
>        <StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Ansi)> _
>    Public Structure sqlite_callback
>        Public Void As Long
>        Public I1 As Long
>        Public s1 As String
>        Public s2 As String
>    End Structure
>
>    Public Declare Function sqlite3_open Lib "sqlite3.dll" (ByVal
> Filename As String, ByRef Handle As Long) As Long
>    Public Declare Function sqlite3_exec Lib "sqlite3.dll" (ByVal Handle
> As Long, ByVal Query As String, ByRef CallbackFunction As
> sqlite_callback, ByRef CallBackArgs As Long, ByRef Erreur As String) As
> Long
>    Public Declare Function sqlite3_close Lib "sqlite3.dll" (ByVal
> Handle As Long) As Long
>    Public Declare Function sqlite3_errmsg Lib "sqlite3.dll" (ByVal
> Handle As Long) As String
>
>        Public Sub Main()
>
>        Dim lRet As Long
>        Dim lHandle As Long
>        Dim sErreur As String
>        Dim sSQL As String
>
>        lRet = sqlite3_open("c:\test.db", lHandle)
>
>        sSQL = "CREATE Table Toto(titi varchar(15));"
>        lRet = sqlite3_exec(lHandle, sSQL, Nothing, Nothing, sErreur)
>
>        sqlite3_close(lHandle)
>    End Sub
> End Class
>

Lots of problems here ... My VB is rusty, but here goes:

1.  Don't bother declaring the callback struct -- you cannot do any form of
callbacks in .NET with SQLite without major hacking.  SQLite's callbacks are
expected to be "cdecl" and .NET callbacks are always "stdcall" and you will
get stack errors if you even attempt it.  The ADO.NET 2.0 provider for
SQLite does it, but I had to go through hoops.

2.  sqlite3_exec is declared incorrectly.  The errormessage is a char **,
which is a pointer to a pointer.  Getting this out of sqlite into .NET is
not straightforward.  You'll have to use ByRef IntPtr and use the Marshal
class to convert it to a string.

3.  sqlite3_open and sqlite3_exec are both sortof declared and processed
incorrectly.  Those functions expect UTF-8 encoded strings, and you are
passing "string" to them which .NET will at best translate to MBCS ANSI
strings -- which means no international support.  For added safety you
should declare those API functions with the CharSet=ANSI attribute to make
absolutely sure .NET gives sqlite ANSI strings instead of UNICODE strings.
It's still wrong, but its close enough for English-only.

4.  All sqlite API functions are declared as cdecl, and without instructions
to the contrary, .NET will try and call them as stdcall which means after
every call .NET will have to perform stack fixups.  It won't error out your
program per-se, but it will be a performance hit.  There's an attribute you
can use to change the calling conventions of the API declaration, but I
can't remember it off the top of my head.

Robert


Reply | Threaded
Open this post in threaded view
|

Re: Dotnet C# support

Gregory Letellier
thx for your response !!


Robert Simpson a ?crit :

> ----- Original Message ----- From: "Gregory Letellier"
> <[hidden email]>
>
>
>> i'm trying tu use sqli3 with vb. net
>> he create the db but not the table..
>> what is the mistake ?
>>
>> i've this code
>>
>> Imports System.Runtime.InteropServices
>>
>> Public Class Form1
>>
>>        <StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Ansi)> _
>>    Public Structure sqlite_callback
>>        Public Void As Long
>>        Public I1 As Long
>>        Public s1 As String
>>        Public s2 As String
>>    End Structure
>>
>>    Public Declare Function sqlite3_open Lib "sqlite3.dll" (ByVal
>> Filename As String, ByRef Handle As Long) As Long
>>    Public Declare Function sqlite3_exec Lib "sqlite3.dll" (ByVal Handle
>> As Long, ByVal Query As String, ByRef CallbackFunction As
>> sqlite_callback, ByRef CallBackArgs As Long, ByRef Erreur As String)
>> As Long
>>    Public Declare Function sqlite3_close Lib "sqlite3.dll" (ByVal
>> Handle As Long) As Long
>>    Public Declare Function sqlite3_errmsg Lib "sqlite3.dll" (ByVal
>> Handle As Long) As String
>>
>>        Public Sub Main()
>>
>>        Dim lRet As Long
>>        Dim lHandle As Long
>>        Dim sErreur As String
>>        Dim sSQL As String
>>
>>        lRet = sqlite3_open("c:\test.db", lHandle)
>>
>>        sSQL = "CREATE Table Toto(titi varchar(15));"
>>        lRet = sqlite3_exec(lHandle, sSQL, Nothing, Nothing, sErreur)
>>
>>        sqlite3_close(lHandle)
>>    End Sub
>> End Class
>>
>
> Lots of problems here ... My VB is rusty, but here goes:
>
> 1.  Don't bother declaring the callback struct -- you cannot do any
> form of callbacks in .NET with SQLite without major hacking.  SQLite's
> callbacks are expected to be "cdecl" and .NET callbacks are always
> "stdcall" and you will get stack errors if you even attempt it.  The
> ADO.NET 2.0 provider for SQLite does it, but I had to go through hoops.
>
> 2.  sqlite3_exec is declared incorrectly.  The errormessage is a char
> **, which is a pointer to a pointer.  Getting this out of sqlite into
> .NET is not straightforward.  You'll have to use ByRef IntPtr and use
> the Marshal class to convert it to a string.
>
> 3.  sqlite3_open and sqlite3_exec are both sortof declared and
> processed incorrectly.  Those functions expect UTF-8 encoded strings,
> and you are passing "string" to them which .NET will at best translate
> to MBCS ANSI strings -- which means no international support.  For
> added safety you should declare those API functions with the
> CharSet=ANSI attribute to make absolutely sure .NET gives sqlite ANSI
> strings instead of UNICODE strings. It's still wrong, but its close
> enough for English-only.
>
> 4.  All sqlite API functions are declared as cdecl, and without
> instructions to the contrary, .NET will try and call them as stdcall
> which means after every call .NET will have to perform stack fixups.  
> It won't error out your program per-se, but it will be a performance
> hit.  There's an attribute you can use to change the calling
> conventions of the API declaration, but I can't remember it off the
> top of my head.
>
> Robert
>
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Dotnet C# support

Edward Wilson
In reply to this post by Wilfried Mestdagh
I think you are looking for this http://adodotnetsqlite.sourceforge.net/

I wrote my own driver in C++ (boy, that was a lot of work) then discovered the above.

-
ed

--- Wilfried Mestdagh <[hidden email]> wrote:

> Hi Darren,
>
> > Is there a version which will work for dotnot?
>
> If not then you can use every win32 dll in C# using P/Invoke
>
> ---
> Rgds, Wilfried
> http://www.mestdagh.biz
>
>



       
               
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com
Reply | Threaded
Open this post in threaded view
|

Re: Dotnet C# support

BertV
I agree, never use PInvoke, if possible to avoid
There is a performqncepenalty, and maybe you loose platform-independency
(think of Mono)

Bert

> I think you are looking for this http://adodotnetsqlite.sourceforge.net/
>
> I wrote my own driver in C++ (boy, that was a lot of work) then discovered
> the above.
>
> -
> ed
>
> --- Wilfried Mestdagh <[hidden email]> wrote:
>
>> Hi Darren,
>>
>> > Is there a version which will work for dotnot?
>>
>> If not then you can use every win32 dll in C# using P/Invoke
>>
>> ---
>> Rgds, Wilfried
>> http://www.mestdagh.biz
>>
>>
>
>
>
>
>
> __________________________________
> Yahoo! Mail - PC Magazine Editors' Choice 2005
> http://mail.yahoo.com
>


Reply | Threaded
Open this post in threaded view
|

Re: Dotnet C# support

Arjen Markus
In reply to this post by Robert Simpson
Robert Simpson wrote:
>

>
> Lots of problems here ... My VB is rusty, but here goes:
>
> 1.  Don't bother declaring the callback struct -- you cannot do any form of
> callbacks in .NET with SQLite without major hacking.  SQLite's callbacks are
> expected to be "cdecl" and .NET callbacks are always "stdcall" and you will
> get stack errors if you even attempt it.  The ADO.NET 2.0 provider for
> SQLite does it, but I had to go through hoops.
>

Hm, this mismatch in calling convention could be solved by one or two
little wrapper
functions, couldn't it? I am not very familiar with .NET, so I could be
all wrong.

Regards,

Arjen

Reply | Threaded
Open this post in threaded view
|

Re: Dotnet C# support

Robert Simpson
That's exactly what I ended up doing in the ADO.NET 2.0 wrapper.  In order
to implement full Compact Framework support and callbacks, I ended up
writing stdcall entrypoints and callback wrappers for just about the entire
SQLite API.

Robert


----- Original Message -----
From: "Arjen Markus" <[hidden email]>
To: <[hidden email]>
Sent: Monday, October 31, 2005 12:28 AM
Subject: Re: [sqlite] Dotnet C# support


> Robert Simpson wrote:
>>
>
>>
>> Lots of problems here ... My VB is rusty, but here goes:
>>
>> 1.  Don't bother declaring the callback struct -- you cannot do any form
>> of
>> callbacks in .NET with SQLite without major hacking.  SQLite's callbacks
>> are
>> expected to be "cdecl" and .NET callbacks are always "stdcall" and you
>> will
>> get stack errors if you even attempt it.  The ADO.NET 2.0 provider for
>> SQLite does it, but I had to go through hoops.
>>
>
> Hm, this mismatch in calling convention could be solved by one or two
> little wrapper
> functions, couldn't it? I am not very familiar with .NET, so I could be
> all wrong.
>
> Regards,
>
> Arjen
>


Reply | Threaded
Open this post in threaded view
|

Re: Dotnet C# support

Arjen Markus
Robert Simpson wrote:
>
> That's exactly what I ended up doing in the ADO.NET 2.0 wrapper.  In order
> to implement full Compact Framework support and callbacks, I ended up
> writing stdcall entrypoints and callback wrappers for just about the entire
> SQLite API.
>

My Fortran interface does something similar, I have done it that way to
hide
the gory (and platform-dependent) details of passing parameters of the
correct
type to the SQLite C functions. On Windows I compile SQLite as a DLL -
that
takes care of the stdcall/cdecl issue.

Regards,

Arjen

Reply | Threaded
Open this post in threaded view
|

Handling dates and timestamps via the C API

Arjen Markus
In reply to this post by Robert Simpson
Hello,

I would like to know how I should handle dates and timestamps
via the C API. I know that if I write an SQL insert statement, I have
to use one of the forms reserved for dates and timestamps and
the like, but how do I do this via the sqlite3_bind_* procedures?

Regards,

Arjen

Reply | Threaded
Open this post in threaded view
|

Re: Handling dates and timestamps via the C API

Jay Sprenkle
> I would like to know how I should handle dates and timestamps
> via the C API. I know that if I write an SQL insert statement, I have
> to use one of the forms reserved for dates and timestamps and
> the like, but how do I do this via the sqlite3_bind_* procedures?

I treat dates as a text field and have a C++ class that deals with all
the abstractions
of a date.
Reply | Threaded
Open this post in threaded view
|

Re: Handling dates and timestamps via the C API

John Stanton-3
We use a TEXT field for dates and time and make it strictly ISO8601 and
hence portable between storage methods.

Jay Sprenkle wrote:
>>I would like to know how I should handle dates and timestamps
>>via the C API. I know that if I write an SQL insert statement, I have
>>to use one of the forms reserved for dates and timestamps and
>>the like, but how do I do this via the sqlite3_bind_* procedures?
>
>
> I treat dates as a text field and have a C++ class that deals with all
> the abstractions
> of a date.