R: Question about wxDbTable.SetColDefs()

Ruizhi Ye yeruizhi at gmail.com
Tue Jun 5 18:20:46 PDT 2007


Thank Baldo.

I did not konw there was a "SQL_C_BINARY" type. In the manuals web
page of wxDbTable, I can only find:  (wxWidgets 2.8.3)
----------------------------------------------------------------------
cType
SQL C Type. This defines the data type that the SQL representation of
the data is converted to to be stored in pData. Other valid types are
available also, but these are the most common ones:

    SQL_C_CHAR      // string - deprecated: use SQL_C_WXCHAR
    SQL_C_WXCHAR    // string - Used transparently in unicode or
non-unicode builds
    SQL_C_LONG
    SQL_C_ULONG
    SQL_C_SHORT
    SQL_C_USHORT
    SQL_C_FLOAT
    SQL_C_DOUBLE
    SQL_C_NUMERIC
    SQL_C_TIMESTAMP

    SQL_C_BOOLEAN   // defined in db.h
    SQL_C_ENUM      // defined in db.h
----------------------------------------------------------------------
Maybe this part should be updated.

Thanks again. Nice day~

On 6/6/07, Baldassarre Cesarano <baldassarre.cesarano at eunics.it> wrote:
> Hi,
> For read/write a blob try this:
>
> ....
> Long    m_Data[100];
> ....
> m_tbPerson->SetColDefs(16, wxT("data"), DB_DATA_TYPE_BLOB, m_Data,
> SQL_C_BINARY, sizeof(m_Data), false, true);
> ..................
>
>
> Please note also: the 7th parameter (false) is for key fields
>                the 8th par. (true) is for an updateable field (writing)!!!!
>
> Ciao
>        Baldo
>
>
> -----Messaggio originale-----
> Da: Ruizhi Ye [mailto:yeruizhi at gmail.com]
> Inviato: martedì 5 giugno 2007 18.18
> A: wx-users at lists.wxwidgets.org
> Oggetto: Question about wxDbTable.SetColDefs()
>
> Hi, experts.
>
> I am using wxDb and wxDbTable to write a DB application.
>
> But I feel discommodious when I use wxDbTable.SetColDefs() to get data from
> table, for example:
>
> In the table, I write a long[100] into a varbinary column named "data".
> Now I want to read these long datas into a long array ( long m_Data[100] ).
> ----------------------------------------------------
> m_tbPerson->SetColDefs(16, wxT("data"), DB_DATA_TYPE_BLOB, m_Data,
> SQL_C_WXCHAR, 100*sizeof(long));
>
> this method will read each byte and cast it to char, 0 -> '0'.
> ----------------------------------------------------
> m_tbPerson->SetColDefs(16, wxT("data"), DB_DATA_TYPE_BLOB, m_Data,
> SQL_C_ULONG, 100*sizeof(long)); While using this method, the
> m_tbPerson->Open() return false.
> ----------------------------------------------------
> Could any expert give me some suggestion on SetColDefs?
> How could I "copy" this buffer of long data from column in DB, to member
> array?
>
> Thanks.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wx-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wx-users-help at lists.wxwidgets.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wx-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wx-users-help at lists.wxwidgets.org
>
>




More information about the wx-users mailing list