Incorrect SQL table names with comples class name

Forum for posting problems using QxOrm library

Incorrect SQL table names with comples class name

Postby jduran » Fri May 18, 2012 8:11 am

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
jduran
 

Re: Incorrect SQL table names with comples class name

Postby jduran » Fri May 18, 2012 8:13 am

This happens with QxOrm 1.2.3 and 1.2.4B23.
jduran
 

Re: Incorrect SQL table names with comples class name

Postby QxOrm admin » Fri May 18, 2012 8:53 am

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...
QxOrm admin
 

Re: Incorrect SQL table names with comples class name

Postby jduran » Fri May 18, 2012 9:11 am

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
jduran
 


Return to QxOrm - Help

Who is online

Users browsing this forum: No registered users and 6 guests

cron