[sqlite] how to restore the column values into the structure.

2012-01-19 Thread bhaskarReddy

Hi Friends,

How to store the values of a columns in to the appropriate
variables.

 struct ABC
 {
 int a;
 int b;
 char *str;
 };

a bname
1 2 ABCD
2 4 WXYZ


   Now i am taking a variable to a structure, and i want to load the column
values of a particular row.

   ex:   struct ABC   st;

st.a =  //store the record 1's   'a' value.  
st.b =  // store the record 1's   'b' value. 
   st.str = // store the record 1's'name' value.

Regards,
Bhaskar Reddy.
-- 
View this message in context: 
http://old.nabble.com/how-to-restore-the-column-values-into-the-structure.-tp33172778p33172778.html
Sent from the SQLite mailing list archive at Nabble.com.

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Some pieces of the puzzle are coming together

2012-01-19 Thread Max Vlasov
John, another suggestion

Can you test previous sqlite versions one by one towards older ones with
one of your problem queries until the results are "good" again and send
both good and bad EXPLAIN QUERY output here. I'm sure this will be greek
for most of us :), but when Richard or Dan look at the difference in the
vdbe code, they could notice something

Max

On Fri, Jan 20, 2012 at 1:17 AM, John Elrick wrote:

> One more useful comparison.  The following query is prepared and step is
> called with these results:
>
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] 3.7.10 problem : SQLite header and source version mismatch

2012-01-19 Thread Kevin Youren
G'day,

thanks for such a great program.

Slight problem with sqlite-autoconf-3071000

When I issue from the command line: sqlite3

I get

SQLite header and source version mismatch
2011-06-23 19:49:22 4374b7e83ea0a3fbc3691f9c0c936272862f32f2
2012-01-16 13:28:40 ebd01a8deffb5024a5d7494eef800d2366d97204

I tried "make clean;make", but no luck.

I used:
CPPFLAGS="-DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS"
./configure
make
sudo make install (an Ubuntu system)


regs,

Kevin


___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] What to download for SharpDevelop?

2012-01-19 Thread Lou Arnold
OK. Thanks.

On Thu, Jan 19, 2012 at 7:30 PM, Simon Slavin  wrote:

>
> On 19 Jan 2012, at 10:37pm, Lou Arnold wrote:
>
> > When you say "amalgamation code" are do you mean source code?
>
> If you're programming in C or any superset of C then yes, you can get a
> specially optimised 'amalgamation' version of the source code all in two
> files (.c and .h) from
>
> 
>
> and just compile it into your project.  This lets you pick whatever
> compilation targets and options you want.
>
> >  And if so
> > then I should compile SQLite?
>
> SQLite isn't a stand-alone thing.  It's just a set of C functions.  You
> can't compile it on its own because it has no 'main' function.  But you can
> compile its source along with your program's source.  And the whole thing
> is so tiny it won't add much weight to your code.
>
> > Are the pre-compiled binaries not suitable?
> > If I were using Visual Studio, then a few DLLs would all that's needed.
> > SharpDevelop uses these DLLs just as they are.
>
> If the DLLs on that page do what you want, by all means use them.  But be
> aware of Windows' stupid implementation of DLLs which mean that if you're
> running anything else on your computer that uses a SQLite DLL you can't
> trust which version of SQLite it'll end up using.  Plenty of discussion of
> this in the archives of this group.
>
> Simon.
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
Lou Arnold
Ottawa, Canada
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] What to download for SharpDevelop?

2012-01-19 Thread Simon Slavin

On 19 Jan 2012, at 10:37pm, Lou Arnold wrote:

> When you say "amalgamation code" are do you mean source code?

If you're programming in C or any superset of C then yes, you can get a 
specially optimised 'amalgamation' version of the source code all in two files 
(.c and .h) from



and just compile it into your project.  This lets you pick whatever compilation 
targets and options you want.

>  And if so
> then I should compile SQLite?

SQLite isn't a stand-alone thing.  It's just a set of C functions.  You can't 
compile it on its own because it has no 'main' function.  But you can compile 
its source along with your program's source.  And the whole thing is so tiny it 
won't add much weight to your code.

> Are the pre-compiled binaries not suitable?
> If I were using Visual Studio, then a few DLLs would all that's needed.
> SharpDevelop uses these DLLs just as they are.

If the DLLs on that page do what you want, by all means use them.  But be aware 
of Windows' stupid implementation of DLLs which mean that if you're running 
anything else on your computer that uses a SQLite DLL you can't trust which 
version of SQLite it'll end up using.  Plenty of discussion of this in the 
archives of this group.

Simon.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] What to download for SharpDevelop?

2012-01-19 Thread Lou Arnold
Hello Simon,
When you say "amalgamation code" are do you mean source code? And if so
then I should compile SQLite? Are the pre-compiled binaries not suitable?
If I were using Visual Studio, then a few DLLs would all that's needed.
SharpDevelop uses these DLLs just as they are.
Lou.

On Thu, Jan 19, 2012 at 3:21 PM, Simon Slavin  wrote:

>
> On 19 Jan 2012, at 7:46pm, Lou Arnold wrote:
>
> > 1) I need a DLL to reference data objects in a C# Application developed
> > under SharpDevelop - (Like VS), using .Net Framework 4. But I also need
> to
> > access a SQLite database from the application. Does the DLL do both or
> will
> > I need SQLite3.exe as well?
>
>
> sqlite3.exe is a command-line tool to manipulate and consult a database by
> typing.  You wouldn't normally use it in a production environment, it's
> more for creating a new database or testing out commands to make sure they
> do what you think they do.
>
> > 2) The SQLite Download page lists precompiled binaries for Windows, and
> > then has a link to binaries for .Net.
> > The Windows binaries are:
> > - sqlite-dll-win32-x86-3071000 is composed of SQLite3.def and
> SQLite3.DLL.
> > Should I be using one or both of these?
> > - sqlite-shell-win32-x86-3071000.zip contains only SQLite3.exe
> >
> > Which set should I be downloading?
>
> None of them.  You should be downloading the amalgamation code (from the
> same downloads page) and including it in your projects.  Then you can
> compile it for any combination of hardware and OS your project runs on
> without worrying about what someone else wanted it for, or what some other
> programmer is depending on their version to do.
>
> Simon.
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
Lou Arnold
Ottawa, Canada
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Some pieces of the puzzle are coming together

2012-01-19 Thread John Elrick
One more useful comparison.  The following query is prepared and step is
called with these results:

