Page 1 of 1

Incorrect SQL table names with comples class name

PostPosted: Fri May 18, 2012 8:11 am
by jduran
Dear all,

I've created a complex class Model::Patient. I've changed the registration macros based on dll2 sample, the program compiles fine. At execution time, invalid table name are used in SQL commands:

Code: Select all
INSERT INTO Model.Patient (patient_id, name, birthdate, sex) VALUES (:patient_id, :name, :birthdate, :sex)
Parameter count mismatch


The registration macros used are:

Code: Select all
QX_REGISTER_COMPLEX_CLASS_NAME_HPP_TEST_EXE(Model::Patient, qx::trait::no_base_class_defined, 0, Model_Patient)
QX_REGISTER_COMPLEX_CLASS_NAME_CPP_TEST_EXE(Model::Patient, Model_Patient)


Joaquim Duran

Re: Incorrect SQL table names with comples class name

PostPosted: Fri May 18, 2012 8:13 am
by jduran
This happens with QxOrm 1.2.3 and 1.2.4B23.

Re: Incorrect SQL table names with comples class name

PostPosted: Fri May 18, 2012 8:53 am
by QxOrm admin
Hi,

When your class is defined into a namespace, you have to modify the table name associated to your C++ class.
You just have to use t.setName("myTableName") method in your qx::register_class<T> function, for example :
Code: Select all
namespace qx {
template <> void register_class(QxClass<qx::test::CPerson> & t)
{
   t.setName("CPerson");
   //etc...
}


You can find an example in ./test/qxDllSample/dll1/ with CPerson class defined into qx::test namespace...

Re: Incorrect SQL table names with comples class name

PostPosted: Fri May 18, 2012 9:11 am
by jduran
I was thinking that the name of the table was the last parameter of the macro QX_REGISTER_COMPLEX_CLASS_NAME_HPP_TEST_EXE.

Joaquim Duran