[odb-users] how can ODB support CString in MFC

Jerry kexuetutu at sina.com
Tue Oct 30 07:24:25 EDT 2018


I'm trying use ODB in my program to save a class that contains CString type (a MFC variable type). When I compile the include file with ODB, it tell me the 'CString' does not name a type.
There is 2 ways I think can solve it. I tried but failed.1、Let ODB support the CString typeI write a CString-traits.hxx reference the qt example and this web (https://www.codesynthesis.com/~boris/blog/2012/07/18/custom-database-to-cxx-type-mapping-in-odb/),when I compile with ODB, the compiler want the CString support include file. I give the include file path, but the compiler want more include file that from the CString include file, and it appears more unsupport type. I think there must be sth wrong because it's so inconvenient.
2、Let ODB compiler ignore the 'CString' wordI add the '#pragma db transient' before the CString, like below:......public:#pragma db transient	CStringA name;	double R = -1;	double S = -1;	bool isPositive;......but the odb compiler also tell me the CString not name a type.
After all, my question is: 1、How can ODB support CString? 2、How can ODB compiler ignore particular sentence, such as sentence contains 'CString'?
PS:There are 2 files[1.h] is the class i want to use ODB to save data[CString-traits.zip] is files i want to traits CString typeI use VS2013 windowns
Thinks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: =?GBK?B?Q1N0cmluZy10cmFpdHMuemlw?=
Type: application/zip
Size: 4693 bytes
Desc: not available
Url : https://codesynthesis.com/pipermail/odb-users/attachments/20181030/e33c7d65/GBKBQ1N0cmluZy10cmFpdHMuemlw.zip
-------------- next part --------------
A non-text attachment was scrubbed...
Name: =?GBK?B?MS5o?=
Type: application/octet-stream
Size: 590 bytes
Desc: not available
Url : https://codesynthesis.com/pipermail/odb-users/attachments/20181030/e33c7d65/GBKBMS5o.obj


More information about the odb-users mailing list