Re: [sqlite] Expose struct Mem and struct Vdbe to other application

2014-09-23 Thread James K. Lowden
On Tue, 23 Sep 2014 14:12:19 -0500
"dave"  wrote:

> sounds like you are trying to 'bind' your column buffers once for
> the statement, sort of like we do with, say ODBC. (and sort of like
> we do in sqlite for parameters).  To wit there is not a means of
> doing that, but are you sure these column calls are costly?  

There's no reason (not that you're suggesting there is) to expect that
those calls are costly.  Bound columns a la ODBC exact the very same
price: conversion from the internal "native" form to that of the
application's variable.  

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


Re: [sqlite] Expose struct Mem and struct Vdbe to other application

2014-09-23 Thread dave
I sounds like you are trying to 'bind' your column buffers once for the
statement, sort of like we do with, say ODBC. (and sort of like we do in
sqlite for parameters).  To wit there is not a means of doing that, but are
you sure these column calls are costly?  If you really wanted to experiment
with it, maybe look in the implementation of the various sqlite_column_xxx
functions to see how they get their data out of the record's in-page image,
since you'd be ostensibly doing the same.  I suspect this will be not as
much fun as you would like, because there's datatype conversion and whatnot,
rather than simply fetching a pointer to the record image in memory.  But it
will be intersting to hear back what you find out, and if there is any
performance gain to be had from a bound buffer approach.

