[sqlite] Text(3)

2004-03-23 Thread Anabell Chan
Hi all,

Firstly, how do I define a string table field with constraints on its size?
For example Text(3), string of three characters.  Secondly, how is it
enforced during updates?  Many thanks!

Best Regards,
Anabell


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



Re: [sqlite] TWS for Windows - link

2004-03-23 Thread Puneet Kishor
borivoj wrote:
In an attempt to generate more interest for TWS:

You can download windows version on 
http://unicast.org/archives/000508.html, follow the link "installer"

While it is still not a single exe file,  it works, and it is so easy to 
install. I have installed it on a Compact Flash drive to move it easily 
between different machines, one on work and one at home. It is PCMCIA CF 
but I suppose it will work on USB CF as well. Actually quite interesting 
possibility  to move web server, database and application that way. I am 
not aware of anything so simple, powerful and useful.


S sweet. Man, oh man. Thanks for the installer. Now, if only it 
could be so simple with other languages that start with P...

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


[sqlite] TWS for Windows - link

2004-03-23 Thread borivoj
In an attempt to generate more interest for TWS:

You can download windows version on 
http://unicast.org/archives/000508.html, follow the link "installer"

While it is still not a single exe file,  it works, and it is so easy to 
install. I have installed it on a Compact Flash drive to move it easily 
between different machines, one on work and one at home. It is PCMCIA CF 
but I suppose it will work on USB CF as well. Actually quite interesting 
possibility  to move web server, database and application that way. I am 
not aware of anything so simple, powerful and useful.

regards

Borivoj

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


RE: [sqlite] sqlite and Visual Basic

2004-03-23 Thread Tim Anderson
> -Original Message-
> From: Peter Mathijssen [mailto:[EMAIL PROTECTED] 
> Sent: 23 March 2004 20:10
> To: Greg Obleshchuk; [EMAIL PROTECTED]
> Subject: Re: [sqlite] sqlite and Visual Basic
> 
> Greg Obleshchuk schreef:
> > You can't use sqlite in a VB app (VB, VB.net, C#) without a 
> wrapper as 
> > these languages don't support the C style interfaces
> >  
> > Greg

I'm not sure what you mean by "without a wrapper". You can call the dll
directly from C# (and I would think VB.Net) provided you don't use the
callback. You can even use the callback if you are willing to do a
little hack on the compiled .Net executable.

See http://www.itwriting.com/sqlitenotes.php

Tim

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



RE: [sqlite] Diferent behavior in 2.8.12 and 2.8.13

2004-03-23 Thread Williams, Ken


> -Original Message-
> From: Rubens Jr. [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 23, 2004 5:00 PM
> 
> I read the OnLine Doc many times and I do not notice this :
> "SQLite expects the SQL string that you pass in to be 
> unchanged until the
> SQL has finished executing."
> 
> If this is in OnLine Doc I suggest it must be In a more 
> visible place ;)

That's probably a good idea, but if I were passing a char* to ANY C
function, not just the SQLite interface routines, I'd be pretty scared to
modify it in a callback before that function is finished running.

If the function doesn't expect to modify it, it can declare it "const".  If
it does expect to modify it, then you shouldn't ALSO modify it. =)

 -Ken

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



Re: [sqlite] Diferent behavior in 2.8.12 and 2.8.13

2004-03-23 Thread Rubens Jr.
>
> SQLite expects the SQL string that you pass in to be unchanged until
> the SQL has finished executing.

OK, here is the problem ... I did not knew that :(

> If you changes the SQL string before
> that, errors can happen, including segfaults.  If it worked in 2.8.12,
> it was only because you were lucky.

:)


> Here is a quick fix for your SQLite problem:  Go through your
> whole program and every place you you sqlite_exec(), change
> the code to use sqlite_exec_printf() instead.  You can read
> about how sqlite_exec_printf() works in the online docs.
>
>

Ok, Thanks a LOT !!

I read the OnLine Doc many times and I do not notice this :
"SQLite expects the SQL string that you pass in to be unchanged until the
SQL has finished executing."

If this is in OnLine Doc I suggest it must be In a more visible place ;)

Thanks again.

Rubens JR.


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



Re: [sqlite] sqlite_compile() different behaviour in 2.8.12 and 2.8.13

2004-03-23 Thread D. Richard Hipp
Rob Groves wrote:
I have noticed that in 2.8.13 sqlite_compile() can return SQLITE_BUSY. In
2.8.12 I only ever saw SQLITE_BUSY come from sqlite_finalize() after
sqlite_step() had failed. In 2.8.13 it seems it can come from either.
This is not a problem, but what is the intended behaviour?

Sqlite_compile() will return SQLITE_BUSY if it is unable to
read the schema information out of the sqlite_master table.
I think that has always been the case.
--
D. Richard Hipp -- [EMAIL PROTECTED] -- 704.948.4565
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: [sqlite] Diferent behavior in 2.8.12 and 2.8.13

