Re: Re: [sqlite] Detached database still owned by process

2006-11-29 Thread Anders Holmberg

Thanks for the responses.

The ProcessExplorer was just the thing I needed! With it I can see
that sqlite _does_ release the file handle and that my program must
hold on to it in another way sometimes. Now I have to find that
sometime;)

Thanks again...

/Anders

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



[sqlite] fts1/2 warnings.

2006-11-29 Thread Scott Hess

On 11/29/06, Ralf Junker <[EMAIL PROTECTED]> wrote:

* SQLITE_EXTENSION_INIT1

If I compile both fts1 and fts2 into the same executable with

  -DSQLITE_CORE=1
  -DSQLITE_ENABLE_FTS1=1
  -DSQLITE_ENABLE_FTS2=1

I receive a linker warning that sqlite3_api is defined in both fts1.c and 
fts2.c.

The warning goes away if I remove SQLITE_EXTENSION_INIT1 from both units.
I might be wrong, but maybe this is not necessary if the library is compiled 
with
SQLITE_CORE=1?


Unfortunately, I don't see this warning on my Ubuntu box, but it makes
sense, since the variables aren't declared static.  This is actually
perfectly valid in C, but probably not really what's intended in this
case.  My suspicion is that the right fix is either to make
sqlite3_api static (attached diff1.txt), or to do away with it
entirely under SQLITE_CORE (attached diff2.txt).

Richard, since this is in the virtual table interface, do you have any
strong opinion?


* fts1.c:

Variable i is never used in function static char *firstToken(char *zIn, char 
**pzTail).

Variable j is never used in function static int parseSpec(TableSpec *pSpec, int 
argc,
const char *const*argv, char**pzErr)

* fts2.c:

Both warnings above also apply to fts2.


Fixed, thanks.

-scott
Index: src/sqlite3ext.h
===
RCS file: /sqlite/sqlite/src/sqlite3ext.h,v
retrieving revision 1.7
diff -u -r1.7 sqlite3ext.h
--- src/sqlite3ext.h22 Sep 2006 23:38:21 -  1.7
+++ src/sqlite3ext.h29 Nov 2006 23:45:31 -
@@ -276,7 +276,7 @@
 #define sqlite3_overload_function  sqlite3_api->overload_function
 #endif /* SQLITE_CORE */
 
-#define SQLITE_EXTENSION_INIT1 const sqlite3_api_routines *sqlite3_api;
+#define SQLITE_EXTENSION_INIT1 static const sqlite3_api_routines 
*sqlite3_api;
 #define SQLITE_EXTENSION_INIT2(v)  sqlite3_api = v;
 
 #endif /* _SQLITE3EXT_H_ */
Index: src/sqlite3ext.h
===
RCS file: /sqlite/sqlite/src/sqlite3ext.h,v
retrieving revision 1.7
diff -u -r1.7 sqlite3ext.h
--- src/sqlite3ext.h22 Sep 2006 23:38:21 -  1.7
+++ src/sqlite3ext.h29 Nov 2006 23:46:22 -
@@ -276,7 +276,12 @@
 #define sqlite3_overload_function  sqlite3_api->overload_function
 #endif /* SQLITE_CORE */
 
+#ifdef SQLITE_CORE
+#define SQLITE_EXTENSION_INIT1
+#define SQLITE_EXTENSION_INIT2(v)
+#else
 #define SQLITE_EXTENSION_INIT1 const sqlite3_api_routines *sqlite3_api;
 #define SQLITE_EXTENSION_INIT2(v)  sqlite3_api = v;
+#endif
 
 #endif /* _SQLITE3EXT_H_ */
-
To unsubscribe, send email to [EMAIL PROTECTED]
-

Re: [sqlite] Selection Time

2006-11-29 Thread John Stanton

Lloyd wrote:

Hi,
  How much time can it take to perform 2000 selection queries on the
same database ?  Mostly the result set will contain only 1 raw. Is there
is any way to improve the selection speed?