step: UPDATE RESPONSES SET
RESPONSE_NAME = :RESPONSE_NAME
WHERE RESPONSE_OID = :RESPONSE_OID

Cumulative Allocated Memory:   10,992
Count of _malloc Calls:18
Cumulative Reallocated Memory: 0
Cumulative Reallocated Memory where nil:   0
Count of _realloc Calls:   0
Count of _realloc Calls where nil: 0
Count of _free Calls:  18
Cumulative _mallocs by size
<= 1kb:1,704 bytes (9 count)
1kb to 4kb:9,288 bytes (9 count)
4bk to 8kb:0 bytes (0 count)
8bk to 16kb:   0 bytes (0 count)
16bk to 32kb:  0 bytes (0 count)
32bk to 64kb:  0 bytes (0 count)
64bk to 128kb: 0 bytes (0 count)
128kb to 256kb:0 bytes (0 count)
256kb to 512kb:0 bytes (0 count)
512kb to 1024kb:   0 bytes (0 count)
> 1mb: 0 bytes (0 count)
Cumulative _reallocs by size
<= 1kb:0 bytes (0 count)
1kb to 4kb:0 bytes (0 count)
4bk to 8kb:0 bytes (0 count)
8bk to 16kb:   0 bytes (0 count)
16bk to 32kb:  0 bytes (0 count)
32bk to 64kb:  0 bytes (0 count)
64bk to 128kb: 0 bytes (0 count)
128kb to 256kb:0 bytes (0 count)
256kb to 512kb:0 bytes (0 count)
512kb to 1024kb:   0 bytes (0 count)
> 1mb: 0 bytes (0 count)
Cumulative _reallocs of nil pointers by size
<= 1kb:0 bytes (0 count)
1kb to 4kb:0 bytes (0 count)
4bk to 8kb:0 bytes (0 count)
8bk to 16kb:   0 bytes (0 count)
16bk to 32kb:  0 bytes (0 count)
32bk to 64kb:  0 bytes (0 count)
64bk to 128kb: 0 bytes (0 count)
128kb to 256kb:0 bytes (0 count)
256kb to 512kb:0 bytes (0 count)
512kb to 1024kb:   0 bytes (0 count)
> 1mb: 0 bytes (0 count)

step is called on the exact same prepared query 0.201 seconds later:

Cumulative Allocated Memory:   439,424
Count of _malloc Calls:2,248
Cumulative Reallocated Memory: 5,080
Cumulative Reallocated Memory where nil:   0
Count of _realloc Calls:   23
Count of _realloc Calls where nil: 0
Count of _free Calls:  2,246
Cumulative _mallocs by size
<= 1kb:175,160 bytes (2,047 count)
1kb to 4kb:264,264 bytes (201 count)
4bk to 8kb:0 bytes (0 count)
8bk to 16kb:   0 bytes (0 count)
16bk to 32kb:  0 bytes (0 count)
32bk to 64kb:  0 bytes (0 count)
64bk to 128kb: 0 bytes (0 count)
128kb to 256kb:0 bytes (0 count)
256kb to 512kb:0 bytes (0 count)
512kb to 1024kb:   0 bytes (0 count)
> 1mb: 0 bytes (0 count)
Cumulative _reallocs by size
<= 1kb:5,080 bytes (23 count)
1kb to 4kb:0 bytes (0 count)
4bk to 8kb:0 bytes (0 count)
8bk to 16kb:   0 bytes (0 count)
16bk to 32kb:  0 bytes (0 count)
32bk to 64kb:  0 bytes (0 count)
64bk to 128kb: 0 bytes (0 count)
128kb to 256kb:0 bytes (0 count)
256kb to 512kb:0 bytes (0 count)
512kb to 1024kb:   0 bytes (0 count)
> 1mb: 0 bytes (0 count)
Cumulative _reallocs of nil pointers by size
<= 1kb:0 bytes (0 count)
1kb to 4kb:0 bytes (0 count)
4bk to 8kb:0 bytes (0 count)
8bk to 16kb:   0 bytes (0 count)
16bk to 32kb:  0 bytes (0 count)
32bk to 64kb:  0 bytes (0 count)
64bk to 128kb: 0 bytes (0 count)
128kb to 256kb:0 bytes (0 

Re: [sqlite] What to download for SharpDevelop?

2012-01-19 Thread Simon Slavin

On 19 Jan 2012, at 7:46pm, Lou Arnold wrote:

> 1) I need a DLL to reference data objects in a C# Application developed
> under SharpDevelop - (Like VS), using .Net Framework 4. But I also need to
> access a SQLite database from the application. Does the DLL do both or will
> I need SQLite3.exe as well?


sqlite3.exe is a command-line tool to manipulate and consult a database by 
typing.  You wouldn't normally use it in a production environment, it's more 
for creating a new database or testing out commands to make sure they do what 
you think they do.

> 2) The SQLite Download page lists precompiled binaries for Windows, and
> then has a link to binaries for .Net.
> The Windows binaries are:
> - sqlite-dll-win32-x86-3071000 is composed of SQLite3.def and SQLite3.DLL.
> Should I be using one or both of these?
> - sqlite-shell-win32-x86-3071000.zip contains only SQLite3.exe
> 
> Which set should I be downloading?

None of them.  You should be downloading the amalgamation code (from the same 
downloads page) and including it in your projects.  Then you can compile it for 
any combination of hardware and OS your project runs on without worrying about 
what someone else wanted it for, or what some other programmer is depending on 
their version to do.

Simon.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] What to download for SharpDevelop?

2012-01-19 Thread Reid Thompson
On Thu, 2012-01-19 at 14:46 -0500, Lou Arnold wrote:
> I read the list of downloads for SQLite, but I'm confused.

these examples may be of use
http://sqlite.phxsoftware.com/forums/p/76/266.aspx
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] What to download for SharpDevelop?

2012-01-19 Thread Lou Arnold
I read the list of downloads for SQLite, but I'm confused.
1) I need a DLL to reference data objects in a C# Application developed
under SharpDevelop - (Like VS), using .Net Framework 4. But I also need to
access a SQLite database from the application. Does the DLL do both or will
I need SQLite3.exe as well?

2) The SQLite Download page lists precompiled binaries for Windows, and
then has a link to binaries for .Net.
The Windows binaries are:
- sqlite-dll-win32-x86-3071000 is composed of SQLite3.def and SQLite3.DLL.
Should I be using one or both of these?
- sqlite-shell-win32-x86-3071000.zip contains only SQLite3.exe

Which set should I be downloading?

2) For the .Net Binaries (System.Data.SQLite Download Page), there are
"set-ups" and then the binaries for 32-bit Windows (Net Framework 4). They
are quite similar in content, but what are their uses?