2004-03-23 Thread D. Richard Hipp
Rubens Jr. wrote:
>
> I have a global buffer that I use in all querys and to retriev data in my
> callback funcs. Example :
>
> This have worked with version 2.8.12, but when I upgrade to 2.8.13 my
> application sometimes show stranges errors like 'near "x" : syntax error'
>  where x is some of my database data !!
>
> But, if I use _different_ buffers to SQL command and to retriev data this
> erros do not appear !! It seems that in version 2.8.13 SQLITE use the buffer
> from the SQL command to do something else !! Is this true ? Is it not
> possible to use same buffer in sqlite_exec and the callback function ?
>
SQLite expects the SQL string that you pass in to be unchanged until
the SQL has finished executing.  If you changes the SQL string before
that, errors can happen, including segfaults.  If it worked in 2.8.12,
it was only because you were lucky.
> If so I have to rewrite / review all of my application
>
Here is a quick fix for your SQLite problem:  Go through your
whole program and every place you you sqlite_exec(), change
the code to use sqlite_exec_printf() instead.  You can read
about how sqlite_exec_printf() works in the online docs.
--
D. Richard Hipp -- [EMAIL PROTECTED] -- 704.948.4565
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


[sqlite] sqlite_compile() different behaviour in 2.8.12 and 2.8.13

2004-03-23 Thread Rob Groves
Hi all,

I'm working on an update to CppSQLite.

I have noticed that in 2.8.13 sqlite_compile() can return SQLITE_BUSY. In
2.8.12 I only ever saw SQLITE_BUSY come from sqlite_finalize() after
sqlite_step() had failed. In 2.8.13 it seems it can come from either.

This is not a problem, but what is the intended behaviour?

Cheers,

Rob Groves
Author of CppSQLite http://www.codeproject.com/database/CppSQLite.asp


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



Re: [sqlite] Diferent behavior in 2.8.12 and 2.8.13

2004-03-23 Thread Rubens Jr.
>
> You're asking for trouble using strcpy() with arbitrary data.  Your
problem
> may be that you're writing beyond the bounds of my_buffer.  Instead of
>
>  strcpy (my_buffer, row [0]);
>
> use
>
>  strncpy (my_buffer, row [0], sizeof(my_buffer) - 1);
>  my_buffer[sizeof(my_buffer) - 1] = '\0';

Sorry, I think I do not express myself clear;
The data is very small, less than 20 bytes on each collum.
Than, all result will fit in less than 100 bytes.
The buffer is bigger than 20k !!
The error (syntax error) is depending on data in database, and not occurs
in previous version !!
I show the SQL before send to sqlite_exec and it is Ok.

...

> This may or may not be the cause of your problem.  If you've got exactly
the
> same data in your database now as you did with 2.8.12, then this isn't
likely
> the problem, although still could be since internal variables may have
moved
> around and are not being scribbled upon.
>
> Derrell
>

I used the same data in both version ...

Thanks

Rubens Jr.


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



Re: [sqlite] Diferent behavior in 2.8.12 and 2.8.13

2004-03-23 Thread Derrell . Lipman
"Rubens Jr." <[EMAIL PROTECTED]> writes:

> intmy_callback ()
> {
> 
> strcpy (my_buffer, row [0]);
> ...
> }
>
> voidmy_sql (void)
> {
> ...
>strcpy (my_buffer, "SELECT  FROM ... WHERE ");
>retcode = sqlite_exec (db, my_buffer, my_callback, NULL, & p_err);
>   if (retcode != SQLITE_OK)
> showerror (p_err);
> 
> }

You're asking for trouble using strcpy() with arbitrary data.  Your problem
may be that you're writing beyond the bounds of my_buffer.  Instead of

 strcpy (my_buffer, row [0]);

use

 strncpy (my_buffer, row [0], sizeof(my_buffer) - 1);
 my_buffer[sizeof(my_buffer) - 1] = '\0';

This ensures that your data is null terminated in the buffer, and that you
don't copy more data than your buffer can hold.

Some people will say NEVER use strcpy().  That's not a bad policy.  If you are
going to use it, you must be guaranteed that the amount of data being copied
will never overrun your buffer size.

This may or may not be the cause of your problem.  If you've got exactly the
same data in your database now as you did with 2.8.12, then this isn't likely
the problem, although still could be since internal variables may have moved
around and are not being scribbled upon.

Derrell

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



[sqlite] Slowness issues running on SCSI vs. IDE

2004-03-23 Thread Stathy G Touloumis
Hi,

I am currently using sqlite version 2.8.4 on RedHat Linux 7.3 on an IBM 
x.220 - x.345.

During a recent testing on the above platforms we discovered a performance 
issue when using both the perl sqlite module as well as the standard sqlite 
client.  When attempting to perform a large number of operations (inserts) 
on the database the process seems to get 'throttled' only being allowed 1 - 
5% cpu-time and running much slower than on a similar system using IDE 
drives.  This only occurs using sqlite and not using other scripts which 
perform numerous IO operations.

Any ideas?

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


[sqlite] Diferent behavior in 2.8.12 and 2.8.13

