RE: [sqlite] reseting primary key

2007-05-07 Thread Jonathan Kahn
Thank you both for your responses; Very informative.  It is much
appreciated.

Regards,
- Jon

-Original Message-
From: C.Peachment [mailto:[EMAIL PROTECTED] 
Sent: Monday, May 07, 2007 12:07 PM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] reseting primary key

On Mon, 7 May 2007 11:28:57 -0400, Jonathan Kahn wrote:

>Hey all,

> I have tried different things such as reindex and vacuum on my primary key
>auto inc field but I cannot reset it so that things start from one.  I
>deleted everything from my table but it still keeps the amount that was
>there beforehand on the auto inc so anything new is appened to that number
>so I used to have 7 records when I insert new it starts at 8, how can I
>start it back from 1, its beginning to drive me a little crazy.

You could try altering values in the sqlite_sequence table in your database.
It works for me. Remember to delete all records in the data table to avoid
problems with the auto increment column(s).

Chris Peachment





-
To unsubscribe, send email to [EMAIL PROTECTED]

-


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



[sqlite] reseting primary key

2007-05-07 Thread Jonathan Kahn
Hey all,

 I have tried different things such as reindex and vacuum on my primary key
auto inc field but I cannot reset it so that things start from one.  I
deleted everything from my table but it still keeps the amount that was
there beforehand on the auto inc so anything new is appened to that number
so I used to have 7 records when I insert new it starts at 8, how can I
start it back from 1, its beginning to drive me a little crazy.

 

Thanks a lot

- Jon



RE: [sqlite] Re: best performance

2007-05-03 Thread Jonathan Kahn
Thanks a lot to you both!

- Jon

-Original Message-
From: Igor Tandetnik [mailto:[EMAIL PROTECTED] 
Sent: Thursday, May 03, 2007 8:57 AM
To: SQLite
Subject: [sqlite] Re: best performance

Jonathan Kahn <[EMAIL PROTECTED]>
wrote:
> In my application I currently perform a loop inside a recursive
> function and sqlite3_bind_* on various fields then call sqlite3_step
> and a reset inside my loop but it is fairly slow when inserting, is
> there a faster way of inserting inside a loop?

Make all your inserts within a single transaction (issue BEGIN statement 
before the loop and COMMIT after).

Igor Tandetnik 



-
To unsubscribe, send email to [EMAIL PROTECTED]

-


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



[sqlite] best performance

2007-05-03 Thread Jonathan Kahn
In my application I currently perform a loop inside a recursive function and
sqlite3_bind_* on various fields then call sqlite3_step and a reset inside
my loop but it is fairly slow when inserting, is there a faster way of
inserting inside a loop?

 

Ie) while(whatever > 0) {

sqlite3_bind_int(stmt,1,iSomething);

sqlite3_bind..

if(sqlite3_step(stmt) == SQLITE_DONE) sqlite3_reset(stmt);

 

} /// basically something along these lines but with more error checking
and things.. 

 

 Am I able to perform a transaction where I execute a query with a
begin..insert..end and commit?  Would that even be faster? 

 

I just want to make sure I am doing things as fast and efficiently as
possible.

 

Thanks a lot

- Jon



RE: [sqlite] Re: Re: stmt question

2007-05-02 Thread Jonathan Kahn
Thanks a lot