These sets have a binary-bundle and just a straight binary. Which should I
be using?


-- 
Lou Arnold
Ottawa, Canada
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Is it necessary free returned results when sqlite3_get_table get an error?

2012-01-19 Thread Marc Cals
Ok,

Thanks for your help.

On 19 January 2012 19:07, Richard Hipp  wrote:

> On Thu, Jan 19, 2012 at 1:03 PM, Marc Cals  wrote:
>
> > Hello,
> >
> > I have one doubt about sqlite3_get_table() method. When it returns an
> error
> > is it necessary to free returned results invoking sqlite3_free_table
> > method? Or when an error produced return NULL value as result ?
> >
>
> You should always invoke sqlite3_free_table() regardless of whether or not
> an error was returned.  Sometimes the result will be NULL, sometimes not.
> But either way sqlite3_free_table() will work.
>
>
> >
> > Thanks
> > ___
> > sqlite-users mailing list
> > sqlite-users@sqlite.org
> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> >
>
>
>
> --
> D. Richard Hipp
> d...@sqlite.org
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Is it necessary free returned results when sqlite3_get_table get an error?

2012-01-19 Thread Richard Hipp
On Thu, Jan 19, 2012 at 1:03 PM, Marc Cals  wrote:

> Hello,
>
> I have one doubt about sqlite3_get_table() method. When it returns an error
> is it necessary to free returned results invoking sqlite3_free_table
> method? Or when an error produced return NULL value as result ?
>

You should always invoke sqlite3_free_table() regardless of whether or not
an error was returned.  Sometimes the result will be NULL, sometimes not.
But either way sqlite3_free_table() will work.


>
> Thanks
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Is it necessary free returned results when sqlite3_get_table get an error?

2012-01-19 Thread Marc Cals
Hello,

I have one doubt about sqlite3_get_table() method. When it returns an error
is it necessary to free returned results invoking sqlite3_free_table
method? Or when an error produced return NULL value as result ?

Thanks
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Some pieces of the puzzle are coming together

2012-01-19 Thread John Elrick
On Thu, Jan 19, 2012 at 11:49 AM, John Elrick wrote:

> I've added more tracking to our libraries.  Most queries result in minimal
> (<200 calls) _malloc activity, But I have found several anomalies.  I am
> listing some representatives below.  In the examples below, "step" is the
> operation.  Note also that all queries should have been prepared with
> sqlite3_prepare_v2 before step is invoked.
>


A few points I forgot to mention:

1. Each of these snapshots are deltas in the values before the operation
and after.  So, using Example 3, the delta in cumulative malloc'd memory
was 459,576 bytes and there were 2,323 calls to _malloc for this call to
sqlite3_step.
2. Each of these is ONE operation, not a cumulative for all executions of
that query
3. Example 3 represents an insert operation.  I should add example values
which would be inserted:

:QUESTIONNAIRE_OID: Integer
:QUESTIONNAIRE_NAME: string 9 characters long
:definition_parent: Integer
:instance_parent: Integer
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Some pieces of the puzzle are coming together

2012-01-19 Thread John Elrick
I've added more tracking to our libraries.  Most queries result in minimal
(<200 calls) _malloc activity, But I have found several anomalies.  I am
listing some representatives below.  In the examples below, "step" is the
operation.  Note also that all queries should have been prepared with
sqlite3_prepare_v2 before step is invoked.


step: select distinct FORM_DEFINITIONS.FORM_DEFINITION_OID from
FORM_DEFINITIONS, SURVEYS where SURVEYS.SURVEY_OID=:SURVEYS_SURVEY_OID and
FORM_DEFINITIONS.FORM_DEFINITION_OID=:FORM_DEFINITIONS_FORM_DEFINITION_OID
and FORM_DEFINITIONS.definition_parent=SURVEYS.SURVEY_OID order by
FORM_DEFINITIONS.rowid


Cumulative Allocated Memory:   430,208
Count of _malloc Calls:2,255
Cumulative Reallocated Memory: 5,632
Cumulative Reallocated Memory where nil:   0
Count of _realloc Calls:   22
Count of _realloc Calls where nil: 0
Count of _free Calls:  2,258
Cumulative _mallocs by size
<= 1kb:175,232 bytes (2,063 count)
1kb to 4kb:254,976 bytes (192 count)
4bk to 8kb:0 bytes (0 count)
8bk to 16kb:   0 bytes (0 count)
16bk to 32kb:  0 bytes (0 count)
32bk to 64kb:  0 bytes (0 count)
64bk to 128kb: 0 bytes (0 count)
128kb to 256kb:0 bytes (0 count)
256kb to 512kb:0 bytes (0 count)
512kb to 1024kb:   0 bytes (0 count)
> 1mb: 0 bytes (0 count)
Cumulative _reallocs by size
<= 1kb:5,632 bytes (22 count)
1kb to 4kb:0 bytes (0 count)
4bk to 8kb:0 bytes (0 count)
8bk to 16kb:   0 bytes (0 count)
16bk to 32kb:  0 bytes (0 count)
32bk to 64kb:  0 bytes (0 count)
64bk to 128kb: 0 bytes (0 count)
128kb to 256kb:0 bytes (0 count)
256kb to 512kb:0 bytes (0 count)
512kb to 1024kb:   0 bytes (0 count)
> 1mb: 0 bytes (0 count)
Cumulative _reallocs of nil pointers by size
<= 1kb:0 bytes (0 count)
1kb to 4kb:0 bytes (0 count)
4bk to 8kb:0 bytes (0 count)
8bk to 16kb:   0 bytes (0 count)
16bk to 32kb:  0 bytes (0 count)
32bk to 64kb:  0 bytes (0 count)
64bk to 128kb: 0 bytes (0 count)
128kb to 256kb:0 bytes (0 count)
256kb to 512kb:0 bytes (0 count)
512kb to 1024kb:   0 bytes (0 count)
> 1mb: 0 bytes (0 count)


Here is another anomaly:

step: insert   into background_constraints values (
:sequence_instance_oid , :sequence_definition_oid )