If you really want to bind for implementationally stylistic reasons, and
considering that sqlite_column functions 'do things' beyond returning a
pointer to the place in the image, maybe you can make your own binding
object that holds a pointer to your bound buffer, and knows the correct type
(maybe via template specializations?), and has a virtual method (say,
'transfer())to call the right sqlite_column functions by type.  Then your
record binding would be a vector of those, and you could wrap sqlite_step()
to additionally invoke all transfer() methods.

Have fun hacking!

-dave

> -Original Message-
> From: sqlite-users-boun...@sqlite.org 
> [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Prakash 
> Premkumar
> Sent: Monday, September 22, 2014 11:29 PM
> To: General Discussion of SQLite Database
> Subject: Re: [sqlite] Expose struct Mem and struct Vdbe to 
> other application
> 
> 
> Thanks a lot for your reply Hick.
> I'm trying to split the results of joins. I have one struct 
> per table and
> if I am joining 3 tables, I would like to fill the objects of the
> respective structs with the values from the ResultSet in Vdbe 
> pResultSet
> and I want to do it before the callback(interface for the external
> applications) is called
> Is there are a way , other than using the sqlite_column_ 
> functions, since I
> have to make one function call per column, it is very costly.
> Can I not expose the Vdbe and Mem structs by placing it in 
> sqlite3.h file
> like struct sqlite3,which is exposed that way ?
> 
> Thanks
> Prakash
> 
> On Mon, Sep 22, 2014 at 8:38 PM, Hick Gunter <h...@scigames.at> wrote:
> 
> > Use the sqlite3_column_ functions to return result fields...
> >
> > Or you need to use the non-amalgamation sources and 
> integrate them into
> > your build environment. Such use is probably strongly 
> discouraged by SQLite
> > developers, as the internal structures are subject to change without
> > notice. Also, a given VDBE Program implements EXACTLY the 
> SQL query it was
> > prepared with and works only with EXACTLY the schema it was prepared
> > against.
> >
> > Are you trying to implement "stored procedures"?
> >
> > -Ursprüngliche Nachricht-
> > Von: Prakash Premkumar [mailto:prakash.p...@gmail.com]
> > Gesendet: Montag, 22. September 2014 15:37
> > An: General Discussion of SQLite Database
> > Betreff: [sqlite] Expose struct Mem and struct Vdbe to 
> other application
> >
> > Hi,
> >
> > Let's assume I am writing a c code which directly invokes 
> the sqlite_step
> > statement.
> > After the execution of the statement, I would like to access the
> > pResultRow of Vdbe (which obtained by pVbe = (Vdbe*) pStmt ).
> >
> > How can I expose the struct Vdbe,Mem and the likes to external
> > applications.
> > Including them in the header file gave me the error 
> "incomplete defintion
> > of struct"
> >
> > Can you kindly help me?
> >
> > Thanks
> > Prakash
> > ___
> > sqlite-users mailing list
> > sqlite-users@sqlite.org
> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> >
> >
> > ___
> >  Gunter Hick
> > Software Engineer
> > Scientific Games International GmbH
> > FN 157284 a, HG Wien
> > Klitschgasse 2-4, A-1130 Vienna, Austria
> > Tel: +43 1 80100 0
> > E-Mail: h...@scigames.at
> >
> > This communication (including any attachments) is intended 
> for the use of
> > the intended recipient(s) only and may contain information that is
> > confidential, privileged or legally protected. Any 
> unauthorized use or
> > dissemination of this communication is strictly prohibited. 
> If you have
> > received this communication in error, please 

Re: [sqlite] Expose struct Mem and struct Vdbe to other application

2014-09-23 Thread Simon Slavin

On 23 Sep 2014, at 8:25am, Prakash Premkumar  wrote:

> Thanks a lot for your opinion Hick. But the act of exposing struct Vdbe
> should be simple right. It's there sitting on my source code

Not really.  It's there in someone else's source code.  You're just compiling 
that source code in your program.

> and my
> application needs to access it, just like it can access struct sqlite3

Your application should not be accessing the parts of a struct sqlite3.  In 
fact it shouldn't even know it's a struct.  You're meant to declare variables 
of type 'sqlite3' and pass them around from one function to another without 
knowing what's in them.

> Can
> you kindly tell me how that can be done ?

There's a comment near the top of the source file 'vdbe.h' where it says

/*
** A single VDBE is an opaque structure named "Vdbe".  Only routines
** in the source file sqliteVdbe.c are allowed to see the insides
** of this structure.
*/
typedef struct Vdbe Vdbe;

Emphasis on the word 'opaque'.  Also, future versions of sqlite3 may change the 
structure without warning.  If you try to get at the internals of how SQLite 
works you are going to have to learn ten times as much about SQLite as if you 
were just going to use the documented functions listed in



and the fact that you needed to ask where those variable types were defined 
suggests that you may not be ready to do that just yet.

Can you not do what you need to do using just the functions documented in the 
above page ?  Can you describe to us what you are trying to do in terms of your 
program's requirements rather than in terms of how you think SQLite works ?

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


Re: [sqlite] Expose struct Mem and struct Vdbe to other application

2014-09-23 Thread Hick Gunter
Just like any other definition provided in a .h file...

If you have the amalgamation sources (just a sqlite3.c and sqlite3.h file) you 
need to either split sqlite3.c into its component files or download the 
component files directly. Or maybe just extract the vdbeint.h file.

Such practices are not encouraged by the SQLite Dev team.

-Ursprüngliche Nachricht-
Von: Prakash Premkumar [mailto:prakash.p...@gmail.com]
Gesendet: Dienstag, 23. September 2014 09:25
An: General Discussion of SQLite Database
Betreff: Re: [sqlite] Expose struct Mem and struct Vdbe to other application

Thanks a lot for your opinion Hick. But the act of exposing struct Vdbe should 
be simple right. It's there sitting on my source code and my application needs 
to access it, just like it can access struct sqlite3. Can you kindly tell me 
how that can be done ?


P.S. I am almost always going to compile my application along with sqlite 
source code.

Thanks
Prakash

On Tue, Sep 23, 2014 at 11:54 AM, Hick Gunter <h...@scigames.at> wrote:

> IMHO you are going down a dark and dangerous passage. If your approach
> really does require severe hacking of SQLite internals then maybe that
> is an indication that you really need to change the approach or
> acquire a different tool. Maybe you are trying to nail it with a set of 
> pliers.
> Doable, but not as neat as using a hammer in the first place, and also
> hard on the pliers.
>
> -Ursprüngliche Nachricht-
> Von: Prakash Premkumar [mailto:prakash.p...@gmail.com]
> Gesendet: Dienstag, 23. September 2014 06:29
> An: General Discussion of SQLite Database
> Betreff: Re: [sqlite] Expose struct Mem and struct Vdbe to other
> application
>
> Thanks a lot for your reply Hick.
> I'm trying to split the results of joins. I have one struct per table
> and if I am joining 3 tables, I would like to fill the objects of the
> respective structs with the values from the ResultSet in Vdbe
> pResultSet and I want to do it before the callback(interface for the
> external
> applications) is called
> Is there are a way , other than using the sqlite_column_ functions,
> since I have to make one function call per column, it is very costly.
> Can I not expose the Vdbe and Mem structs by placing it in sqlite3.h
> file like struct sqlite3,which is exposed that way ?
>
> Thanks
> Prakash
>
> On Mon, Sep 22, 2014 at 8:38 PM, Hick Gunter <h...@scigames.at> wrote:
>
> > Use the sqlite3_column_ functions to return result fields...
> >
> > Or you need to use the non-amalgamation sources and integrate them
> > into your build environment. Such use is probably strongly
> > discouraged by SQLite developers, as the internal structures are
> > subject to change without notice. Also, a given VDBE Program
> > implements EXACTLY the SQL query it was prepared with and works only
> > with EXACTLY the schema it was prepared against.
> >
> > Are you trying to implement "stored procedures"?
> >
> > -Ursprüngliche Nachricht-
> > Von: Prakash Premkumar [mailto:prakash.p...@gmail.com]
> > Gesendet: Montag, 22. September 2014 15:37
> > An: General Discussion of SQLite Database
> > Betreff: [sqlite] Expose struct Mem and struct Vdbe to other
> > application
> >
> > Hi,
> >
> > Let's assume I am writing a c code which directly invokes the
> > sqlite_step statement.
> > After the execution of the statement, I would like to access the
> > pResultRow of Vdbe (which obtained by pVbe = (Vdbe*) pStmt ).
> >
> > How can I expose the struct Vdbe,Mem and the likes to external
> > applications.
> > Including them in the header file gave me the error "incomplete
> > defintion of struct"
> >
> > Can you kindly help me?
> >
> > Thanks
> > Prakash
> > ___
> > sqlite-users mailing list
> > sqlite-users@sqlite.org
> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> >
> >
> > ___
> >  Gunter Hick
> > Software Engineer
> > Scientific Games International GmbH
> > FN 157284 a, HG Wien
> > Klitschgasse 2-4, A-1130 Vienna, Austria
> > Tel: +43 1 80100 0
> > E-Mail: h...@scigames.at
> >
> > This communication (including any attachments) is intended for the
> > use of the intended recipient(s) only and may contain information
> > that is confidential, privileged or legally protected. Any
> > unauthorized use or dissemination of this communication is strictly
> > prohibited. If you have received this communication in error, please
> > immediately notify the sender by return

Re: [sqlite] Expose struct Mem and struct Vdbe to other application

2014-09-23 Thread Prakash Premkumar
Thanks a lot for your opinion Hick. But the act of exposing struct Vdbe
should be simple right. It's there sitting on my source code and my
application needs to access it, just like it can access struct sqlite3. Can
you kindly tell me how that can be done ?


P.S. I am almost always going to compile my application along with sqlite
source code.

Thanks
Prakash

On Tue, Sep 23, 2014 at 11:54 AM, Hick Gunter <h...@scigames.at> wrote:

> IMHO you are going down a dark and dangerous passage. If your approach
> really does require severe hacking of SQLite internals then maybe that is
> an indication that you really need to change the approach or acquire a
> different tool. Maybe you are trying to nail it with a set of pliers.
> Doable, but not as neat as using a hammer in the first place, and also hard
> on the pliers.
>
> -Ursprüngliche Nachricht-
> Von: Prakash Premkumar [mailto:prakash.p...@gmail.com]
> Gesendet: Dienstag, 23. September 2014 06:29
> An: General Discussion of SQLite Database
> Betreff: Re: [sqlite] Expose struct Mem and struct Vdbe to other
> application
>
> Thanks a lot for your reply Hick.
> I'm trying to split the results of joins. I have one struct per table and
> if I am joining 3 tables, I would like to fill the objects of the
> respective structs with the values from the ResultSet in Vdbe pResultSet
> and I want to do it before the callback(interface for the external
> applications) is called
> Is there are a way , other than using the sqlite_column_ functions, since
> I have to make one function call per column, it is very costly.
> Can I not expose the Vdbe and Mem structs by placing it in sqlite3.h file
> like struct sqlite3,which is exposed that way ?
>
> Thanks
> Prakash
>
> On Mon, Sep 22, 2014 at 8:38 PM, Hick Gunter <h...@scigames.at> wrote:
>
> > Use the sqlite3_column_ functions to return result fields...
> >
> > Or you need to use the non-amalgamation sources and integrate them
> > into your build environment. Such use is probably strongly discouraged
> > by SQLite developers, as the internal structures are subject to change
> > without notice. Also, a given VDBE Program implements EXACTLY the SQL
> > query it was prepared with and works only with EXACTLY the schema it
> > was prepared against.
> >
> > Are you trying to implement "stored procedures"?
> >
> > -Ursprüngliche Nachricht-
> > Von: Prakash Premkumar [mailto:prakash.p...@gmail.com]
> > Gesendet: Montag, 22. September 2014 15:37
> > An: General Discussion of SQLite Database
> > Betreff: [sqlite] Expose struct Mem and struct Vdbe to other
> > application
> >
> > Hi,
> >
> > Let's assume I am writing a c code which directly invokes the
> > sqlite_step statement.
> > After the execution of the statement, I would like to access the
> > pResultRow of Vdbe (which obtained by pVbe = (Vdbe*) pStmt ).
> >
> > How can I expose the struct Vdbe,Mem and the likes to external
> > applications.
> > Including them in the header file gave me the error "incomplete
> > defintion of struct"
> >
> > Can you kindly help me?
> >
> > Thanks
> > Prakash
> > ___
> > sqlite-users mailing list
> > sqlite-users@sqlite.org
> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> >
> >
> > ___
> >  Gunter Hick
> > Software Engineer
> > Scientific Games International GmbH
> > FN 157284 a, HG Wien
> > Klitschgasse 2-4, A-1130 Vienna, Austria
> > Tel: +43 1 80100 0
> > E-Mail: h...@scigames.at
> >
> > This communication (including any attachments) is intended for the use
> > of the intended recipient(s) only and may contain information that is
> > confidential, privileged or legally protected. Any unauthorized use or
> > dissemination of this communication is strictly prohibited. If you
> > have received this communication in error, please immediately notify
> > the sender by return e-mail message and delete all copies of the
> > original communication. Thank you for your cooperation.
> >
> >
> > ___
> > 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
>
>
> ___
>  Gunter Hick
> Software Engineer
> Sc

Re: [sqlite] Expose struct Mem and struct Vdbe to other application

2014-09-23 Thread Hick Gunter
IMHO you are going down a dark and dangerous passage. If your approach really 
does require severe hacking of SQLite internals then maybe that is an 
indication that you really need to change the approach or acquire a different 
tool. Maybe you are trying to nail it with a set of pliers. Doable, but not as 
neat as using a hammer in the first place, and also hard on the pliers.

-Ursprüngliche Nachricht-
Von: Prakash Premkumar [mailto:prakash.p...@gmail.com]
Gesendet: Dienstag, 23. September 2014 06:29
An: General Discussion of SQLite Database
Betreff: Re: [sqlite] Expose struct Mem and struct Vdbe to other application

Thanks a lot for your reply Hick.
I'm trying to split the results of joins. I have one struct per table and if I 
am joining 3 tables, I would like to fill the objects of the respective structs 
with the values from the ResultSet in Vdbe pResultSet and I want to do it 
before the callback(interface for the external
applications) is called
Is there are a way , other than using the sqlite_column_ functions, since I 
have to make one function call per column, it is very costly.
Can I not expose the Vdbe and Mem structs by placing it in sqlite3.h file like 
struct sqlite3,which is exposed that way ?

Thanks
Prakash

On Mon, Sep 22, 2014 at 8:38 PM, Hick Gunter <h...@scigames.at> wrote:

> Use the sqlite3_column_ functions to return result fields...
>
> Or you need to use the non-amalgamation sources and integrate them
> into your build environment. Such use is probably strongly discouraged
> by SQLite developers, as the internal structures are subject to change
> without notice. Also, a given VDBE Program implements EXACTLY the SQL
> query it was prepared with and works only with EXACTLY the schema it
> was prepared against.
>
> Are you trying to implement "stored procedures"?
>
> -Ursprüngliche Nachricht-
> Von: Prakash Premkumar [mailto:prakash.p...@gmail.com]
> Gesendet: Montag, 22. September 2014 15:37
> An: General Discussion of SQLite Database
> Betreff: [sqlite] Expose struct Mem and struct Vdbe to other
> application
>
> Hi,
>
> Let's assume I am writing a c code which directly invokes the
> sqlite_step statement.
> After the execution of the statement, I would like to access the
> pResultRow of Vdbe (which obtained by pVbe = (Vdbe*) pStmt ).
>
> How can I expose the struct Vdbe,Mem and the likes to external
> applications.
> Including them in the header file gave me the error "incomplete
> defintion of struct"
>
> Can you kindly help me?
>
> Thanks
> Prakash
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
>
> ___
>  Gunter Hick
> Software Engineer
> Scientific Games International GmbH
> FN 157284 a, HG Wien
> Klitschgasse 2-4, A-1130 Vienna, Austria
> Tel: +43 1 80100 0
> E-Mail: h...@scigames.at
>
> This communication (including any attachments) is intended for the use
> of the intended recipient(s) only and may contain information that is
> confidential, privileged or legally protected. Any unauthorized use or
> dissemination of this communication is strictly prohibited. If you
> have received this communication in error, please immediately notify
> the sender by return e-mail message and delete all copies of the
> original communication. Thank you for your cooperation.
>
>
> ___
> 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


___
 Gunter Hick
Software Engineer
Scientific Games International GmbH
FN 157284 a, HG Wien
Klitschgasse 2-4, A-1130 Vienna, Austria
Tel: +43 1 80100 0
E-Mail: h...@scigames.at

This communication (including any attachments) is intended for the use of the 
intended recipient(s) only and may contain information that is confidential, 
privileged or legally protected. Any unauthorized use or dissemination of this 
communication is strictly prohibited. If you have received this communication 
in error, please immediately notify the sender by return e-mail message and 
delete all copies of the original communication. Thank you for your cooperation.


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


Re: [sqlite] Expose struct Mem and struct Vdbe to other application

2014-09-22 Thread Prakash Premkumar
Thanks a lot for your reply Hick.
I'm trying to split the results of joins. I have one struct per table and
if I am joining 3 tables, I would like to fill the objects of the
respective structs with the values from the ResultSet in Vdbe pResultSet
and I want to do it before the callback(interface for the external
applications) is called
Is there are a way , other than using the sqlite_column_ functions, since I
have to make one function call per column, it is very costly.
Can I not expose the Vdbe and Mem structs by placing it in sqlite3.h file
like struct sqlite3,which is exposed that way ?

Thanks
Prakash

On Mon, Sep 22, 2014 at 8:38 PM, Hick Gunter  wrote:

> Use the sqlite3_column_ functions to return result fields...
>
> Or you need to use the non-amalgamation sources and integrate them into
> your build environment. Such use is probably strongly discouraged by SQLite
> developers, as the internal structures are subject to change without
> notice. Also, a given VDBE Program implements EXACTLY the SQL query it was
> prepared with and works only with EXACTLY the schema it was prepared
> against.
>
> Are you trying to implement "stored procedures"?
>
> -Ursprüngliche Nachricht-
> Von: Prakash Premkumar [mailto:prakash.p...@gmail.com]
> Gesendet: Montag, 22. September 2014 15:37
> An: General Discussion of SQLite Database
> Betreff: [sqlite] Expose struct Mem and struct Vdbe to other application
>
> Hi,
>
> Let's assume I am writing a c code which directly invokes the sqlite_step
> statement.
> After the execution of the statement, I would like to access the
> pResultRow of Vdbe (which obtained by pVbe = (Vdbe*) pStmt ).
>
> How can I expose the struct Vdbe,Mem and the likes to external
> applications.
> Including them in the header file gave me the error "incomplete defintion
> of struct"
>
> Can you kindly help me?
>
> Thanks
> Prakash
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
>
> ___
>  Gunter Hick
> Software Engineer
> Scientific Games International GmbH
> FN 157284 a, HG Wien
> Klitschgasse 2-4, A-1130 Vienna, Austria
> Tel: +43 1 80100 0
> E-Mail: h...@scigames.at
>
> This communication (including any attachments) is intended for the use of
> the intended recipient(s) only and may contain information that is
> confidential, privileged or legally protected. Any unauthorized use or
> dissemination of this communication is strictly prohibited. If you have
> received this communication in error, please immediately notify the sender
> by return e-mail message and delete all copies of the original
> communication. Thank you for your cooperation.
>
>
> ___
> 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] Expose struct Mem and struct Vdbe to other application

2014-09-22 Thread Hick Gunter
Use the sqlite3_column_ functions to return result fields...

Or you need to use the non-amalgamation sources and integrate them into your 
build environment. Such use is probably strongly discouraged by SQLite 
developers, as the internal structures are subject to change without notice. 
Also, a given VDBE Program implements EXACTLY the SQL query it was prepared 
with and works only with EXACTLY the schema it was prepared against.

Are you trying to implement "stored procedures"?

-Ursprüngliche Nachricht-
Von: Prakash Premkumar [mailto:prakash.p...@gmail.com]
Gesendet: Montag, 22. September 2014 15:37
An: General Discussion of SQLite Database
Betreff: [sqlite] Expose struct Mem and struct Vdbe to other application

Hi,

Let's assume I am writing a c code which directly invokes the sqlite_step 
statement.
After the execution of the statement, I would like to access the pResultRow of 
Vdbe (which obtained by pVbe = (Vdbe*) pStmt ).

How can I expose the struct Vdbe,Mem and the likes to external applications.
Including them in the header file gave me the error "incomplete defintion of 
struct"

Can you kindly help me?

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


___
 Gunter Hick
Software Engineer
Scientific Games International GmbH
FN 157284 a, HG Wien
Klitschgasse 2-4, A-1130 Vienna, Austria
Tel: +43 1 80100 0
E-Mail: h...@scigames.at

This communication (including any attachments) is intended for the use of the 
intended recipient(s) only and may contain information that is confidential, 
privileged or legally protected. Any unauthorized use or dissemination of this 
communication is strictly prohibited. If you have received this communication 
in error, please immediately notify the sender by return e-mail message and 
delete all copies of the original communication. Thank you for your cooperation.


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