Thanks,
  Lloyd


__
Scanned and protected by Email scanner

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


Run a trial and measure it and experiment with indioes.

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



Re: [sqlite] Detached database still owned by process

2006-11-29 Thread Trevor Talbot

Sysinternals' Process Explorer can be used to verify that your process
does indeed still have a handle to the file, or search for another
process that does, if you need it.

http://www.microsoft.com/technet/sysinternals/ProcessesAndThreads/ProcessExplorer.mspx

In the .NET application case, make sure (when using managed I/O) that
an explicit .Close() or .Dispose() is being done; don't rely on GC.
This doesn't apply to an sqlite wrapper in the detach case, though.

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



Re: [sqlite] how to use the query select with sqlite3_exec

2006-11-29 Thread John Stanton

Kirrthana M wrote:

Hi,
  Im new to sqlite,i have written a program to create a table and perform
the following operations
Insert,Delete,search.
To perform a search i used the query SELECT along with
sqlite3_exec..Execution is successful but the result is not displayed in the
screen.how to retrieve the result.Give me a suggestion.

Thanks,
Kirrthana


What does your callback function look like?  How are you presenting 
data?  With the Win32 API?



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



Re: [sqlite] Saving tables

2006-11-29 Thread John Stanton


Christian Smith wrote:

John Stanton uttered:

If you use an extension greater than 3 chars you violate rules for 
some existing file systems and reduce portability.  You can also make 
it difficult to parse the extension when it is used to type the file.




An extension of arbitray length should be just as easy to parse as an 
extension up to 3 characters. "Upto" implies that the extension can also 
be 0, 1 or 2 characters long, so the parsing code should be sufficiently 
flexible to handle 0..3 characters, and by extenstion 0..n characters is 
not much more difficult (where n is the length of the filename).


With VFAT, there is no filesystem in common use that can't handle 
extenstions >3 characters long.



Christian


My concern is being backward compatible with legacy systems or 
compatible with special purpose realtime OS's.  An application is either 
portable or not, being a "little bit portable" is like being "a little 
bit pregnant".


When in doubt use the Least Common Denominator.

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



Re: [sqlite] Powered-by Images?

2006-11-29 Thread drh
"Da Martian" <[EMAIL PROTECTED]> wrote:
> Hi
> 
> Are there any powered by images for SQLite3?
> 

A search for 'powered by sqlite' on google images
turned up two candidates for me.  Both seem adequate,
though neither is great.  You want to make a new
and better one and contribute it to the project?

--
D. Richard Hipp  <[EMAIL PROTECTED]>


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



Re: [sqlite] Detached database still owned by process

2006-11-29 Thread drh
"Anders Holmberg" <[EMAIL PROTECTED]> wrote:
> Hi
> 
> I am using sqlite (version 3.3.7) on Windows and I am loading one database
> (stored in a file) into another database (:memory:) using the attach /
> detatch scheme described on the sqlite site.
> 
> My problem is that sqlite keeps hanging on to the first database even after
> I have made a detach; which makes it impossible for me (or my program) to
> delete the original file.
> 
> Is there something more I need to do make sqlite "forget" about the file?
> 

Unable to reproduce.  "lsof" shows that sqlite3 closes the
file handle just fine when you detach on linux. Perhaps your detach
is failing.  What does "PRAGMA database_list" show after the
detach?
--
D. Richard Hipp  <[EMAIL PROTECTED]>


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



Re: [sqlite] Query

2006-11-29 Thread drh
[EMAIL PROTECTED] wrote:
> 
> "SELECT  * from database where STRING1 = 'x' && STRING2 = 'y' && STATE = 1 
> && purpose = 'z'"
> "Create INDEX  INDX on database( STRING1, STRING2, state, purpose)" 
> 
> i)
> If above index is present then the SELECT statement given, 
> iterates to the all rows present in the table or it directly jumps to the 
> block where entries satisfying STRING1 = 'x'  ??