Cumulative Allocated Memory:   426,240
Count of _malloc Calls:2,221
Cumulative Reallocated Memory: 4,520
Cumulative Reallocated Memory where nil:   0
Count of _realloc Calls:   15
Count of _realloc Calls where nil: 0
Count of _free Calls:  2,233
Cumulative _mallocs by size
<= 1kb:171,264 bytes (2,029 count)
1kb to 4kb:254,976 bytes (192 count)
4bk to 8kb:0 bytes (0 count)
8bk to 16kb:   0 bytes (0 count)
16bk to 32kb:  0 bytes (0 count)
32bk to 64kb:  0 bytes (0 count)
64bk to 128kb: 0 bytes (0 count)
128kb to 256kb:0 bytes (0 count)
256kb to 512kb:0 bytes (0 count)
512kb to 1024kb:   0 bytes (0 count)
> 1mb: 0 bytes (0 count)
Cumulative _reallocs by size
<= 1kb:4,520 bytes (15 count)
1kb to 4kb:0 bytes (0 count)
4bk to 8kb:0 bytes (0 count)
8bk to 16kb:   0 bytes (0 count)
16bk to 32kb:  0 bytes (0 count)
32bk to 64kb:  0 bytes (0 count)
64bk to 128kb: 0 bytes (0 count)
128kb to 256kb:0 bytes (0 count)
256kb to 512kb:0 bytes (0 count)
512kb to 1024kb:   0 bytes (0 count)
> 1mb: 

Re: [sqlite] ATTACH 'file' to a :memory: database fails

2012-01-19 Thread Richard Hipp
On Thu, Jan 19, 2012 at 11:24 AM, Hauptmann Peter wrote:

> Hi,
>
> I am trying to create an in-memory database and then attach an "real"
> database to it:
>
> sqlite3_open_v2(":memory:", ...);
> sqlite3_exec(db, "ATTACH c:\\temp\\sqlite\\small.sdb AS disk", ...);
>

Did you quote the filename?

   sqlite3_exec(db, "ATTACH 'c:\\...\\small.sdb' AS disk", ...);


>
> Attach fails with  Error 1: SQL logic error or missing database.
>
> All other 3 cases (attach disk db to disk db,  memory to memory, memory to
> disk) work well.
>
> Is this a bug or some limitation I am not aware of?
>
> (For the time being I can work around this, but it's a little uncomforting
> since I wouldn't have expected that)
>
> Thanks in advance
>
> ph
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] ATTACH 'file' to a :memory: database fails

2012-01-19 Thread Hauptmann Peter
Hi,

I am trying to create an in-memory database and then attach an "real" database 
to it:

sqlite3_open_v2(":memory:", ...);
sqlite3_exec(db, "ATTACH c:\\temp\\sqlite\\small.sdb AS disk", ...);

Attach fails with  Error 1: SQL logic error or missing database.

All other 3 cases (attach disk db to disk db,  memory to memory, memory to 
disk) work well.

Is this a bug or some limitation I am not aware of?

