[odb-users] Compilation error when using decimal(p,
s) or bytea types
Sam
lists1 at afach.de
Sat Mar 23 15:28:24 EDT 2019
Hello there:
There seems to be a bug in odb (Ubuntu 18.04 (bionic), the version
that comes with the OS) that when I use the types decimal(p,s) or
bytea, I get compilation errors in set_image in the file generated.
The following is a minimal example.
The ORM definition file is the following:
//////////////////////////////////////////////////////////////////
#ifndef ORMBALANCES_H
#define ORMBALANCES_H
#include <odb/core.hxx>
#include <odb/nullable.hxx>
#include <odb/tr1/memory.hxx>
// these ODB_COMPILER defs help in preventing g++ from compiling these
// statements and produce warnings
#ifdef ODB_COMPILER
#pragma db model version(1, 1)
#pragma db object table("Balances")
#endif
#ifdef ODB_COMPILER
#pragma db object
#endif
class OrmBalances
{
#ifdef ODB_COMPILER
#pragma db id auto unique column("BalanceID")
#endif
uint64_t id;
#ifdef ODB_COMPILER
#pragma db default("0") column("Balance") type("decimal(8,8)")
#endif
std::string balance;
public:
friend class odb::access;
};
#endif // ORMBALANCES_H
//////////////////////////////////////////////////////////////////
The command I use to generate is this:
/usr/bin/odb --stdc++14
--schema-version-tableOrmBalances_schema_version-dpgsql
/home/user/temp/odb_test/OrmBalances.h
More information:
$ odb --version
ODB object-relational mapping (ORM) compiler for C++ 2.4.0
Copyright (c) 2009-2015 Code Synthesis Tools CC
This is free software; see the source for copying conditions. There is
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
The error is the following:
/home/user/temp/build-odb_test-Default_cmake-Default/OrmBalancesClass_
ODB_generated/OrmBalances-odb.cxx:206: error: too many arguments to
function call, expected 3, have 4; did you mean
'pgsql::c_string_value_traits::set_image'?
pgsql::value_traits<
^~~~~
pgsql::c_string_value_traits::set_image
And this how the generated code looks like at set_image():
pgsql::value_traits<
::std::string,
pgsql::id_numeric >::set_image (
i.balance_value,
size,
is_null,
v);
Is this a bug or am I doing something wrong?
If it's a bug, is there a new version with this issue fixed?
Thanks.
Best,
Sam
More information about the odb-users
mailing list