It does a binary search to locate the correct entry.

> ii)
> 
> Whether INDEXInng based on String( 12 char) gives performace 
> problem???

Indexing a strings is no more expensive (byte for byte) than indexing on 
integers, on average.

> iii)
> 
> Whether this insertion will be like LINK LIST ( fast) or like 
> Array(slow)??

Insert will be O(logN)

> iv)
> Iis there any other way to call Select statement with less 
> performance issue?

If any of STRING1, STRING2, State, or purpose contains only
distinct values (or nearly so) then you can index just that one
column for a small performance gain on inserts, with probably
a smaller performance loss on queries.

> 
> Query 2)
> What will be the performance issue if I create INDEX with PATH( Long text) 
> in ASC or DSC mode for the above table
> 

There is no performance hit for ASC versus DESC. 

DESC is ignored on indices unless your database is created 
as file-format 4. File-format 4 was the default for SQLite
version 3.3.0 through 3.3.6, but because of problems with 
legacy code, file-format 1 became the default again in version 
3.3.7.  You can select file-format 4 using a PRAGMA when you 
create the database.  Or you can make file-format 4 the default 
at compile time.  

--
D. Richard Hipp  <[EMAIL PROTECTED]>


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



[sqlite] Re: how to use the query select with sqlite3_exec

2006-11-29 Thread Igor Tandetnik

Kirrthana M  wrote:

To perform a search i used the query SELECT along with
sqlite3_exec..Execution is successful but the result is not displayed
in the screen.how to retrieve the result.Give me a suggestion.


Don't use sqlite3_exec. Use sqlite3_prepare, sqlite3_step, 
sqlite3_column_*, sqlite3_finalize


Igor Tandetnik 



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



[sqlite] Re: Query

2006-11-29 Thread Igor Tandetnik

[EMAIL PROTECTED] wrote:

"SELECT  * from database where STRING1 = 'x' && STRING2 = 'y' &&
STATE = 1 && purpose = 'z'"

To achive this whether I need to attach given INDEX with the table so
that
during INSERT it will be inserted in a sorted order
"Create INDEX  INDX on database( STRING1, STRING2, state, purpose)"

i)
   If above index is present then the SELECT statement given,
iterates to the all rows present in the table or it directly jumps to
the
block where entries satisfying STRING1 = 'x'  ??


It "directly jumps" to records satisfying all four conditions. That's 
why you built an index on all four columns after all.



ii)

   Whether INDEXInng based on String( 12 char) gives performace
problem???


Any index is a tradeoff: you speed up selects but slow down inserts and 
updates. There is no problem with indexing strings specifically, if 
that's what you are asking.



iii)

   Whether this insertion will be like LINK LIST ( fast) or like
Array(slow)??


SQLite implements indexes as B-trees. Inserting a new record is O(log N) 
operation.




iv)
   Iis there any other way to call Select statement with less
performance issue?


The index you built gives best possible performance for this particular 
query. Whether the tradeoff was worth it only you can decide.



Query 2)
What will be the performance issue if I create INDEX with PATH( Long
text)
in ASC or DSC mode for the above table


None whatsoever - see http://sqlite.org/lang_createindex.html. SQLite 
ignores ASC and DESC modifiers and always builds an index in ascending 
order. However, a B-tree can be equally easily walked backwards as 
forwards, so something like ORDER BY Path DESC can still use the index.


Igor Tandetnik 



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



[sqlite] how to use the query select with sqlite3_exec

2006-11-29 Thread Kirrthana M
Hi,
  Im new to sqlite,i have written a program to create a table and perform
the following operations
Insert,Delete,search.
To perform a search i used the query SELECT along with
sqlite3_exec..Execution is successful but the result is not displayed in the
screen.how to retrieve the result.Give me a suggestion.

Thanks,
Kirrthana





Re: [sqlite] Selection Time

2006-11-29 Thread P Kishor

