Re: [sqlite] Preserving column size

2010-03-30 Thread Jean-Denis Muys
On 3/29/10 23:10 , Tim Romano tim.rom...@yahoo.com 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 need a

Re: [sqlite] Preserving column size

2010-03-30 Thread Tim Romano
On Tue, Mar 30, 2010 at 4:30 AM, Jean-Denis Muys jdm...@kleegroup.comwrote: snip See http://www.boost.org and more specifically: http://www.boost.org/doc/libs/1_42_0/libs/serialization/doc/index.html snip 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 Kevin M.
: [sqlite] Preserving column size On Tue, Mar 30, 2010 at 4:30 AM, Jean-Denis Muys jdm...@kleegroup.comwrote: snip See http://www.boost.org and more specifically: http://www.boost.org/doc/libs/1_42_0/libs/serialization/doc/index.html snip The OP's question is another form of this question

Re: [sqlite] Preserving column size

2010-03-30 Thread Tim Romano
:16 AM Subject: Re: [sqlite] Preserving column size On Tue, Mar 30, 2010 at 4:30 AM, Jean-Denis Muys jdm...@kleegroup.com wrote: snip See http://www.boost.org and more specifically: http://www.boost.org/doc/libs/1_42_0/libs/serialization/doc/index.html snip The OP's question

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 misunderstanding

[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

Re: [sqlite] Preserving column size

2010-03-29 Thread Igor Tandetnik
Kevin M. athlo...@yahoo.com 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

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 is

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 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 you are

Re: [sqlite] Preserving column size

2010-03-29 Thread Igor Tandetnik
Kevin M. athlo...@yahoo.com 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 don't have

Re: [sqlite] Preserving column size

2010-03-29 Thread Tim Romano
On Mon, Mar 29, 2010 at 4:19 PM, Kevin M. athlo...@yahoo.com 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

Re: [sqlite] Preserving column size

2010-03-29 Thread P Kishor
On Mon, Mar 29, 2010 at 4:14 PM, Tim Romano tim.romano...@gmail.com wrote: On Mon, Mar 29, 2010 at 4:19 PM, Kevin M. athlo...@yahoo.com 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

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 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 application.

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 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