2004-03-23 Thread Rubens Jr.
Hi !

I have a global buffer that I use in all querys and to retriev data
in my callback funcs. Example :

charmy_buffer [2];

intmy_callback ()
{

strcpy (my_buffer, row [0]);
...
}

voidmy_sql (void)
{
...
   strcpy (my_buffer, "SELECT  FROM ... WHERE ");
   retcode = sqlite_exec (db, my_buffer, my_callback, NULL, & p_err);
  if (retcode != SQLITE_OK)
showerror (p_err);

}

This have worked with version 2.8.12, but when I upgrade to 2.8.13
my application sometimes show stranges errors like
'near "x" : syntax error'
where x is some of my database data !!

But, if I use _different_ buffers to SQL command and to retriev data
this erros do not appear !!
It seems that in version 2.8.13 SQLITE use the buffer from the SQL command
to do something else !!
Is this true ?
Is it not possible to use same buffer in sqlite_exec and the callback
function ?

If so I have to rewrite / review all of my application :(
Someone had notice that ?
Some workaround (and still use 2.8.13) ?

Thanks

Rubens Jr.


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



Re: [sqlite] sqlite and Visual Basic

2004-03-23 Thread Peter Mathijssen
Greg Obleshchuk schreef:

Hi Peter,
There a sample app with the source which shows how to use it, it's 
very simple and the app is really all there is to it.  One interface 
does all.  There some tips here http://www.sqlite.org/cvstrac/wiki.
You can't use sqlite in a VB app (VB, VB.net, C#) without a wrapper as 
these languages don't support the C style interfaces
 
Greg
Hi Greg,

I looked and modified the sample app and it is really simple to use.
I have also found BSoftplayer at http://bsoftplayer.sourceforge.net/
It's a Open Source SQL Media Player made in Visual Basic that uses your 
AGS_Sqlite.dll file.

PeterM

=
Ga zeker eens kijken op mijn site http://www.mijnplekophetnet.nl
=
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: [sqlite] Override conflict resolution behavior in triggers

2004-03-23 Thread Williams, Ken


> -Original Message-
> From: Banek, MB Matthew (8773) @ IS [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 23, 2004 1:19 PM
>  
> The problem I'm having is that the trigger does not use IGNORE for
conflict
> resolution, but uses REPLACE instead, since (as the documentation states)
> triggers use the conflict resolution method of statement that 
> causes them to fire (if one exists). 

Yeah, the documented behavior sounds very undesirable.  The conflict
resolution of a trigger should not have anything to do with the conflict
resolution of the statement that triggered it, in my opinion.

 -Ken

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



[sqlite] Override conflict resolution behavior in triggers

2004-03-23 Thread Banek, MB Matthew (8773) @ IS
I am adding data to a table with the following statement:
 
  INSERT OR REPLACE INTO MyTable(col1, col2, col3) VALUES(value1, value2,
value3);
 
and the following trigger has been created:
 
  CREATE TRIGGER AFTER INSERT ON MyTable
  BEGIN
INSERT OR IGNORE INTO MyOtherTable(col1, col2) VALUES(NEW.value1,
NEW.value2);
  END;
 
The problem I'm having is that the trigger does not use IGNORE for conflict
resolution, but uses REPLACE instead, since (as the documentation states)
triggers use the conflict resolution method of statement that causes them to
fire (if one exists). Is there any way to override this behavior and force
triggers to honor the conflict resolution method of their enclosed
statements?
 
Thanks,
Matt B.
 


[sqlite] SQLite and Java

2004-03-23 Thread boysen
Hi,

I am using SQLite from within Java. Unfortunately, the Java wrapper 
linked from the SQLite website tends to be rather slow when returning 
large resultsets from a query. Has anybody a handy solution for / 
experiences with that?

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


[sqlite] sqlite and Visual Basic

2004-03-23 Thread Peter Mathijssen
Hello,

I discovered sqlite last week and want to use it in a Visual Basic 
program. I also found the SQLite wrapper for Visual Basic from 
http://www.ag-software.com/sqlite.aspx. Greg Obleshchuck even, after a 
request,  updated it's driver to use the latest sqlite version.

Are there any visual basic source samples to be found on the internet 
that use greg's vb wrapper or is it possible to use the sqlite.dll 
without a wrapper version under Visual Basic.

Peter Mathijssen



=
Ga zeker eens kijken op mijn site http://www.mijnplekophetnet.nl
=
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


[sqlite] SQLite BLOB

2004-03-23 Thread Lay AndrĂ¡s
Hello!

I don't understand why do some people have a bad time with conversions, if they want 
to store BLOB in SQLite. The official FAQ also recommends that one should use any kind 
of conversion to convert binary data to a format that is suitable for SQLite:

http://www.sqlite.org/faq.html#q12

In my opinion, this is completely unnecessary. I'm using it via PHP, putting the 
binary data into the sqlite_escape_string function and it may go into the query:

".bin2hex($result["data"])."";
?>

Does anybody know about this solution?

Bye!

Lay


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