[odb-users] How to build a schemaa with many .hxx files (one by class)

Per Edin info at peredin.com
Thu Dec 31 11:35:02 EST 2015


Hi David!

I assume by the directory name "tablas" that you are still thinking in
terms of tables.

Are you trying to map C++ objects to existing database tables?

If not, I would strongly recommend that you stop thinking in terms of
tables and just concentrate on your objects and object graphs. It will
make your life so much easier and is the whole point of an ORM system.

Best regards,

Per Edin
info at peredin.com | https://linkedin.com/in/peredincom | http://peredin.com/


On Thu, Dec 31, 2015 at 4:25 PM, David Pineda <dahalpi at gmail.com> wrote:
> Hello Boris.
> Thanks for your advice.
>
> First, my file struct directory it's like:
>
> ├── esquema_sge.hxx
> └── tablas
>     ├── evento.hxx
>     ├── lugar_evento.hxx
>     └── persona.hxx
>
>
> I've tried different ways to do that, before your message i used
> 'definition' in esquema_sge.hxx
> like:
>
> ..after #pragma model version ...
>
> <code>
> //Includes clases
> #include "tablas/evento.hxx"
> #pragma db value(evento) definition
>
> #include "tablas/persona.hxx"
> #pragma db value(persona) definition
> </code>
>
> The files by table are in folder 'tables'
>
> Then the ODB compiler works fine (fiveme the right sql), but the g++
> compiler
>
> 'g++  -std=c++11 -c esquema_sge-odb.cxx'  give me a lot of errors
>
> file:compile_error.log
>
> So then i've tried with a test files (more simple, whitout foreign keys)
> the  '--at-once'  option:
>
> "shell$ odb --std c++11  -I tablas -d pgsql --generate-query
> --schema-format sql --generate-schema --at-once --input-name sge_cc
> esquema_sge.hxx "tablas/evento.hxx" "tablas/persona.hxx" "
>
> Works fine and give me the correct sql, but when i compile....
>
> Give fatal error on includes to tables --> edit mannually and add the path
> 'tablas'
>
>  #include "evento.hxx" --->  #include "tablas/evento.hxx"
>
> Then i recompile again and give me some errors... see on 'test_error.log'
>
>
>
>
>
> test files:
> https://drive.google.com/file/d/0B3Hidt_-CHDHQW9wVGpNN3cxS1E/view?usp=sharing
> error logs:
> https://drive.google.com/file/d/0B3Hidt_-CHDHZEF5Vzd2T3k2T28/view?usp=sharing
>
>
> 2015-12-31 4:01 GMT-03:00 Boris Kolpackov <boris at codesynthesis.com>:
>
>> Hi David,
>>
>> David Pineda <dahalpi at gmail.com> writes:
>>
>> > My question it's about how to work with many files (one hxx by class) and
>> > call or include in the main schema.hxx file to compile with odb
>>
>> You can use the --at-once ODB compiler option. Search the manual for this
>> option to see some examples of its usage.
>>
>> Boris
>>
>
>
>
> --
> David A. Pineda Osorio
> F:+56 9 82142267
> Ingeniero Civil Electricista
> Universidad de Chile
>
> *http://www.cultura-libre.cl/ <http://www.cultura-libre.cl/>*



More information about the odb-users mailing list