-Original Message-
From: Igor Tandetnik [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 02, 2007 6:00 PM
To: SQLite
Subject: [sqlite] Re: Re: stmt question

Jonathan Kahn <[EMAIL PROTECTED]>
wrote:
> Ahh thanks a lot for clearing that up I wasn't sure if reset cleared
> my
> actual prepare statement or just the parameters.

It doesn't even clear the parameters. The old values are preserved. You 
can rebind some or all of them.

> So technically at
> the end
> of my loop I can call reset and rebind?

Yes.

Igor Tandetnik 



-
To unsubscribe, send email to [EMAIL PROTECTED]

-


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



RE: [sqlite] Re: stmt question

2007-05-02 Thread Jonathan Kahn
Ahh thanks a lot for clearing that up I wasn't sure if reset cleared my
actual prepare statement or just the parameters.  So technically at the end
of my loop I can call reset and rebind?

Thanks a lot,
- Jon

-Original Message-
From: Igor Tandetnik [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 02, 2007 5:48 PM
To: SQLite
Subject: [sqlite] Re: stmt question

Jonathan Kahn <[EMAIL PROTECTED]>
wrote:
>  If I prepare a statement can I bind variables as my value and then
> set the variables in a loop and execute?  Or in my loop would I bind
> my values and step so each bind gets executed until it equals
> SQLITE_DONE then reset?  I guess I am just unclear on how to execute
> my prepared statement and set my values in a loop.

You have to bind all parameters after sqlite3_prepare or sqlite3_reset 
calls, and before making the first sqlite3_step call. Once you call 
step, you can't change parameters until you call reset. Usually you 
would call step in a loop until it retuns SQLITE_DONE, but it's not 
mandatory (you can stop early). Once you are done processing the 
results, call sqlite_reset to make the statement ready for new 
execution, or call sqlite3_finalize to destroy the statement.

Igor Tandetnik 



-
To unsubscribe, send email to [EMAIL PROTECTED]

-


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



[sqlite] stmt question

2007-05-02 Thread Jonathan Kahn
Hi,

  I have a couple questions about using prepared statements with sqlite.

 

  If I prepare a statement can I bind variables as my value and then set the
variables in a loop and execute?  Or in my loop would I bind my values and
step so each bind gets executed until it equals SQLITE_DONE then reset?  I
guess I am just unclear on how to execute my prepared statement and set my
values in a loop.

 

Is there a better way to do what I want?  Am I completely off base?

 

Any info is much appreciated.  This is my first time working with the
sqlite3 api and sqlite so please forgive any ignorance.

 

Thanks a lot,

- Jon



RE: [sqlite] Need Help with SQL Statement

2007-04-30 Thread Jonathan Kahn
Use LIMIT 4

Thanks
- Jon

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 30, 2007 6:10 PM
To: sqlite-users@sqlite.org
Subject: [sqlite] Need Help with SQL Statement

  I have a file with the columns: StockSymbol, OptionSymbol, StockPrice, 
StrikePrice, ExpiryDate

For each StockSymbol, ExpiryDate, I would like to list just 4 of the 
records where the StrikePrice is lower than the StockPrice.

The following is close to what I want except it gives me all the rows 
where the StrikePrice is less than StockPrice but I only want 4 rows (2 
PUTs & 2 CALLs) for each Stock and associated ExpiryDate.

SELECT StockSymbol,
OptionSymbol,
ExpiryDate,
StrikePrice,
StockPrice
FROM Options
WHERE nStrikePrice < StockPrice
ORDER BY StockSymbol,sExpiryDate, nStrikePrice DESC;

I would appreciate any suggestions on how I can generate an appropriate 
SQL statement.

Thanks,
  Roger


-
To unsubscribe, send email to [EMAIL PROTECTED]

-


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



RE: [sqlite] sqlite and borland c++ builder

2007-04-30 Thread Jonathan Kahn
Thanks for the response, people have generously sent me file that work and
I'm up and running!  

Thanks
- Jon

-Original Message-
From: Dennis Cote [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 30, 2007 10:31 AM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] sqlite and borland c++ builder

Jonathan Kahn wrote:
>  
>
>   When I try to use the header I get errors
>
>  [C++ Error] sqlite3.h(1778): E2232 Constant member
> 'sqlite3_index_info::nConstraint' in class without constructors
>
>  
>
>   
Jonathan,

This is indeed a bug in the Borland/CodeGear compiler. It has been 
discussed on their mailing lists several times and is currently in their 
bug tracking system http://qc.codegear.com/wc/qcmain.aspx?d=32959.

I just posted a message when I ran into the same problem trying to use a 
current version of sqlite see  
http://groups.google.ca/group/borland.public.cppbuilder.language.cpp/browse_
frm/thread/f04139e048a2f55/98b6a1c5616057b4?lnk=st=sqlite+E2232+=1#98
b6a1c5616057b4
I forgot that I had ran into this problem earlier. It hasn't been a huge 
issue for me since most of my sqlite use is done with an older version 
of sqlite (3.2.7) that doesn't trigger this problem.

You can work around the problem by creating a modified sqlite3.h header 
that eliminates the const qualifiers from the offending declarations. 
You could also comment out the entire structure definition and change 
the type of the second argument to xBestIndex to a void pointer if you 
are not going to use the virtual table interfaces. or you could use an 
older version from before June of 2006 when these items were added to 
the header file.

I have had no problems building either a dll or a static library using 
the Borland compiler in C mode. The problems occur when you try to 
include the standard sqlite3.h header into a C++ source file.

It might help to post to the newsgroups saying you are also having 
problems, or to vote on the bug in the QC system.

HTH
Dennis Cote




-
To unsubscribe, send email to [EMAIL PROTECTED]

-


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



RE: AW: [sqlite] sqlite and borland c++ builder

2007-04-29 Thread Jonathan Kahn
The attachment someone sent me seemed to do the trick in terms of fixing
compilation errors, some of these other errors I am getting are kind of
unexplainable I think but unrelated to sqlite I think.  Maybe things are
conflicting, I'm not sure though but in terms of any sqlite compilation
issues the files I was sent seemed to clear that up. Now I think it is
strictly c++ builder giving me aggravation for whatever reason.

Thanks
- Jon 

-Original Message-
From: John Stanton [mailto:[EMAIL PROTECTED] 
Sent: Sunday, April 29, 2007 12:50 PM
To: sqlite-users@sqlite.org
Subject: Re: AW: [sqlite] sqlite and borland c++ builder

If that is his only problem all he has to do is some basic definitions 
for his compiler specifyng the Sqlite3 API components he is using.

Michael Ruck wrote:
> If I understand him correctly, he's having issues including the original
> sqlite3.h in his own sources too... He tried to build sqlite again to
solve
> that problem, but it remains there too.
> 
> I would recommed patching up sqlite3.h to conform to BC++ requirements -
> changing those structs to something the compiler understands.
> 
> Mike 
> 
> -Ursprüngliche Nachricht-
> Von: John Stanton [mailto:[EMAIL PROTECTED] 
> Gesendet: Sonntag, 29. April 2007 18:31
> An: sqlite-users@sqlite.org
> Betreff: Re: [sqlite] sqlite and borland c++ builder
> 
> Why not use gcc to compile your library, or use a precompiled DLL?
> 
> Jonathan Kahn wrote:
> 
>>Hi Ulrik,
>>  Thank you for responding.  I'll try anything!  The frustration that all
>>this has brought me I am determined to solve it.  
>>
>>  If I built SQLite with a C compiler what would be the result?  What
> 
> would
> 
>>I be able to work with from within c++?  Won't compiling leave me with an
>>executable?  I am fairly new to dealing with different compilers and
> 
> things,
> 
>>so please forgive my ignorance. 
>>
>>Thanks a lot,
>>- Jon
>>
>>
>>-Original Message-
>>From: Ulrik Petersen [mailto:[EMAIL PROTECTED] 
>>Sent: Sunday, April 29, 2007 2:29 AM
>>To: sqlite-users@sqlite.org
>>Subject: Re: [sqlite] sqlite and borland c++ builder
>>
>>Hi Jon,
>>
>>is it not an option to build SQLite with a C compiler, then call it from 
>>within C++?
>>
>>
>>Regards,
>>
>>Ulrik Petersen
>>
>>
>>Jonathan Kahn wrote:
>>
>>
>>>Even when I try to build a new dll I get errors with attach.c and it says
>>>cannot convert 'void *' to 'Db *', no matter what route I take I always
>>
>>hit
>>
>>
>>>a bump.  I'm just trying anything at this point
>>>
>>>- Jon
>>>
>>>-Original Message-
>>>From: Joe Wilson [mailto:[EMAIL PROTECTED] 
>>>Sent: Sunday, April 29, 2007 1:59 AM
>>>To: sqlite-users@sqlite.org
>>>Subject: Re: [sqlite] sqlite and borland c++ builder 
>>>
>>>I wrote too quickly - sqlite3.h correctly uses __cplusplus for extern
"C".
>>>
>>>But the almalgomated sqlite3.c cannot be compiled from a C++ compiler
>>>for the reasons described below.
>>>
>>>--- Joe Wilson <[EMAIL PROTECTED]> wrote:
>>> 
>>>
>>>
>>>>> When I try to use the header I get errors
>>>>>
>>>>>[C++ Error] sqlite3.h(1778): E2232 Constant member
>>>>>'sqlite3_index_info::nConstraint' in class without constructors
>>>>> 
>>>>
>>>>It appears it is trying to compile the sqlite header file as if it were
>>>>   
>>>
>>>C++.
>>> 
>>>
>>>
>>>>Lemme guess - you're using the almalgomated sqlite3.c from 3.3.17,
right?
>>>>
>>>
>>>>from the generated sqlite3.c:
>>>
>>>>/*
>>>>** Make sure we can call this stuff from C++.
>>>>*/
>>>>#if 0
>>>>extern "C" {
>>>>#endif
>>>>
>>>>See the #if 0? That's the problem. It should be:
>>>>
>>>>#if __cplusplus
>>>>
>>>>SQLite 3.3.17 has a bug in sqlite3.c generation.
>>>>To work around this issue, do this:
>>>>
>>>>extern "C" {
>>>>#include "sqlite3.h"
>>>>}
>>>>
>>>>
>>>>__
>>>&g

RE: [sqlite] sqlite and borland c++ builder

2007-04-29 Thread Jonathan Kahn
Hi John,
Thank's for responding.  Someone actually very generously emailed me an
attachment a bit earlier that seemed to work, now I am having other problems
which I think are unrelated.  To be honest I am beginning to think it is
this version of c++ builder that is just extremely buggy.

Thanks,

- Jon

-Original Message-
From: John Stanton [mailto:[EMAIL PROTECTED] 
Sent: Sunday, April 29, 2007 12:31 PM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] sqlite and borland c++ builder

Why not use gcc to compile your library, or use a precompiled DLL?

Jonathan Kahn wrote:
> Hi Ulrik,
>   Thank you for responding.  I'll try anything!  The frustration that all
> this has brought me I am determined to solve it.  
> 
>   If I built SQLite with a C compiler what would be the result?  What
would
> I be able to work with from within c++?  Won't compiling leave me with an
> executable?  I am fairly new to dealing with different compilers and
things,
> so please forgive my ignorance. 
> 
> Thanks a lot,
> - Jon
> 
> 
> -Original Message-
> From: Ulrik Petersen [mailto:[EMAIL PROTECTED] 
> Sent: Sunday, April 29, 2007 2:29 AM
> To: sqlite-users@sqlite.org
> Subject: Re: [sqlite] sqlite and borland c++ builder
> 
> Hi Jon,
> 
> is it not an option to build SQLite with a C compiler, then call it from 
> within C++?
> 
> 
> Regards,
> 
> Ulrik Petersen
> 
> 
> Jonathan Kahn wrote:
> 
>>Even when I try to build a new dll I get errors with attach.c and it says
>>cannot convert 'void *' to 'Db *', no matter what route I take I always
> 
> hit
> 
>>a bump.  I'm just trying anything at this point
>>
>>- Jon
>>
>>-Original Message-
>>From: Joe Wilson [mailto:[EMAIL PROTECTED] 
>>Sent: Sunday, April 29, 2007 1:59 AM
>>To: sqlite-users@sqlite.org
>>Subject: Re: [sqlite] sqlite and borland c++ builder 
>>
>>I wrote too quickly - sqlite3.h correctly uses __cplusplus for extern "C".
>>
>>But the almalgomated sqlite3.c cannot be compiled from a C++ compiler
>>for the reasons described below.
>>
>>--- Joe Wilson <[EMAIL PROTECTED]> wrote:
>>  
>>
>>>>  When I try to use the header I get errors
>>>>
>>>> [C++ Error] sqlite3.h(1778): E2232 Constant member
>>>>'sqlite3_index_info::nConstraint' in class without constructors
>>>>  
>>>
>>>It appears it is trying to compile the sqlite header file as if it were
>>>
>>
>>C++.
>>  
>>
>>>Lemme guess - you're using the almalgomated sqlite3.c from 3.3.17, right?
>>>
>>>from the generated sqlite3.c:
>>>
>>> /*
>>> ** Make sure we can call this stuff from C++.
>>> */
>>> #if 0
>>> extern "C" {
>>> #endif
>>>
>>>See the #if 0? That's the problem. It should be:
>>>
>>> #if __cplusplus
>>>
>>>SQLite 3.3.17 has a bug in sqlite3.c generation.
>>>To work around this issue, do this:
>>>
>>> extern "C" {
>>> #include "sqlite3.h"
>>> }
>>>
>>>
>>>__
>>>Do You Yahoo!?
>>>Tired of spam?  Yahoo! Mail has the best spam protection around 
>>>http://mail.yahoo.com 
>>>
>>>
>>>
>>
>

> 
>>-
>>  
>>
>>>To unsubscribe, send email to [EMAIL PROTECTED]
>>>
>>>
>>
>

> 
>>-
>>  
>>
>>>
>>
>>
>>__
>>Do You Yahoo!?
>>Tired of spam?  Yahoo! Mail has the best spam protection around 
>>http://mail.yahoo.com 
>>
>>
> 
>

> 
>>-
>>To unsubscribe, send email to [EMAIL PROTECTED]
>>
> 
>

> 
>>-
>>
>>
>>
> 
>

> -
> 
>>To unsubscribe, send email to [EMAIL PROTECTED]
>>
> 
>

> -
> 
>>
>>  
> 
> 
> 
>

> -
> To unsubscribe, send email to [EMAIL PROTECTED]
>

> -
> 
> 
>

-
> To unsubscribe, send email to [EMAIL PROTECTED]
>

-
> 



-
To unsubscribe, send email to [EMAIL PROTECTED]

-


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



RE: [sqlite] sqlite and borland c++ builder

2007-04-29 Thread Jonathan Kahn
Hi Ulrik,
  Sqlite3.h already seems to have the #ifdef extern "C" , etc as Joe Wilson
mentioned, and I try just #include  and I get that error I
mentioned in my previous post about "[C++ Error] sqlite3.h(1778): E2232
Constant member 'sqlite3_index_info::nConstraint' in class without
constructors" 

 I searched on google about this and someone removed the const's from the
structs related to sqlite3_index_info and then it compiles with the header
but then I hit yet another error which states: "Unresolved external
'_sqlite3_open' referenced from MAIN.OBJ"

I think others have posted receiving that error but I'm not sure there were
any resolutions..Any ideas on this note?

Thanks
- Jon


-Original Message-
From: Ulrik Petersen [mailto:[EMAIL PROTECTED] 
Sent: Sunday, April 29, 2007 2:53 AM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] sqlite and borland c++ builder

Hi Jonathan,

I don't use Borland C, so I can' help you with the specifics of that 
compiler.

But no, you don't necessarily get an executable just by compiling with a 
C compiler.  You should be able to compile SQLite with a C compiler,  
and in the process obtain one or more .o files.  (Perhaps they are 
called .obj in Borland C.)

With the GNU C compiler (and many other compilers), the switch to create 
a .o file instead of an executable is -c.  Maybe this translates to /c 
on Borland C, but you'd have to consult your Borland C manual for that.

These .o/.obj files can be linked into your C++ program.  If you follow 
Joe Wilson's advice and just #include  from within C++, it 
should work.

That is exactly what the 'extern "C"' clause is for in C++: It tells the 
C++ compiler that the functions within the 'extern "C" { ... }'  block 
were compiled with a compiler that emits code with C calling 
conventions.  This enables calling C code from within C++.  As you 
probably know, calling conventions have to do with, among other things, 
the way function parameters are put on the stack, and the way any return 
value is returned.

HTH

Regards,

Ulrik Petersen


Jonathan Kahn wrote:
> Hi Ulrik,
>   Thank you for responding.  I'll try anything!  The frustration that all
> this has brought me I am determined to solve it.  
>
>   If I built SQLite with a C compiler what would be the result?  What
would
> I be able to work with from within c++?  Won't compiling leave me with an
> executable?  I am fairly new to dealing with different compilers and
things,
> so please forgive my ignorance. 
>
> Thanks a lot,
> - Jon
>
>
> -Original Message-
> From: Ulrik Petersen [mailto:[EMAIL PROTECTED] 
> Sent: Sunday, April 29, 2007 2:29 AM
> To: sqlite-users@sqlite.org
> Subject: Re: [sqlite] sqlite and borland c++ builder
>
> Hi Jon,
>
> is it not an option to build SQLite with a C compiler, then call it from 
> within C++?
>
>
> Regards,
>
> Ulrik Petersen
>
>
> Jonathan Kahn wrote:
>   
>> Even when I try to build a new dll I get errors with attach.c and it says
>> cannot convert 'void *' to 'Db *', no matter what route I take I always
>> 
> hit
>   
>> a bump.  I'm just trying anything at this point
>>
>> - Jon
>>
>> -Original Message-
>> From: Joe Wilson [mailto:[EMAIL PROTECTED] 
>> Sent: Sunday, April 29, 2007 1:59 AM
>> To: sqlite-users@sqlite.org
>> Subject: Re: [sqlite] sqlite and borland c++ builder 
>>
>> I wrote too quickly - sqlite3.h correctly uses __cplusplus for extern
"C".
>>
>> But the almalgomated sqlite3.c cannot be compiled from a C++ compiler
>> for the reasons described below.
>>
>> --- Joe Wilson <[EMAIL PROTECTED]> wrote:
>>   
>> 
>>>>   When I try to use the header I get errors
>>>>
>>>>  [C++ Error] sqlite3.h(1778): E2232 Constant member
>>>> 'sqlite3_index_info::nConstraint' in class without constructors
>>>>   
>>>> 
>>> It appears it is trying to compile the sqlite header file as if it were
>>> 
>>>   
>> C++.
>>   
>> 
>>> Lemme guess - you're using the almalgomated sqlite3.c from 3.3.17,
right?
>>>
>>> from the generated sqlite3.c:
>>>
>>>  /*
>>>  ** Make sure we can call this stuff from C++.
>>>  */
>>>  #if 0
>>>  extern "C" {
>>>  #endif
>>>
>>> See the #if 0? That's the problem. It should be:
>>>
>>>  #if __cplusplus
>>>
>>> SQLite 3.3.17 has a bug in sqlite3.c generation.
>>> To work around this issue, do this:
>>>
>>>  extern "C" {
>>>  #include "sqlite3.h"

RE: [sqlite] sqlite and borland c++ builder

2007-04-29 Thread Jonathan Kahn
Also, I tried changing to #ifdef __cplusplus and I still encounter many
errors such as "Constant member 'sqlite3_index_info::nConstraint' in class
without constructors" which is the same error as in sqlite3.h

Thanks
- Jon

-Original Message-
From: Joe Wilson [mailto:[EMAIL PROTECTED] 
Sent: Sunday, April 29, 2007 2:12 AM
To: sqlite-users@sqlite.org
Subject: RE: [sqlite] sqlite and borland c++ builder 

--- Jonathan Kahn <[EMAIL PROTECTED]> wrote:
> I really appreciate your response.  What do you suggest I do?  Is there
> something else I need to include aside from sqlite3.lib?  I am willing to
> try anything.

I only use GNU C++, so I can't help you with .lib files.

I'd suggest to compile sqlite3.c with a C compiler or change sqlite3.c to
include this:

 #ifdef __cplusplus
 extern "C" {
 #endif

 ... contents of sqlite3.c ...

 #ifdef __cplusplus
 }
 #endif

sqlite3.h has the correct __cplusplus extern wrapper.

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


-
To unsubscribe, send email to [EMAIL PROTECTED]

-


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



RE: [sqlite] sqlite and borland c++ builder

2007-04-29 Thread Jonathan Kahn
Hi Ulrik,
  Thank you for responding.  I'll try anything!  The frustration that all
this has brought me I am determined to solve it.  

  If I built SQLite with a C compiler what would be the result?  What would
I be able to work with from within c++?  Won't compiling leave me with an
executable?  I am fairly new to dealing with different compilers and things,
so please forgive my ignorance. 

Thanks a lot,
- Jon


-Original Message-
From: Ulrik Petersen [mailto:[EMAIL PROTECTED] 
Sent: Sunday, April 29, 2007 2:29 AM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] sqlite and borland c++ builder

Hi Jon,

is it not an option to build SQLite with a C compiler, then call it from 
within C++?


Regards,

Ulrik Petersen


Jonathan Kahn wrote:
> Even when I try to build a new dll I get errors with attach.c and it says
> cannot convert 'void *' to 'Db *', no matter what route I take I always
hit
> a bump.  I'm just trying anything at this point
>
> - Jon
>
> -Original Message-
> From: Joe Wilson [mailto:[EMAIL PROTECTED] 
> Sent: Sunday, April 29, 2007 1:59 AM
> To: sqlite-users@sqlite.org
> Subject: Re: [sqlite] sqlite and borland c++ builder 
>
> I wrote too quickly - sqlite3.h correctly uses __cplusplus for extern "C".
>
> But the almalgomated sqlite3.c cannot be compiled from a C++ compiler
> for the reasons described below.
>
> --- Joe Wilson <[EMAIL PROTECTED]> wrote:
>   
>>>   When I try to use the header I get errors
>>>
>>>  [C++ Error] sqlite3.h(1778): E2232 Constant member
>>> 'sqlite3_index_info::nConstraint' in class without constructors
>>>   
>> It appears it is trying to compile the sqlite header file as if it were
>> 
> C++.
>   
>> Lemme guess - you're using the almalgomated sqlite3.c from 3.3.17, right?
>>
>> from the generated sqlite3.c:
>>
>>  /*
>>  ** Make sure we can call this stuff from C++.
>>  */
>>  #if 0
>>  extern "C" {
>>  #endif
>>
>> See the #if 0? That's the problem. It should be:
>>
>>  #if __cplusplus
>>
>> SQLite 3.3.17 has a bug in sqlite3.c generation.
>> To work around this issue, do this:
>>
>>  extern "C" {
>>  #include "sqlite3.h"
>>  }
>>
>>
>> __
>> Do You Yahoo!?
>> Tired of spam?  Yahoo! Mail has the best spam protection around 
>> http://mail.yahoo.com 
>>
>>
>> 
>

> -
>   
>> To unsubscribe, send email to [EMAIL PROTECTED]
>>
>> 
>

> -
>   
>> 
>
>
> __
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
>
>

> -
> To unsubscribe, send email to [EMAIL PROTECTED]
>

> -
>
>
>

-
> To unsubscribe, send email to [EMAIL PROTECTED]
>

-
>
>
>   



-
To unsubscribe, send email to [EMAIL PROTECTED]

-


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



RE: [sqlite] sqlite and borland c++ builder

2007-04-29 Thread Jonathan Kahn
Even when I try to build a new dll I get errors with attach.c and it says
cannot convert 'void *' to 'Db *', no matter what route I take I always hit
a bump.  I'm just trying anything at this point

- Jon

-Original Message-
From: Joe Wilson [mailto:[EMAIL PROTECTED] 
Sent: Sunday, April 29, 2007 1:59 AM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] sqlite and borland c++ builder 

I wrote too quickly - sqlite3.h correctly uses __cplusplus for extern "C".

But the almalgomated sqlite3.c cannot be compiled from a C++ compiler
for the reasons described below.

--- Joe Wilson <[EMAIL PROTECTED]> wrote:
> >   When I try to use the header I get errors
> > 
> >  [C++ Error] sqlite3.h(1778): E2232 Constant member
> > 'sqlite3_index_info::nConstraint' in class without constructors
> 
> It appears it is trying to compile the sqlite header file as if it were
C++.
> Lemme guess - you're using the almalgomated sqlite3.c from 3.3.17, right?
> 
> from the generated sqlite3.c:
> 
>  /*
>  ** Make sure we can call this stuff from C++.
>  */
>  #if 0
>  extern "C" {
>  #endif
> 
> See the #if 0? That's the problem. It should be:
> 
>  #if __cplusplus
> 
> SQLite 3.3.17 has a bug in sqlite3.c generation.
> To work around this issue, do this:
> 
>  extern "C" {
>  #include "sqlite3.h"
>  }
> 
> 
> __
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> 
>

-
> To unsubscribe, send email to [EMAIL PROTECTED]
>

-
> 
> 


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


-
To unsubscribe, send email to [EMAIL PROTECTED]

-


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



RE: [sqlite] sqlite and borland c++ builder

2007-04-29 Thread Jonathan Kahn
I really appreciate your response.  What do you suggest I do?  Is there
something else I need to include aside from sqlite3.lib?  I am willing to
try anything.

Thanks a lot
- Jon

-Original Message-
From: Joe Wilson [mailto:[EMAIL PROTECTED] 
Sent: Sunday, April 29, 2007 1:59 AM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] sqlite and borland c++ builder 

I wrote too quickly - sqlite3.h correctly uses __cplusplus for extern "C".

But the almalgomated sqlite3.c cannot be compiled from a C++ compiler
for the reasons described below.

--- Joe Wilson <[EMAIL PROTECTED]> wrote:
> >   When I try to use the header I get errors
> > 
> >  [C++ Error] sqlite3.h(1778): E2232 Constant member
> > 'sqlite3_index_info::nConstraint' in class without constructors
> 
> It appears it is trying to compile the sqlite header file as if it were
C++.
> Lemme guess - you're using the almalgomated sqlite3.c from 3.3.17, right?
> 
> from the generated sqlite3.c:
> 
>  /*
>  ** Make sure we can call this stuff from C++.
>  */
>  #if 0
>  extern "C" {
>  #endif
> 
> See the #if 0? That's the problem. It should be:
> 
>  #if __cplusplus
> 
> SQLite 3.3.17 has a bug in sqlite3.c generation.
> To work around this issue, do this:
> 
>  extern "C" {
>  #include "sqlite3.h"
>  }
> 
> 
> __
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 
> 
>

-
> To unsubscribe, send email to [EMAIL PROTECTED]
>

-
> 
> 


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


-
To unsubscribe, send email to [EMAIL PROTECTED]

-


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



[sqlite] sqlite and borland c++ builder

2007-04-28 Thread Jonathan Kahn
This is my first post and it is out of desperation.  I am using Borland c++
builder with Borland developer studio 2006 I can not for the life of me get
anything sqlite functioning properly with this.  I have relentlessly
searched google as well as the mailing list and tried any information I have
found and have been for the most part completely unsuccessful and it is
beginning to drive me a little crazy.  

 

  When I try to use the header I get errors

 [C++ Error] sqlite3.h(1778): E2232 Constant member
'sqlite3_index_info::nConstraint' in class without constructors

 

Perhaps I can not include the header directly like that, either way I then
tried to use a dll. 

I did the following from which I found in the mailing list:

 

  impdef -a sqlite3.def sqlite3.dll

  impdef sqlite3.lib sqlite3.def

 

  I then add this lib file to my project and it compiled however when using
any code involving sqlite it turned to disaster.

 

  I added to my code:

 

  typedef struct sqlite3 sqlite3;

 

As well as: 

 

extern "C" {

 __declspec(dllimport) int sqlite3_open(const char *filename,sqlite3
**ppDb);

 __declspec(dllimport) int sqlite3_close(sqlite3*);

}

 

It compiled fine and I was able to declare:

 

__fastcall TForm1::TForm1(TComponent* Owner)

: TForm(Owner)

{

 

sqlite3 *db;

int res;

 

res = sqlite3_open("my.db",);

 

I had an if statement as well checking "res", etc but just calling
sqlite3_open causes some sort of unknown exception.  I have no idea what to
do Ive been trying to figure this out for many, many hours.  Can someone
please help me 

 

Thanks and Much, much appreciation,

- Jon