(For the time being I can work around this, but it's a little uncomforting 
since I wouldn't have expected that)

Thanks in advance

ph
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Incompatible versions of SQLite on same system

2012-01-19 Thread Joe Mistachkin

Joe Winograd wrote:
> 
> I guess there's no solution that the end-user can deploy in this case.
It's 
> not even clear to me how the HP and/or Intuit programmers can solve the 
> problem, since I replaced the HP Connection Manager  with the

> latest one and TurboTax doesn't even have a  anywhere in its 
> directory structure and there isn't a  in any system
directory 
> and when the  fails, there isn't even a  that's

> been loaded in memory. Regards, Joe
> 

Another thing to keep in mind is that the System.Data.SQLite project
compiles
the native code for SQLite into files named "SQLite.Interop.dll" and
"System.Data.SQLite.dll" (mixed-mode assembly), depending on the build
configuration.

--
Joe Mistachkin

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Memory exception in sqlite3DbFree when called from sqlite3VdbeMemReleaseExternal as SQLITE_DYNAMIC

2012-01-19 Thread Dan Kennedy

On 01/19/2012 04:20 AM, Donald Bryant-Rich wrote:

In the function sqlite3VdbeMemReleaseExternal calls sqlite3DbFree
which is passed into the function as the xDel component of the Mem
argument to the function (p):

if( p->flags_Dyn&&  p->xDel ){
 assert( (p->flags_RowSet)==0 );
 p->xDel((void *)p->z);
 p->xDel = 0;
   }

sqlite3DbFree is declared to take two parameters, a database and a
point to the memory to be freed:
 SQLITE_PRIVATE void sqlite3DbFree(sqlite3*, void*);

But the xDel component is set in a number of functions to
SQLITE_DYNAMIC which is a cast of sqlite3DbFree to a function taking
only one parameter:

typedef void (*sqlite3_destructor_type)(void*);
#define SQLITE_STATIC  ((sqlite3_destructor_type)0)
#define SQLITE_TRANSIENT   ((sqlite3_destructor_type)-1)
#define SQLITE_DYNAMIC   ((sqlite3_destructor_type)sqlite3DbFree)

This can cause a memory exception when sqlite3DbFree is called with
the wrong number of parameters pushed to the stack.


Thanks for reporting this. The definition is certainly incorrect.

But looking at the code, we don't see how control could get to that
point with xDel==SQLITE_DYNAMIC. At least not with 3.7.10, as
SQLITE_DYNAMIC should always be handled here:

  http://www.sqlite.org/src/artifact/4f7d25d5ea2e?ln=728

Which version are you doing this with?

Dan.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Some pieces of the puzzle are coming together

2012-01-19 Thread John Elrick
On Thu, Jan 19, 2012 at 8:25 AM, John Elrick wrote:

>
>
> On Thu, Jan 19, 2012 at 8:15 AM, Richard Hipp  wrote:
>
>> On Thu, Jan 19, 2012 at 8:10 AM, John Elrick > >wrote:
>>
>> >
>> > I've been reading through the code.  Do I understand correctly that if
>> one
>> > prepared statement binding is changed in such a way as may influence the
>> > choice of the query plan that all the prepared statements for that
>> database
>> > connection are flagged for being re-prepared?
>> >
>> >
>> No. Only the one prepared statement whose binding changed is reprepared.
>>
>
>
> Thanks.  Now this becomes weirder.  I put breakpoints on all the locations
> you mentioned and they were activated precisely as expected.  When the
> initial database is created, the breakpoints hit, but are not hit during
> the actual load process.  Yet, the first while condition in sqlite3_step:
>
>   while( (rc = sqlite3Step(v))==SQLITE_SCHEMA
>  && cnt++ < SQLITE_MAX_SCHEMA_RETRY
>  && (rc2 = rc = sqlite3Reprepare(v))==SQLITE_OK ){
> sqlite3_reset(pStmt);
> assert( v->expired==0 );
>   }
>
> is triggering sqlite3Reprepare like clockwork.  So, given that none of the
> listed conditions are occurring, what else could be causing sqlite3Step to
> return SQLITE_SCHEMA?
>

Ok.  It's NOT triggering sqlite3Reprepare like clockwork.  I added a
function to allow me to check the return value and sqlite3Reprepare is
being called an appropriate number of times.  So we're back to the original
question, "why is sqlite3Parser calling _malloc so many times?"  I have an
idea of how to determine if any specific queries are to blame, but I have
to work on something unrelated this morning.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Some pieces of the puzzle are coming together

2012-01-19 Thread Simon Slavin

On 19 Jan 2012, at 1:25pm, John Elrick wrote:

> is triggering sqlite3Reprepare like clockwork.  So, given that none of the
> listed conditions are occurring, what else could be causing sqlite3Step to
> return SQLITE_SCHEMA?

It warms my heart to follow this wonderful technical detective story.

Simon.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Some pieces of the puzzle are coming together

2012-01-19 Thread John Elrick
On Thu, Jan 19, 2012 at 8:15 AM, Richard Hipp  wrote:

> On Thu, Jan 19, 2012 at 8:10 AM, John Elrick  >wrote:
>
> >
> > I've been reading through the code.  Do I understand correctly that if
> one
> > prepared statement binding is changed in such a way as may influence the
> > choice of the query plan that all the prepared statements for that
> database
> > connection are flagged for being re-prepared?
> >
> >
> No. Only the one prepared statement whose binding changed is reprepared.
>


Thanks.  Now this becomes weirder.  I put breakpoints on all the locations
you mentioned and they were activated precisely as expected.  When the
initial database is created, the breakpoints hit, but are not hit during
the actual load process.  Yet, the first while condition in sqlite3_step:

  while( (rc = sqlite3Step(v))==SQLITE_SCHEMA
 && cnt++ < SQLITE_MAX_SCHEMA_RETRY
 && (rc2 = rc = sqlite3Reprepare(v))==SQLITE_OK ){
sqlite3_reset(pStmt);
assert( v->expired==0 );
  }

is triggering sqlite3Reprepare like clockwork.  So, given that none of the
listed conditions are occurring, what else could be causing sqlite3Step to
return SQLITE_SCHEMA?
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Some pieces of the puzzle are coming together

2012-01-19 Thread Richard Hipp
On Thu, Jan 19, 2012 at 8:10 AM, John Elrick wrote:

>
> I've been reading through the code.  Do I understand correctly that if one
> prepared statement binding is changed in such a way as may influence the
> choice of the query plan that all the prepared statements for that database
> connection are flagged for being re-prepared?
>
>
No. Only the one prepared statement whose binding changed is reprepared.


>
> SQLITE_PRIVATE void sqlite3ExpirePreparedStatements(sqlite3 *db){
>  Vdbe *p;
>  for(p = db->pVdbe; p; p=p->pNext){
>p->expired = 1;
>   }
> }
>
>
>
>
> >
> >
> >
> >
> > >  On Thu, Jan 19, 2012 at 7:45 AM, Richard Hipp  wrote:
> > >
> > > > On Thu, Jan 19, 2012 at 7:41 AM, John Elrick <
> john.elr...@fenestra.com
> > > > >wrote:
> > > >
> > > > > Question:
> > > > >
> > > > > If a query has already been prepared with sqlite3_prepare_v2, why
> > would
> > > > > sqlite3_step need to call sqlite3Prepare, which in turn calls
> > > > > sqlite3RunParser?
> > > > >
> > > >
> > > > Because the database schema changed.  Or because you ran ATTACH or
> > > VACUUM,
> > > > either of which could potential change the bytecode necessary to run
> > the
> > > > statement.  Or, because you changed the authorization callback.
> > > >
> > > >
> > > >
> > > > > ___
> > > > > sqlite-users mailing list
> > > > > sqlite-users@sqlite.org
> > > > > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > D. Richard Hipp
> > > > d...@sqlite.org
> > > > ___
> > > > sqlite-users mailing list
> > > > sqlite-users@sqlite.org
> > > > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> > > >
> > >
> > >
> > >
> > > --
> > > John Elrick
> > > Fenestra Technologies
> > > 540-868-1377
> > > ___
> > > sqlite-users mailing list
> > > sqlite-users@sqlite.org
> > > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> > >
> >
> >
> >
> > --
> > D. Richard Hipp
> > d...@sqlite.org
> > ___
> > sqlite-users mailing list
> > sqlite-users@sqlite.org
> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> >
>
>
>
> --
> John Elrick
> Fenestra Technologies
> 540-868-1377
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Some pieces of the puzzle are coming together

2012-01-19 Thread John Elrick
On Thu, Jan 19, 2012 at 8:03 AM, Richard Hipp  wrote:

> On Thu, Jan 19, 2012 at 7:51 AM, John Elrick  >wrote:
>
> > Interesting:
> >
> > 1. There are no database schema changes occurring after the system is
> fully
> > initialized
> > 2. There are no ATTACHed databases (we checked that earlier)
> > 3. There are no calls to VACUUM
> > 4. As far as I am aware, there are no changes to any callbacks after the
> > system is fully initialized.
> >
> > I believe your earlier note is pointing us in the right direction.
> > Examining my call stacks, it appears that the query is being reparsed on
> > every call to step.  The question is, why?  Did any of these conditions
> > change between 3.6.17 and 3.7.9?  Maybe we are doing something that is
> > unintentionally triggering the re-parse which did not do so in the
> earlier
> > version.
> >
> >
> Also:  Changing a bound parameter on the right-hand side of a LIKE or GLOB
> operator forces a reprepare of that one statement, so that the query
> optimizer can determine if the new value meets certain criteria for
> optimization.
>
> Try setting a breakpoint on sqlite3ExpirePreparedStatements() to see what
> you find.  Also, on these lines to check for statement expiration due to
> variable rebinding:
>
>http://www.sqlite.org/src/artifact/3662b6a468a2?ln=1024
>http://www.sqlite.org/src/artifact/3662b6a468a2?ln=129
>
>
>

I've been reading through the code.  Do I understand correctly that if one
prepared statement binding is changed in such a way as may influence the
choice of the query plan that all the prepared statements for that database
connection are flagged for being re-prepared?


SQLITE_PRIVATE void sqlite3ExpirePreparedStatements(sqlite3 *db){
  Vdbe *p;
  for(p = db->pVdbe; p; p=p->pNext){
p->expired = 1;
  }
}




>
>
>
>
> >  On Thu, Jan 19, 2012 at 7:45 AM, Richard Hipp  wrote:
> >
> > > On Thu, Jan 19, 2012 at 7:41 AM, John Elrick  > > >wrote:
> > >
> > > > Question:
> > > >
> > > > If a query has already been prepared with sqlite3_prepare_v2, why
> would
> > > > sqlite3_step need to call sqlite3Prepare, which in turn calls
> > > > sqlite3RunParser?
> > > >
> > >
> > > Because the database schema changed.  Or because you ran ATTACH or
> > VACUUM,
> > > either of which could potential change the bytecode necessary to run
> the
> > > statement.  Or, because you changed the authorization callback.
> > >
> > >
> > >
> > > > ___
> > > > sqlite-users mailing list
> > > > sqlite-users@sqlite.org
> > > > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> > > >
> > >
> > >
> > >
> > > --
> > > D. Richard Hipp
> > > d...@sqlite.org
> > > ___
> > > sqlite-users mailing list
> > > sqlite-users@sqlite.org
> > > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> > >
> >
> >
> >
> > --
> > John Elrick
> > Fenestra Technologies
> > 540-868-1377
> > ___
> > sqlite-users mailing list
> > sqlite-users@sqlite.org
> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> >
>
>
>
> --
> D. Richard Hipp
> d...@sqlite.org
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
John Elrick
Fenestra Technologies
540-868-1377
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Memory exception in sqlite3DbFree when called from sqlite3VdbeMemReleaseExternal as SQLITE_DYNAMIC

2012-01-19 Thread Donald Bryant-Rich
In the function sqlite3VdbeMemReleaseExternal calls sqlite3DbFree
which is passed into the function as the xDel component of the Mem
argument to the function (p):

if( p->flags_Dyn && p->xDel ){
assert( (p->flags_RowSet)==0 );
p->xDel((void *)p->z);
p->xDel = 0;
  }

sqlite3DbFree is declared to take two parameters, a database and a
point to the memory to be freed:
SQLITE_PRIVATE void sqlite3DbFree(sqlite3*, void*);

But the xDel component is set in a number of functions to
SQLITE_DYNAMIC which is a cast of sqlite3DbFree to a function taking
only one parameter:

typedef void (*sqlite3_destructor_type)(void*);
#define SQLITE_STATIC  ((sqlite3_destructor_type)0)
#define SQLITE_TRANSIENT   ((sqlite3_destructor_type)-1)
#define SQLITE_DYNAMIC   ((sqlite3_destructor_type)sqlite3DbFree)

This can cause a memory exception when sqlite3DbFree is called with
the wrong number of parameters pushed to the stack.

I suggest that this be fixed by creating a function that takes the
pointer to the Mem structure and passes the db and z components of
this structure to sqlite3DbFree. This would allow the use of a single
argument function to free the dynamic memory held in a Mem structure
while retaining the single void * argument for the xDel values to be
consistent with the API functions.

Thank you,
Donald Rich
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Some pieces of the puzzle are coming together

2012-01-19 Thread Richard Hipp
On Thu, Jan 19, 2012 at 7:51 AM, John Elrick wrote:

> Interesting:
>
> 1. There are no database schema changes occurring after the system is fully
> initialized
> 2. There are no ATTACHed databases (we checked that earlier)
> 3. There are no calls to VACUUM
> 4. As far as I am aware, there are no changes to any callbacks after the
> system is fully initialized.
>
> I believe your earlier note is pointing us in the right direction.
> Examining my call stacks, it appears that the query is being reparsed on
> every call to step.  The question is, why?  Did any of these conditions
> change between 3.6.17 and 3.7.9?  Maybe we are doing something that is
> unintentionally triggering the re-parse which did not do so in the earlier
> version.
>
>
Also:  Changing a bound parameter on the right-hand side of a LIKE or GLOB
operator forces a reprepare of that one statement, so that the query
optimizer can determine if the new value meets certain criteria for
optimization.

Try setting a breakpoint on sqlite3ExpirePreparedStatements() to see what
you find.  Also, on these lines to check for statement expiration due to
variable rebinding:

http://www.sqlite.org/src/artifact/3662b6a468a2?ln=1024
http://www.sqlite.org/src/artifact/3662b6a468a2?ln=129






>  On Thu, Jan 19, 2012 at 7:45 AM, Richard Hipp  wrote:
>
> > On Thu, Jan 19, 2012 at 7:41 AM, John Elrick  > >wrote:
> >
> > > Question:
> > >
> > > If a query has already been prepared with sqlite3_prepare_v2, why would
> > > sqlite3_step need to call sqlite3Prepare, which in turn calls
> > > sqlite3RunParser?
> > >
> >
> > Because the database schema changed.  Or because you ran ATTACH or
> VACUUM,
> > either of which could potential change the bytecode necessary to run the
> > statement.  Or, because you changed the authorization callback.
> >
> >
> >
> > > ___
> > > sqlite-users mailing list
> > > sqlite-users@sqlite.org
> > > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> > >
> >
> >
> >
> > --
> > D. Richard Hipp
> > d...@sqlite.org
> > ___
> > sqlite-users mailing list
> > sqlite-users@sqlite.org
> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> >
>
>
>
> --
> John Elrick
> Fenestra Technologies
> 540-868-1377
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Is there any API that will return a record based on Primary key.

2012-01-19 Thread Igor Tandetnik
bhaskarReddy  wrote:
>  Is there any SQLite API for returning a record based on particular
> Primary key id.

No special API. You just run a statement of the form

select * from MyTable where MyPrimaryKeyColumn = ?;

-- 
Igor Tandetnik

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Some pieces of the puzzle are coming together

2012-01-19 Thread John Elrick
Interesting:

1. There are no database schema changes occurring after the system is fully
initialized
2. There are no ATTACHed databases (we checked that earlier)
3. There are no calls to VACUUM
4. As far as I am aware, there are no changes to any callbacks after the
system is fully initialized.

I believe your earlier note is pointing us in the right direction.
Examining my call stacks, it appears that the query is being reparsed on
every call to step.  The question is, why?  Did any of these conditions
change between 3.6.17 and 3.7.9?  Maybe we are doing something that is
unintentionally triggering the re-parse which did not do so in the earlier
version.

On Thu, Jan 19, 2012 at 7:45 AM, Richard Hipp  wrote:

> On Thu, Jan 19, 2012 at 7:41 AM, John Elrick  >wrote:
>
> > Question:
> >
> > If a query has already been prepared with sqlite3_prepare_v2, why would
> > sqlite3_step need to call sqlite3Prepare, which in turn calls
> > sqlite3RunParser?
> >
>
> Because the database schema changed.  Or because you ran ATTACH or VACUUM,
> either of which could potential change the bytecode necessary to run the
> statement.  Or, because you changed the authorization callback.
>
>
>
> > ___
> > sqlite-users mailing list
> > sqlite-users@sqlite.org
> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> >
>
>
>
> --
> D. Richard Hipp
> d...@sqlite.org
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
John Elrick
Fenestra Technologies
540-868-1377
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Some pieces of the puzzle are coming together

2012-01-19 Thread Richard Hipp
On Thu, Jan 19, 2012 at 7:41 AM, John Elrick wrote:

> Question:
>
> If a query has already been prepared with sqlite3_prepare_v2, why would
> sqlite3_step need to call sqlite3Prepare, which in turn calls
> sqlite3RunParser?
>

Because the database schema changed.  Or because you ran ATTACH or VACUUM,
either of which could potential change the bytecode necessary to run the
statement.  Or, because you changed the authorization callback.



> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Some pieces of the puzzle are coming together

2012-01-19 Thread John Elrick
Question:

If a query has already been prepared with sqlite3_prepare_v2, why would
sqlite3_step need to call sqlite3Prepare, which in turn calls
sqlite3RunParser?
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Is there any API that will return a record based on Primary key.

2012-01-19 Thread Simon Slavin

On 19 Jan 2012, at 10:18am, bhaskarReddy wrote:

>  Is there any SQLite API for returning a record based on particular
> Primary key id.

Bhaskar, time to get a book on SQL and read it.

Simon.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite API for counting number of records in a table.

2012-01-19 Thread Simon Slavin

On 19 Jan 2012, at 9:16am, bhaskarReddy wrote:

>If i execute the command "SELECT COUNT (*) FROM table;" how
> i will get the return value i.e., number of records in the table ?

It is returned from that query just like the results of any other query.  That 
command would return a single row with a single column containing the count.

If you want to test a SQLite command you can't do better than use the sqlite3 
shell tool to try it out and see whether it does what you want:



Simon.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] insert image into db - windows batch

