<commit_before>#include <ORM/backends/MySql.hpp>
orm::MySqlDB def("root","toor","test");
//orm::MySqlDB def("root","root","test");

//#include <ORM/backends/Sqlite3.hpp>
//orm::Sqlite3DB def("./test.db");

orm::DB& orm::DB::Default = def;

#include <ORM/fields.hpp>
#include <ORM/fields/ManyToMany.hpp>
#include <ORM/models/SqlObject.hpp>
#include <ORM/backends/op.hpp>

#include <iostream>

class Spell : public orm::SqlObject<Spell>
{
    public:
        Spell();
        orm::CharField<255> name;
        orm::IntegerField element;

        MAKE_STATIC_COLUMN(name,element);

};
REGISTER_AND_CONSTRUCT(Spell,"spell",name,"name",element,"element")

class Stats : public orm::SqlObject<Stats>
{
    public:
        Stats();
        orm::IntegerField pv;
        orm::IntegerField pi;
        /*orm::IntegerField intelligence;
        orm::IntegerField force;
        orm::IntegerField defence;
        orm::IntegerField vattaque;
        orm::IntegerField esquive;
        orm::IntegerField chance;
        orm::IntegerField charme;
        orm::IntegerField mouvement;*/

        MAKE_STATIC_COLUMN(pv,pi/*,intelligence,force,defence,vattaque,esquive,chance,charme,mouvement*/)
};
REGISTER_AND_CONSTRUCT(Stats,"stats",pv,"pv",pi,"pi"/*,intelligence,"int",force,"force",defence,"def",vattaque,"vatq",esquive,"esq",chance,"chance",charme,"charme",mouvement,"mouvement"*/)

class Perso : public orm::SqlObject<Perso>
{
    public:
        Perso();
        orm::CharField<255> name;
        orm::IntegerField lvl;
        orm::FK<Stats,false> stats;
        orm::FK<Stats,false> stats2;
        orm::FK<Perso,true> maitre;

        orm::ManyToMany<Perso,Spell> spells;

        MAKE_STATIC_COLUMN(name,lvl,stats,stats2,maitre)
};
M2M_REGISTER(Perso,spells,Spell,"perso_spell","perso_id","spell_id")
REGISTER(Perso,"perso",name,"name",lvl,"lvl",stats,"stats",stats2,"stats_tmp",maitre,"master")
Perso::Perso() : name(Perso::$name), lvl(Perso::$lvl), stats(Perso::$stats),stats2(Perso::$stats2), maitre($maitre), spells(*this)
{
    name.registerAttr(*this);
    lvl.registerAttr(*this);
    stats.registerAttr(*this);
    stats2.registerAttr(*this);
    maitre.registerAttr(*this);
}
//REGISTER_AND_CONSTRUCT(Perso,"perso",name,"name",lvl,"lvl",stats,"stats",stats2,"stats_tmp",maitre,"master")


class TestTypes : public orm::SqlObject<TestTypes>
{
    public:
    TestTypes();

    orm::FK<TestTypes> fk;

   /* orm::BooleanField           booleanField;
    orm::CharField<255>         charField;
    orm::DateTimeField          datetimeField;
    orm::AutoDateTimeField      autodatetimeField;
    orm::AutoNowDateTimeField   autonowdatetimeField;
    orm::IntegerField           integerField;
    orm::FloatField             floatField;
    orm::DoubleField            doubleField;*/
    orm::TextField              textField;
    orm::UnsignedIntegerField   unsignedIntegerField;


    MAKE_STATIC_COLUMN(\
                       fk,\
                       /*booleanField,\
                       charField,\
                       datetimeField,\
                       autodatetimeField,\
                       autonowdatetimeField,\
                       integerField,\
                       floatField,\
                       doubleField,\*/
                       textField,\
                       unsignedIntegerField\
                      )
};
REGISTER_AND_CONSTRUCT(TestTypes,"test_types",\
                       fk,"fk",\
                       /*booleanField,"booleanField",\
                       charField,"charField",\
                       datetimeField, "datetimeField",\
                       autodatetimeField, "autodatetimeField",\
                       autonowdatetimeField, "autonowdatetimeField",\
                       integerField,"integerField",\
                       floatField,"floatField",\
                       doubleField,"doubleField",\*/
                       textField,"textField",\
                       unsignedIntegerField,"unsignedIntegerField"\
                      )
//merge all colums
class TestMergeHeritage : public TestTypes
{
    public:
        TestMergeHeritage();

        orm::BooleanField   b;

        MAKE_STATIC_COLUMN(b)
};
REGISTER_AND_CONSTRUCT(TestMergeHeritage,"TestMergeHeritage",b,"b")
//REGISTER_TABLE(TestMergeHeritage,"TestMergeHeritage")

using namespace orm;
using namespace std;

