Sqlite conversion problem

When I use the sqlite3_column_blob function it converts my date which is in a LONG format into a string format. It basically converts my time in the database to a string. I need to return data as it is without any conversions how can I do this?

I also do not want to use the sqlite3_column_int function ect because I am writing a database wrapper which uses a union

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
struct Column
{
    std::string colName;
    union DATA
    {
        char datac[512];
        unsigned int dataui;
    } data;
};

class Record
{
public:
    Column getColumn(std::string colName);
    std::vector<Column> columns;
};

class Database
{
    public:
        Database();
        virtual ~Database();
        bool open(const char* filename);
        bool execute(const char *query);
        Record getRecord(const char* query);
        void create();
        char* getErrMsg();
        void close();
    protected:
        sqlite3* db;
        char* zErrMsg;
        sqlite3_stmt* stmt;
        int rc;
    private:
};


I need to read the data into the datac array as raw bytes without any conversions.
Last edited on
it converts my date which is in a LONG format into a string format.
I'd assume that it is not a conversion. These basic types are stored as string.

Times can be stored as 3 types.
https://www.sqlite.org/datatype3.html#datetime

I also do not want to use the sqlite3_column_int function ect because I am writing a database wrapper which uses a union
You have a union without a tag. How are you going to tell which field is active?
Last edited on
sqlite3 is the problem the sqlite3_column_blob is converting all data into characters. I retrieved the time from a database which was set as a LONG and sqlite3 converted it to the character equivalent

1
2
0x1efedd0: 31 34 30 34 33 35 39 37|38 39 00 00 05 00 00 00    1404359789......
0x1efede0: 0d f0 ad ba 0d f0 ad ba|0d f0 ad ba 0d f0 ad ba    .ð­º.ð­º.ð­º.ð­º 


Does anyone know a way to stop sqlite3 from doing these conversions. All I want to do is return a pointer to the physical bytes. I don't want these conversions that sqlite3 is doing.
Last edited on
bump
Why are you calling sqlite3_column_blob()?
I am just asking if anyone knows how to get it. I could call other functions to get the data too mate. All I want to know is if their is a was to return a pointer to the physical data. I don't want any automatic int to character conversions and stuff like that.
Topic archived. No new replies allowed.