2012-01-19 Thread Larry Brasfield
For grins, and because I like scriptable DB operations, I've modified 
the SQLite shell.c source to make insertion of blobs from files, and 
extraction of blobs to files, work, efficiently, without extra tools and 
without changing the representation.


The relevant section of the shell's help reads:
.blobextract TABLE COLUMN ROW FILENAME ?DB?   Extract DB blob to a
 file. DB defaults to 'main'.  The table, column
 and row specify the alleged blob selected by:
 SELECT column FROM DB.table WHERE rowid = row
.blobreplace TABLE COLUMN ROW FILENAME ?DB?   Replace DB blob with
 file content, like reverse of .blobextract,
 except DB blob must have same size as the file,
 (created via zeroglob(filesize) or equivalent).

In JPSoftware's TCC/LE batchfile language, some code using this facility 
might read:

:: blob_demo.btm ===
@echo off
:: Script for demonstration of SQLite blob I/O
:: Written for TCC/LE by JPSoftware, http://jpsoft.com , (a usable CLI 
shell for Windows).

setlocal
pushd %TEMP%

:: Set some image sources and names for them.
set 
srcimg1=http://i.space.com/images/i/1/i02/supernova-remnant-snr-0509.jpg

set sname1=stardregs
set oname1=supernova-remnant.jpg
set 
srcimg2=http://www.windows2universe.org/earth/Atmosphere/clouds/images/polar_stratospheric_1_big.jpg