void testDate()
{

    std::cout<<"date tests"<<std::endl;
    std::cout<<"1 month: "<<orm::DateTimeField::month(1)
    <<"\n 2 months: "<<orm::DateTimeField::month(2)
    <<"\n 1+1 months: "<<orm::DateTimeField::month(1) + orm::DateTimeField::month(1)
    <<"\n now: "<<orm::DateTimeField::now()
    <<"\n now + 30 day: "<<orm::DateTimeField::now() + orm::DateTimeField::day(30)
    <<"\n 1 hour: "<<orm::DateTimeField::time(1,0,0)<commit_msg>fix Mysql Querys<commit_after>#include <ORM/backends/MySql.hpp>
orm::MySqlDB def("root","toor","test");
//orm::MySqlDB def("root","root","test");

//#include <ORM/backends/Sqlite3.hpp>
//orm::Sqlite3DB def("./test.db");

orm::DB& orm::DB::Default = def;

#include <ORM/fields.hpp>
#include <ORM/fields/ManyToMany.hpp>
#include <ORM/models/SqlObject.hpp>
#include <ORM/backends/op.hpp>

#include <iostream>

class Spell : public orm::SqlObject<Spell>
{
    public:
        Spell();
        orm::CharField<255> name;
        orm::IntegerField element;

        MAKE_STATIC_COLUMN(name,element);

};
REGISTER_AND_CONSTRUCT(Spell,"spell",name,"name",element,"element")

class Stats : public orm::SqlObject<Stats>
{
    public:
        Stats();
        orm::IntegerField pv;
        orm::IntegerField pi;
        /*orm::IntegerField intelligence;
        orm::IntegerField force;
        orm::IntegerField defence;
        orm::IntegerField vattaque;
        orm::IntegerField esquive;
        orm::IntegerField chance;
        orm::IntegerField charme;
        orm::IntegerField mouvement;*/

        MAKE_STATIC_COLUMN(pv,pi/*,intelligence,force,defence,vattaque,esquive,chance,charme,mouvement*/)
};
REGISTER_AND_CONSTRUCT(Stats,"stats",pv,"pv",pi,"pi"/*,intelligence,"int",force,"force",defence,"def",vattaque,"vatq",esquive,"esq",chance,"chance",charme,"charme",mouvement,"mouvement"*/)

class Perso : public orm::SqlObject<Perso>
{
    public:
        Perso();
        orm::CharField<255> name;
        orm::IntegerField lvl;
        orm::FK<Stats,false> stats;
        orm::FK<Stats,false> stats2;
        orm::FK<Perso,true> maitre;

        orm::ManyToMany<Perso,Spell> spells;

        MAKE_STATIC_COLUMN(name,lvl,stats,stats2,maitre)
};
M2M_REGISTER(Perso,spells,Spell,"perso_spell","perso_id","spell_id")
REGISTER(Perso,"perso",name,"name",lvl,"lvl",stats,"stats",stats2,"stats_tmp",maitre,"master")
Perso::Perso() : name(Perso::$name), lvl(Perso::$lvl), stats(Perso::$stats),stats2(Perso::$stats2), maitre($maitre), spells(*this)
{
    name.registerAttr(*this);
    lvl.registerAttr(*this);
    stats.registerAttr(*this);
    stats2.registerAttr(*this);
    maitre.registerAttr(*this);
}
//REGISTER_AND_CONSTRUCT(Perso,"perso",name,"name",lvl,"lvl",stats,"stats",stats2,"stats_tmp",maitre,"master")


class TestTypes : public orm::SqlObject<TestTypes>
{
    public:
    TestTypes();

    orm::FK<TestTypes> fk;

   /* orm::BooleanField           booleanField;
    orm::CharField<255>         charField;
    orm::DateTimeField          datetimeField;*/
    orm::AutoDateTimeField      autodatetimeField;
    orm::AutoNowDateTimeField   autonowdatetimeField;
    orm::IntegerField           integerField;
    orm::FloatField             floatField;
    orm::DoubleField            doubleField;
    orm::TextField              textField;
    orm::UnsignedIntegerField   unsignedIntegerField;


    MAKE_STATIC_COLUMN(\
                       fk,\
                       /*booleanField,\
                       charField,\
                       datetimeField,\*/
                       autodatetimeField,\
                       autonowdatetimeField,\
                       integerField,\
                       floatField,\
                       doubleField,\
                       textField,\
                       unsignedIntegerField\
                      )
};
REGISTER_AND_CONSTRUCT(TestTypes,"test_types",\
                       fk,"fk",\
                       /*booleanField,"booleanField",\
                       charField,"charField",\
                       datetimeField, "datetimeField",\*/
                       autodatetimeField, "autodatetimeField",\
                       autonowdatetimeField, "autonowdatetimeField",\
                       integerField,"integerField",\
                       floatField,"floatField",\
                       doubleField,"doubleField",\
                       textField,"textField",\
                       unsignedIntegerField,"unsignedIntegerField"\
                      )
//merge all colums
class TestMergeHeritage : public TestTypes
{
    public:
        TestMergeHeritage();

        orm::BooleanField   b;

        MAKE_STATIC_COLUMN(b)
};
REGISTER_AND_CONSTRUCT(TestMergeHeritage,"TestMergeHeritage",b,"b")
//REGISTER_TABLE(TestMergeHeritage,"TestMergeHeritage")

using namespace orm;
using namespace std;

void testDate()
{

    std::cout<<"date tests"<<std::endl;
    std::cout<<"1 month: "<<orm::DateTimeField::month(1)
    <<"\n 2 months: "<<orm::DateTimeField::month(2)
    <<"\n 1+1 months: "<<orm::DateTimeField::month(1) + orm::DateTimeField::month(1)
    <<"\n now: "<<orm::DateTimeField::now()
    <<"\n now + 30 day: "<<orm::DateTimeField::now() + orm::DateTimeField::day(30)
    <<"\n 1 hour: "<<orm::DateTimeField::time(1,0,0)
{'fraction_non_alphanumeric': 0.14818663618414216, 'fraction_numerical': 0.0072742388028681285, 'mean_word_length': 2.711531045121481, 'pattern_counts': {'":': 0, '<': 97, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5652696', 'n_tokens_mistral': 3093, 'n_tokens_neox': 2938, 'n_words': 401}