[sqlite] SqLite on Windows

2004-01-03 Thread Erwin Jabor
Hello.
I try to get a sqlite setup at WINDOWS with the LCC-32 C compiler to work.
I'm busy since a couple of weeks without success.
LCC-32 is a compiler that is nearly equal with VC-6.0. So that is not the
problem for shure.

I have trying several setups described at several websites. Non of then will
compile.
What I do at the moment is accessing sqlite via batchfiles. It works very
well but the problem is that the program has to shell do DOS every time it
does some database access. That means "black screen for a while".

I really need to access sqlite via an API or some other solution without
shelling to DOS.
Is someone willing to send me or to publish just some lines to make a very
simple setup that works.
Just one or two commands that really work. I try it but I'm not able to get
it to work.
Please just some lines of sources that I can hang in to my compiler and that
compiles and work. Please.
It always stuck with :
undefined reference to_sqlite_open
undefined reference to_sqlite_exec
undefined reference to_sqlite_close

I know that the only 3 commands I need, but no way to even compile it.

Your help will be very appriciated.

Thanks in advance
Erwin
Manila, Philippines




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [sqlite] Date problem

2004-01-03 Thread Doug Currie
Eugene,

> create table test(a int, b datetime);
> insert into test values(1,'2004/1/3');
> select * from test where date(b)='2004/1/3'

> The SELECT statement returns no record.

But this works:

sqlite> select * from test where b='2004/1/3';
1|2004/1/3

The date is not encoded properly in the database. Look again at the
date formats shown on the web page.

> Similarly, the statement:
> select date(b) from test
> does not return anything either.

> Perhaps I misunderstood the usage of those functions?

Here's an example...

sqlite> insert into test values (2,datetime("now","localtime"));
sqlite> select * from test where date(b) = "2004-01-03";
2|2004-01-03 22:28:56
sqlite>

e


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [sqlite] Re: sqlite_encode_binary problems

2004-01-03 Thread eno
Hi Rob,

>> size_t size = load_file->Length();
>>
>>  char in[size];
>> unsigned long nLoadSize = load_file->Read((void *)in, size);
>> unsigned char out[2 +(257*nLoadSize)/254];
>> sqlite_encode_binary((const unsigned char*)in, 257*nLoadSize)/254,
>> (unsigned char*)out);
>
>
> This is actually real basic C.
>
> Your problems are with allocating memory.
> The following lines wont work as they are evaluated at compile time, not
> at runtime.
>
>> char in[size];
>> unsigned char out[2 +(257*nLoadSize)/254];
>
>
> Instead you should use:
>
> unsigned char* in = malloc( size );
> unsigned char* out = malloc( 2 +(257*nLoadSize)/254 );
well, any decent C compiler should choke on this line:

>>  char in[size];

>> unsigned char out[2 +(257*nLoadSize)/254];

assumed, it didn't, let me think he is using a C99 capable compiler
where this *does* work.
/eno

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


[sqlite] Re: sqlite_encode_binary problems

2004-01-03 Thread Rob Laveaux
On 3-jan-04, at 23:29, John Scott <[EMAIL PROTECTED]> wrote:

I want to use sqlite_encode_binary to encode zip files into sqlite 
databse. But somehow I don't get the wanted result of this procedure.
Can someone tell me where i made a mistake??

Encoding:

wxFFile *load_file = new wxFFile();
load_file->Open("pc.zip", "rb");
size_t size = load_file->Length();
 char in[size];
unsigned long nLoadSize = load_file->Read((void *)in, size);
unsigned char out[2 +(257*nLoadSize)/254];
sqlite_encode_binary((const unsigned char*)in, 257*nLoadSize)/254, 
(unsigned char*)out);
This is actually real basic C.

Your problems are with allocating memory.
The following lines wont work as they are evaluated at compile time, 
not at runtime.

char in[size];
unsigned char out[2 +(257*nLoadSize)/254];
Instead you should use:

unsigned char* in = malloc( size );
unsigned char* out = malloc( 2 +(257*nLoadSize)/254 );
HTH,

- Rob Laveaux


Pluggers Software
Thijssestraat 203
2521 ZG  Den Haag
The Netherlands
Email: [EMAIL PROTECTED]
Website: http://www.pluggers.nl


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: [sqlite] Date problem

2004-01-03 Thread Eugene Lin
Hi,

With regard to these new date/time functions as pointed out at:

http://www.sqlite.org/cvstrac/wiki?p=DateAndTimeFunctions

I have one question: I can't seem to be able to use them on actual datetime field in 
the database. For instance, my test script as below:

create table test(a int, b datetime);
insert into test values(1,'2004/1/3');
select * from test where date(b)='2004/1/3'

The SELECT statement returns no record.

Similarly, the statement:

select date(b) from test

does not return anything either.

Perhaps I misunderstood the usage of those functions?

Thanks for any help.

Eugene Lin





*** REPLY SEPARATOR  ***

On 01/01/2004 at 10:38 PM D. Richard Hipp wrote:

>KL Chin wrote:
>>
>> Is that away to have a "DATE" comparison inside SQLite?
>> Or any expression to convert DATE to integer in SQLite?
>> I mean, I don;t have to worry about data migration from other
>> database.
>>
>
>http://www.sqlite.org/cvstrac/wiki?p=DateAndTimeFunctions
>
>
>--
>D. Richard Hipp -- [EMAIL PROTECTED] -- 704.948.4565
>
>
>-
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]