set sname2=poleclouds
set oname2=polar-stratosphere-clouds.jpg
set 
srcimg3=http://spaceweather.com/submissions/pics/e/Eric-Schandall-4-Nacreous-Clouds-13.01_1326475532_med.jpg

set sname3=nacreous
set oname3=nacreous-clouds.jpg

if exist DemoBlobIO\stardregs.jpg (cd DemoBlobIO && goto havejpg)
md DemoBlobIO
cd DemoBlobIO
echo Getting JPEGs for blob content.
:: The wget utility is from 
http://sourceforge.net/projects/gnuwin32/files/wget/
do n = 1 to 3 (wget %[srcimg%n] && ren %@filename[%[srcimg%n]] 
%[sname%n].%@ext[%[srcimg%n]])


:havejpg
:: Stuff the JPEGs into a SQLite DB.
echo create table blobstore (rowid int, bag blob, source string); > 
blob_demo.sls

do n = 1 to 3
set shortname=%[sname%n].%@ext[%[srcimg%n]]
set length=%@filesize[%shortname]
echo insert into blobstore values (%n, zeroblob(%length), 
'%[srcimg%n]'); >> blob_demo.sls

echo .blobreplace blobstore bag %n ./%shortname >> blob_demo.sls
enddo
:: Sometime later, perhaps, extract them under new names.
do n = 1 to 3
echo .blobextract blobstore bag %n ./%[oname%n] >> blob_demo.sls
enddo

:: Actually do said stuffing and extracting.
set dbname=bagoblobs.sldb
if exist %dbname del %dbname
:: sqlite3m.exe, a modified version of the sqlite3.exe shell, is in the 
PATH.

sqlite3m -batch %dbname < blob_demo.sls

:: Compare input and output JPEGs, showing correct results or flagging 
bad ones.

do n = 1 to 3
set shortname=%[sname%n].%@ext[%[srcimg%n]]
set extname=%[oname%n]
fc /B /LB1 %shortname %extname >nul
iff ERRORLEVEL != 0 then
 echo JPEG %shortname did not survive blob transmogrification.
else
 start mspaint %extname
endiff
enddo

popd
endlocal
:: ===

This takes 146 lines of new code in shell.c, a little much to post. 
Anyone who is interested in this can decode my email address below and 
ask me for source or the sqlite3m.exe executable.


Cheers,
--
Larry Brasfield
firstinitial.lastn...@something.org
where my computer became something.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] sqlite.net download file

2012-01-19 Thread majorthorburn
>
> majorthorb...@mst-it-services.info wrote:
>>
>> I have tried to install sqlite from what I thought were the correct
>> files
>>
>
> Which files are you referring to?  What site did you download them from?
>
sqlite-netFx40-setup-bundle-x64-2010-1.0.77.0.exe from
system.data.sqlite.org downloads. I am running w7 x64 .net 4.0
>>
>> but have not managed to find the sqlite.net folder that the help file
>> mentions as support for .net.
>>
>
> Which help file mentions this?  Also, I'm not sure what is meant by
> "support for .net".  I can only assume this refers to the managed (or
> mixed-mode) System.Data.SQLite assembly.
>
help file was in system.data.sqlite and file name sqlite.net.chm

