[odb-users] Problem compiling for MS-SQL
Oded Arbel
oded at geek.co.il
Wed Jul 25 09:28:57 EDT 2012
Hi People.
I'm trying to use ODB to build a model for MS-SQL (based on tables I
already have in the database), using Microsoft Visual Studio 2010 and
I keep getting errors such as:
1>$(ProjectDir)\model\ptk-odb.cxx(140): error C2660:
'odb::mssql::default_value_traits<T,ID>::set_image' : function does
not take 5 arguments
1> with
1> [
1> T=std::string,
1> ID=id_nstring
1> ]
1>$(ProjectDir)\model\ptk-odb.cxx(221): error C2660:
'odb::mssql::default_value_traits<T,ID>::set_value' : function does
not take 4 arguments
1> with
1> [
1> T=std::string,
1> ID=id_nstring
1> ]
I get such errors (and a few similar but not identical) on all of the
model classes I created. The class that generated the above problems
looks like this:
#ifndef MODELBASEPTK_H
#define MODELBASEPTK_H
#include <odb/core.hxx>
#include <odb/nullable.hxx>
#include "types.h"
namespace model {
#pragma db object table("ptk")
class BasePTK
{
public:
~BasePTK() {}
protected:
BasePTK() {}
private:
unsigned int _id;
public:
unsigned int id() { return _id; };
private: // serialization support
friend class odb::access;
#pragma db member(_id) id auto column("ptk_id")
protected:
#pragma db type("NVARCHAR(9)")
std::string ppd;
odb::nullable<binary_buffer> ppr;
odb::nullable<binary_buffer> npass;
odb::nullable<binary_buffer> cpass;
};
}
#endif
[types.h is a set of typedefs to make it easier to re-use column types
- it contains things like "binary_buffer" shown above which looks like
this:
typedef std::vector<unsigned char> binary_buffer;
#pragma db value(binary_buffer) type("VARBINARY(512)")
]
I run the ODB compiler like this:
.\lib\odb-2.0.0-i686-windows\bin\odb.exe -d mssql -I lib/boost
--generate-query --generate-schema --schema-format sql -o .\model
.\model\*.h
I originally thought that the problem is that I'm using the binary
windows compiler version 2.0.0 (the latest available on the site)
while libodb is 2.0.1 (latest available), but I tried to "hello"
example for MS-SQL (into which I added a simple class that is build
similar to the above - with all the private/protected/public stuff)
and it builds just fine.
Any idea what's going on?
--
Oded
More information about the odb-users
mailing list