On 11/30/06, Lloyd <[EMAIL PROTECTED]> wrote:

Hi,
  How much time can it take to perform 2000 selection queries on the
same database ?  Mostly the result set will contain only 1 raw. Is there
is any way to improve the selection speed?



How on earth can anyone answer this question except for you. Just
perform your query 2000 times and time it. Make sure you have indexed
fields you are searching on.

--
Puneet Kishor http://punkish.eidesis.org/
Nelson Inst. for Env. Studies, UW-Madison http://www.nelson.wisc.edu/
Open Source Geospatial Foundation https://edu.osgeo.org/
---
collaborate, communicate, compete


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



Re: [sqlite] Right() function

2006-11-29 Thread Craig Morrison

Cécilia Vigny wrote:

Hi,

Does SQLite supports the right(string, len) function ?

For instance :

SELECT myfield, right(myfield,5) FROM mytable
where myfield = "aaa";

I've got an error near '(' when executing this request.



http://www.sqlite.org/lang_expr.html

substr(X,Y,Z):

Return a substring of input string X that begins with the Y-th character 
and which is Z characters long. The left-most character of X is number 
1. If Y is negative the the first character of the substring is found by 
counting from the right rather than the left. If SQLite is configured to 
support UTF-8, then characters indices refer to actual UTF-8 characters, 
not bytes.


--
Craig Morrison
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
http://pse.2cah.com
  Controlling pseudoephedrine purchases.

http://www.mtsprofessional.com/
  A Win32 email server that works for You.

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



RE: [sqlite] C++ SQLite

2006-11-29 Thread bartsmissaert
I did try the ODBC driver, but I found it was quite a bit slower.

RBS


> RB Smissaert uttered:
>
>> Yes, that looks to be the way to do it. Basically will have to learn how
>> to
>> translate C defines to VB declares.
>
>
> Why not just use ODBC?
>
> http://www.sqlite.org/cvstrac/wiki?p=SqliteOdbc
> http://www.ch-werner.de/sqliteodbc/
>
> That way, you're not even tied to SQLite.
>
>
>>
>> RBS
>>
>> -Original Message-
>> From: John Stanton [mailto:[EMAIL PROTECTED]
>> Sent: 28 November 2006 21:58
>> To: sqlite-users@sqlite.org
>> Subject: Re: [sqlite] C++ SQLite
>>
>> Maybe all you have to do is to make yourself a list og VB types cross
>> referenced to the fundamental type used in the Win32 and Sqlite APIs.
>> Then you could link any library into your VB programs.
>>
>> RB Smissaert wrote:
>>> You might be right, but with the Win32 API you have loads of nice
>>> documents/programs (I like the API guide from KPD) that help you out.
>>> All I have to do is copy their declares straight to VB and look at the
>> data
>>> types I have to provide. Is the same available for the SQLite API?
>>>
>>> RBS
>>>
>>> -Original Message-
>>> From: John Stanton [mailto:[EMAIL PROTECTED]
>>> Sent: 28 November 2006 18:43
>>> To: sqlite-users@sqlite.org
>>> Subject: Re: [sqlite] C++ SQLite
>>>
>>> If you can use the Win32 API you can use the Sqlite API.  Just because
>>> they can be called from C programs does not make them "all to do with
>>> C".
>>>
>>> RB Smissaert wrote:
>>>
 Will have a look, but I was looking for a text geared towards VB. I
 take
>>>
>>> it
>>>
 the documentation that comes with SQLite is all to do with C.
 In fact I already have a wrapper that seems to work well, the one from
 TerraInformatica, but maybe there was more control if I could write my
>>>
>>> own.
>>>
 RBS

 -Original Message-
 From: Clay Dowling [mailto:[EMAIL PROTECTED]
 Sent: 28 November 2006 18:19
 To: sqlite-users@sqlite.org
 Subject: Re: [sqlite] C++ SQLite


 [EMAIL PROTECTED] said:


> Thanks. Would you know any VB source code that wraps all the possible
> declares in a class? Or do you know where to find the documentation
> to make all the possible declares in VB/VBA?
>
> RBS


 The SQLite documentation will give you everything you need to write
 the
 wrapper.  The sqlite.h file in the source bundle would also be a great
 help.  You may also be able to find a wrapper already written linked
 on
 the SQLite web site.

 Clay Dowling



>> Yes.  It's a regular windows DLL, so it will behave like all other
>> Windows
>> DLLs.
>>
>> Clay Dowling
>>
>> [EMAIL PROTECTED] said:
>>
>>
>>> Can I call the SQLite API (as in the dll SQLite.dll) directly from
>>> VB or do I need the wrapper? So, could it work from VB with
>>> declares
>>> as I use for the Windows API?
>>>
>>> RBS
>>>
>>>
>>>
 sebcity wrote:


> How would one go about using c++ (Visual Studio.NET) to call and
> display
> SQLite tables. C++ wrappers?

 You should be able to call the Sqlite3 API directly.




>>>
>> 
>>>
 -


 To unsubscribe, send email to [EMAIL PROTECTED]



>>>
>> 
>>>
 -



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


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


>>>
>> 
>>>
 -


>> --
>> Simple Content Management
>> http://www.ceamus.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 

[sqlite] Right() function

2006-11-29 Thread Cécilia Vigny

Hi,

Does SQLite supports the right(string, len) function ?

For instance :

SELECT myfield, right(myfield,5) FROM mytable
where myfield = "aaa";

I've got an error near '(' when executing this request.

Thanks.


Ce message est prot?g? par les r?gles relatives au secret des correspondances. 
Il est donc ?tabli ? destination exclusive de son destinataire. Celui-ci peut 
donc contenir des informations confidentielles. La divulgation de ces 
informations est ? ce titre rigoureusement interdite. Si vous avez re?u ce 
message par erreur, merci de le renvoyer ? l'exp?diteur dont l'adresse e-mail 
figure ci-dessus et de d?truire le message ainsi que toute pi?ce jointe.

This message is protected by the secrecy of correspondence rules. Therefore, 
this message is intended solely for the attention of the addressee. This 
message may contain privileged or confidential information, as such the 
disclosure of these informations is strictly forbidden. If, by mistake, you 
have received this message, please return this message to the addressser whose 
e-mail address is written above and destroy this message and all files attached.



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



RE: [sqlite] C++ SQLite

2006-11-29 Thread Christian Smith

RB Smissaert uttered:


Yes, that looks to be the way to do it. Basically will have to learn how to
translate C defines to VB declares.



Why not just use ODBC?

http://www.sqlite.org/cvstrac/wiki?p=SqliteOdbc
http://www.ch-werner.de/sqliteodbc/

That way, you're not even tied to SQLite.




RBS

-Original Message-
From: John Stanton [mailto:[EMAIL PROTECTED]
Sent: 28 November 2006 21:58
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] C++ SQLite

Maybe all you have to do is to make yourself a list og VB types cross
referenced to the fundamental type used in the Win32 and Sqlite APIs.
Then you could link any library into your VB programs.

RB Smissaert wrote:

You might be right, but with the Win32 API you have loads of nice
documents/programs (I like the API guide from KPD) that help you out.
All I have to do is copy their declares straight to VB and look at the

data

types I have to provide. Is the same available for the SQLite API?

RBS

-Original Message-
From: John Stanton [mailto:[EMAIL PROTECTED]
Sent: 28 November 2006 18:43
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] C++ SQLite

If you can use the Win32 API you can use the Sqlite API.  Just because
they can be called from C programs does not make them "all to do with C".

RB Smissaert wrote:


Will have a look, but I was looking for a text geared towards VB. I take


it


the documentation that comes with SQLite is all to do with C.
In fact I already have a wrapper that seems to work well, the one from
TerraInformatica, but maybe there was more control if I could write my


own.


RBS

-Original Message-
From: Clay Dowling [mailto:[EMAIL PROTECTED]
Sent: 28 November 2006 18:19
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] C++ SQLite


[EMAIL PROTECTED] said:



Thanks. Would you know any VB source code that wraps all the possible
declares in a class? Or do you know where to find the documentation
to make all the possible declares in VB/VBA?

RBS



The SQLite documentation will give you everything you need to write the
wrapper.  The sqlite.h file in the source bundle would also be a great
help.  You may also be able to find a wrapper already written linked on
the SQLite web site.

Clay Dowling




Yes.  It's a regular windows DLL, so it will behave like all other
Windows
DLLs.

Clay Dowling

[EMAIL PROTECTED] said:



Can I call the SQLite API (as in the dll SQLite.dll) directly from
VB or do I need the wrapper? So, could it work from VB with declares
as I use for the Windows API?

RBS




sebcity wrote:



How would one go about using c++ (Visual Studio.NET) to call and
display
SQLite tables. C++ wrappers?


You should be able to call the Sqlite3 API directly.












-



To unsubscribe, send email to [EMAIL PROTECTED]











-















-



To unsubscribe, send email to [EMAIL PROTECTED]











-



--
Simple Content Management
http://www.ceamus.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]
-



--
/"\
\ /ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL
 X   - AGAINST MS ATTACHMENTS
/ \

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



Re: [sqlite] Saving tables

2006-11-29 Thread Christian Smith

John Stanton uttered:

If you use an extension greater than 3 chars you violate rules for some 
existing file systems and reduce portability.  You can also make it difficult 
to parse the extension when it is used to type the file.



An extension of arbitray length should be just as easy to parse as an 
extension up to 3 characters. "Upto" implies that the extension can also 
be 0, 1 or 2 characters long, so the parsing code should be sufficiently 
flexible to handle 0..3 characters, and by extenstion 0..n characters is 
not much more difficult (where n is the length of the filename).


With VFAT, there is no filesystem in common use that can't handle 
extenstions >3 characters long.



Christian


--
/"\
\ /ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL
 X   - AGAINST MS ATTACHMENTS
/ \

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



[sqlite] Powered-by Images?

2006-11-29 Thread Da Martian

Hi

Are there any powered by images for SQLite3?

Google seems at a loss which is unsual?

S


Re: [sqlite] Format change to fts2 module.

2006-11-29 Thread Ralf Junker
Hello Scott Hess,

>http://www.sqlite.org/cvstrac/tktview?tn=2046 should fix this for fts1 and 
>fts2.

I have just tested them in both fts1 and fts2 and the reported problems no 
longer show! Many thanks for the fixes!

Please allow me to report some (compiler-independent) compiler warnings about 
fts:


* fts1.c:

Variable i is never used in function static char *firstToken(char *zIn, char 
**pzTail).

Variable j is never used in function static int parseSpec(TableSpec *pSpec, int 
argc, const char *const*argv, char**pzErr)


* fts2.c:

Both warnings above also apply to fts2.


* SQLITE_EXTENSION_INIT1

If I compile both fts1 and fts2 into the same executable with

  -DSQLITE_CORE=1
  -DSQLITE_ENABLE_FTS1=1
  -DSQLITE_ENABLE_FTS2=1

I receive a linker warning that sqlite3_api is defined in both fts1.c and 
fts2.c.

The warning goes away if I remove SQLITE_EXTENSION_INIT1 from both units. I 
might be wrong, but maybe this is not necessary if the library is compiled with 
SQLITE_CORE=1?

Regards,

Ralf 


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



Re: [sqlite] Music Files

2006-11-29 Thread LuYanJun
Ok, Let me do it with C language
const unsigned char* Format(const char* szFormat, ...);
int AudioFillDatabase(const char* audiofile);
int main(void)
{
 Open();
  execDML(" CREATE TABLE IF NOT EXISTS AudioTable (id INTEGER , \n"
" name VARCHAR , \n"
  " data BLOB , \n"
  " type VARCHAR);");
AudoFillDatabase(SomeSongname.xxx);
Close();
exit(0);
}
int AudioFillDatabase(const char* audiofile)
{
   FILE* fp = fopen(audiofile, "rb");
   if ( fp == NULL )
  return -1;
   else {
  fseek(fp, 0, SEEK_END);
 long filesize = ftell(fp);
 unsigned char* MemFileSize = new unsigned char[filesize + 1];
  size_t ret = fread(MemFileSize, filesize, 1, fp);
  if ( ret != 0 )
 return -1;
  else {
 unsigned char* buf = new unsigned char[filesize+1024];
buf = Format("insert into AudioTable values (0, 'music', %Q, 'mp3');", 
MemFileSize);
   execDML(buf);
  }
 }
const char* format(const char* szFromat, ...)
{
   va_list va;
   va_start(va, szFormat);
   static char* mpBuf = sqlite3_vmprintf(szFormat, va);
   va_end(va);
   return mpBuf;
}
- Original Message - 
From: "Isaac Raway" <[EMAIL PROTECTED]>
To: 
Sent: Tuesday, November 28, 2006 11:04 PM
Subject: Re: [sqlite] Music Files


> On 11/27/06, LuYanJun <[EMAIL PROTECTED]> wrote:
>>
>> Can anybody give a simple example for domestrating ?
>> I am puzzled by this topic, how does a music file be sotred in DB as BLOB
>> type?
> 
> 
> You can insert /any/ kind of data into a SQLite database (or most any other
> sort of DB for that matter). Here's a short Pascal program that would do
> about what you want -- but of course getting the binary data out and into an
> object that can play it is another matter. Also I imagine this would be very
> slow, coming in at around 3 - 5 MB per song that has to be completely loaded
> into memory from the DB before playback and begin. I have not tested this
> but it gives you the idea: 1) load data into a stream / data string 2) write
> as DB BLOB.
> 
> var
>  MP3Source: string;
>  Data: TFileStream
> 
>  DBFileName: string;
>  DB: TSQLiteDatabase;
>  MustCreate: boolean;
> begin
>  MP3Source := 'SomeSong.mp3';
>  DBFileName := 'mp3.db3';
> 
>  MustCreate := not FileExists(DBFileName);
>  DB := TSQLiteDatabase.Create(DBFileName);
>  try
>if MustCreate then begin
>  DB.ExecSQL('CREATE TABLE mp3(filename STRING PRIMARY KEY, data
> BLOB);');
>end;
> 
>Data := TFileStream.Create(MP3Source, fmOpenRead);
>try
>  Data.Seek(0);
> 
>  DB.UpdateBlob('INSERT OR UPDATE INTO mp3(filename, data) ' +
>'VALUES(' + QuotedStr(MP3Source) + ', ?);', Data);
>finally
>  FreeAndNil(Data);
>end;
>  finally
>DB.Close;
>FreeAndNil(DB);
>  end;
> end;
>

[sqlite] Detached database still owned by process

2006-11-29 Thread Anders Holmberg

Hi

I am using sqlite (version 3.3.7) on Windows and I am loading one database
(stored in a file) into another database (:memory:) using the attach /
detatch scheme described on the sqlite site.

My problem is that sqlite keeps hanging on to the first database even after
I have made a detach; which makes it impossible for me (or my program) to
delete the original file.

Is there something more I need to do make sqlite "forget" about the file?

Anders Holmberg


Re: [sqlite] sqlite3 and threads ...

2006-11-29 Thread Marten Feldtmann

[EMAIL PROTECTED] schrieb:

the 2.4 kernel.  If you are using win32 or mac os-x or linux
with a 2.6 kernel, this restriction does not apply.

  

Thats interesting ! Thanks !


Marten

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