I have since discovered that the version of gacutil I have is from SDK 2
so am installing SDK 4 and will try the install using the bundle file
again.
> --
> Joe Mistachkin
>
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>


___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] sqlite.net download file

2012-01-19 Thread Joe Mistachkin

majorthorb...@mst-it-services.info wrote:
> 
> I have tried to install sqlite from what I thought were the correct files
>

Which files are you referring to?  What site did you download them from?

>
> but have not managed to find the sqlite.net folder that the help file
> mentions as support for .net.
>

Which help file mentions this?  Also, I'm not sure what is meant by
"support for .net".  I can only assume this refers to the managed (or
mixed-mode) System.Data.SQLite assembly.

--
Joe Mistachkin

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] sqlite.net download file

2012-01-19 Thread majorthorburn
I have tried to install sqlite from what I thought were the correct files
but have not managed to find the sqlite.net folder that the help file
mentions as support for .net.
Anyone give me a hint please?
Regards, Major.
p.s. Major is my Christian name.

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Library run-time error

2012-01-19 Thread Joe Mistachkin

ASURADA wrote:
> 
> What's the problem. How to fix this problem.
> (I use Visual C++ 2005 on Windows 7 x64)
> 

In your project, please define the _WIN32_WINNT macro to 0x500 and try
again.

--
Joe Mistachkin

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Library run-time error

2012-01-19 Thread Jens Frederich
On Thu, Jan 19, 2012 at 11:40 AM, ASURADA  wrote:
>
> Error Message
> ==
> Unhandled exception at 0x in SQLite3Test.exe: 0xC005: Access
> violation reading location 0x.

Hi, has you build a debug version of your test app and library? Any
stack trace information?

                              Jens
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Library run-time error

2012-01-19 Thread ASURADA
I use sqlite library that is compiled by myself. Because I need static
library and 64bit library.
So I try to make library for version 3.7.10. It was successfully. No error
occur on compile time.
But It was not work. My SQLite library gave me a error message. My code is
fine with 3.7.9.
In case of work with memory db (:memory:), it is fine.

What's the problem. How to fix this problem.
(I use Visual C++ 2005 on Windows 7 x64)

test code
==
:
int rst = sqlite3_open( "e://data.db",  );
:

Error
==
sqlite3.c
35391  if( isNT() ){
35392LPWSTR zTemp;
35393nByte = osGetFullPathNameW((LPCWSTR)zConverted, 0, 0, 0) + 3; <<
Error occurred Line
35394zTemp = sqlite3_malloc( nByte*sizeof(zTemp[0]) );

Error Message
==
Unhandled exception at 0x in SQLite3Test.exe: 0xC005: Access
violation reading location 0x.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Collecting return values from sql commands using SQLite APIs.

2012-01-19 Thread Max Vlasov
On Thu, Jan 19, 2012 at 1:49 PM, bhaskarReddy  wrote:

>
> Hi Friends,
>
>   is it possible to collect return value of a SQL command. ex:
> SELECT COUNT(*) FROM table;  will return number of records in a table. Is
> there any SQLite API to return this value.
>
>
It's the same api that returns values for
  SELECT * FROM table;
Only for Count(*) you result is one row and one column

Max
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Is there any API that will return a record based on Primary key.

2012-01-19 Thread bhaskarReddy

HI Friends,

  Is there any SQLite API for returning a record based on particular
Primary key id.

Regards,
Bhaskar Reddy.
-- 
View this message in context: 
http://old.nabble.com/Is-there-any-API-that-will-return-a-record-based-on-Primary-key.-tp33166831p33166831.html
Sent from the SQLite mailing list archive at Nabble.com.

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Collecting return values from sql commands using SQLite APIs.

2012-01-19 Thread bhaskarReddy

Hi Friends,

   is it possible to collect return value of a SQL command. ex:
SELECT COUNT(*) FROM table;  will return number of records in a table. Is
there any SQLite API to return this value.

Regards,
Bhaskar Reddy. 
 
  
-- 
View this message in context: 
http://old.nabble.com/Collecting-return-values-from-sql-commands-using-SQLite-APIs.-tp33166706p33166706.html
Sent from the SQLite mailing list archive at Nabble.com.

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite API for counting number of records in a table.

2012-01-19 Thread bhaskarReddy

Hi Binns,

If i execute the command "SELECT COUNT (*) FROM table;" how
i will get the return value i.e., number of records in the table ?

Regards,
BhaskarReddy





Roger Binns wrote:
> 
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> On 18/01/12 23:47, bhaskarReddy wrote:
>> Is there an SQLite API for counting number of records in a table.
> 
> No, but that is because regular SQL will do the trick:
> 
>SELECT COUNT(*) FROM table;
> 
> Roger
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.11 (GNU/Linux)
> 
> iEYEARECAAYFAk8Xy+QACgkQmOOfHg372QSJsgCgmzxiQMxaQPz+PkTZvLmvhE0h
> R+kAn0G547GDzO1OrPf8Cn9b+d670WAr
> =hEiw
> -END PGP SIGNATURE-
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
> 

-- 
View this message in context: 
http://old.nabble.com/SQLite-API-for-counting-number-of-records-in-a-table.-tp33166164p33166535.html
Sent from the SQLite mailing list archive at Nabble.com.

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] insert image into db - windows batch

2012-01-19 Thread Petr Lázňovský


> On Thu, Jan 19, 2012 at 1:49 AM, Kevin Benson wrote:

>>  On Wed, Jan 18, 2012 at 8:16 PM, Simon Slavin wrote:


>>> On 18 Jan 2012, at 11:13pm, Petr Lázňovský wrote:

>>> > Look like script for different platform, but "od" and "tr" are
>>> available also for Win so I will try...

>>> I would probably look for a Windows version of 'hexdump'.

>>> Simon.
>>>  ___



>> ...or maybe | xxd.exe | which seems to have a parameter to also "reverse"
>> the operation:

>> http://code.google.com/p/unix-cmd-win32/downloads/detail?name=xxd.exe

>> --
>>--
>>   --
>>  --ô¿ô--
>> K e V i N




> Another possibility is the Swiss File Knife utility which has a command for
> conversion and back:

> http://www.portablefreeware.com/forums/viewtopic.php?p=28023=fb6c6562cfe85a8ac7ecd8dd0b954cf9#p28023

I know this, but this tool is too big to packing inside of batch, xxd (35kb) is 
ten times smaller compare to sfk (370kb).



___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users