Re: [sqlite] Preserving column size

2010-03-30 Thread Kevin M.
> Sorry I misunderstood your requirement, Kevin. I was focusing on the >singular "a table" and "the table" in your original post, versus the plural > "many types of structs". I thought you were looking for serialization > approach. > Regards > Tim Romano Ah, now I see from where the

Re: [sqlite] Preserving column size

2010-03-30 Thread Tim Romano
> From: Tim Romano <tim.romano...@gmail.com> > To: General Discussion of SQLite Database <sqlite-users@sqlite.org> > Sent: Tue, March 30, 2010 7:28:16 AM > Subject: Re: [sqlite] Preserving column size > > On Tue, Mar 30, 2010 at 4:30 AM, Jean-Denis Muys <jdm...@kleegroup.

Re: [sqlite] Preserving column size

2010-03-30 Thread Kevin M.
28:16 AM Subject: Re: [sqlite] Preserving column size On Tue, Mar 30, 2010 at 4:30 AM, Jean-Denis Muys <jdm...@kleegroup.com>wrote: > > > See http://www.boost.org and more specifically: > http://www.boost.org/doc/libs/1_42_0/libs/serialization/doc/index.html >

Re: [sqlite] Preserving column size

2010-03-30 Thread Tim Romano
On Tue, Mar 30, 2010 at 4:30 AM, Jean-Denis Muys wrote: > > > See http://www.boost.org and more specifically: > http://www.boost.org/doc/libs/1_42_0/libs/serialization/doc/index.html > > The OP's question is another form of this question: What's the best way to violate

Re: [sqlite] Preserving column size

2010-03-30 Thread Jean-Denis Muys
On 3/29/10 23:10 , "Tim Romano" wrote: > On 3/29/2010 4:19 PM, Kevin M. wrote: >> I have a C/C++ application in which I want to store data from a struct into a >> table (using SQLite 3.6.23) and later retrieve data from the table and store >> it back in the struct. But, I

Re: [sqlite] Preserving column size

2010-03-29 Thread Tim Romano
On 3/29/2010 4:19 PM, Kevin M. wrote: > I have a C/C++ application in which I want to store data from a struct into a > table (using SQLite 3.6.23) and later retrieve data from the table and store > it back in the struct. But, I need a general interface for this as there are > many types of

Re: [sqlite] Preserving column size

2010-03-29 Thread Dan Bishop
Kevin M. wrote: > I have a C/C++ application in which I want to store data from a struct into a > table (using SQLite 3.6.23) and later retrieve data from the table and store > it back in the struct. But, I need a general interface for this as there are > many types of structs used. So, what

Re: [sqlite] Preserving column size

2010-03-29 Thread Jay A. Kreibich
On Mon, Mar 29, 2010 at 02:01:42PM -0700, Kevin M. scratched on the wall: > > Can't you just store the struct as a blob and be done with it? > > No, I can't use a blob because there are other queries where I want > individual columns. Storing to and from a struct is only one part > of the

Re: [sqlite] Preserving column size

2010-03-29 Thread Kevin M.
> I'm confused. Do you, or don't you, want to use type names like INT1 or INT2 > to indicate the width in bytes of an integer field? If you do, you can act on > them yourself using sqlite3_column_decltype. If you don't, the question > remains: how do you plan to indicate the width of the field?

Re: [sqlite] Preserving column size

2010-03-29 Thread P Kishor
On Mon, Mar 29, 2010 at 4:14 PM, Tim Romano wrote: > On Mon, Mar 29, 2010 at 4:19 PM, Kevin M. wrote: > >> I have a C/C++ application in which I want to store data from a struct into >> a table (using SQLite 3.6.23) and later retrieve data from the

Re: [sqlite] Preserving column size

2010-03-29 Thread Tim Romano
On Mon, Mar 29, 2010 at 4:19 PM, Kevin M. wrote: > I have a C/C++ application in which I want to store data from a struct into > a table (using SQLite 3.6.23) and later retrieve data from the table and > store it back in the struct. But, I need a general interface for this

Re: [sqlite] Preserving column size

2010-03-29 Thread Igor Tandetnik
Kevin M. wrote: >> Why is 99 a 16-bit integer value and not, say, an 8-bit or a 32-bit >> one? How is SQLite supposed to know? > > How would SQLite know if "99" is 16-bit, 8-bit, 32-bit, etc... using > the CREATE TABLE specified data types as a hint. INT1, INT2 and so on

Re: [sqlite] Preserving column size

2010-03-29 Thread D. Richard Hipp
On Mar 29, 2010, at 4:19 PM, Kevin M. wrote: > > However, this method breaks down if a store a 16-bit integer value > like "99" and SQLite stores it internally as an 8-bit value (to save > space) and subsequently retrieves it and gives me a value of 1 for > sqlite3_column_bytes(). I think

Re: [sqlite] Preserving column size

2010-03-29 Thread Kevin M.
> Can't you just store the struct as a blob and be done with it? No, I can't use a blob because there are other queries where I want individual columns. Storing to and from a struct is only one part of the application. Sorry, perhaps I should have specified that too. > Why is 99 a 16-bit

Re: [sqlite] Preserving column size

2010-03-29 Thread Pavel Ivanov
> So, is there a way I can tell SQLite to preserve the data size in a > particular column? As long as you use blobs to store your structs, yes you can tell SQLite to preserve data size. You cannot do that for any other type, but it sounds like you don't need any other type because all you need

Re: [sqlite] Preserving column size

2010-03-29 Thread Igor Tandetnik
Kevin M. wrote: > I have a C/C++ application in which I want to store data from a > struct into a table (using SQLite 3.6.23) and later retrieve data > from the table and store it back in the struct. But, I need a > general interface for this as there are many types of

[sqlite] Preserving column size

2010-03-29 Thread Kevin M.
I have a C/C++ application in which I want to store data from a struct into a table (using SQLite 3.6.23) and later retrieve data from the table and store it back in the struct. But, I need a general interface for this as there are many types of structs used. So, what I have is a function