sqlite_orm icon indicating copy to clipboard operation
sqlite_orm copied to clipboard

enum binding does not work when enum is a private member

Open meghasemim1999 opened this issue 7 years ago • 10 comments

i have an enum class enum class Role { User, Customer }

and a class that have a private field of type of this enum

class A { public: Role get_role() const; void set_role(Role r); private: Role r; }

and when i create a column using getter and setter i get this error: error C2102: '&' requires l-value

and its in file "sqlite_orm.h" in lines containing code: value = &((o).*(c.getter))();

and by the way i did all the config required for enum binding said in example "enum_binding.cpp"

and when enum is a public field it works correctly

meghasemim1999 avatar Jul 07 '19 06:07 meghasemim1999

Hi. Yes, the bug exists. It is not related to enum cause it can be reproduced with any other field type. I shall fix it in a few days. Error line exists in update and insert_range functions. I shall fix all of them

fnc12 avatar Jul 07 '19 08:07 fnc12

It will work correctly for now if getter returns ref or const ref

fnc12 avatar Jul 07 '19 11:07 fnc12

fixed in https://github.com/fnc12/sqlite_orm/pull/344 . Please check out dev branch

fnc12 avatar Jul 07 '19 21:07 fnc12

hi again im sorry i installed the library with vcpkg and i don't know how to install from dev branch via vcpkg!

could you please help me with that?

and by the way thanks for you immediate responses and fixes.

meghasemim1999 avatar Jul 08 '19 09:07 meghasemim1999

hi. How do you include the lib into your project? I need your line.

fnc12 avatar Jul 08 '19 09:07 fnc12

vcpkg install sqlite-orm --triplet x64-windows

im using vcpkg with cmake

meghasemim1999 avatar Jul 08 '19 10:07 meghasemim1999

IDK. I have never used vcpkg and google tells me nothing. Probably @soroshsabz can help. He uses this lib with vcpkg too

fnc12 avatar Jul 08 '19 10:07 fnc12

Probably we need to add one more configuration here https://github.com/microsoft/vcpkg/tree/master/ports/sqlite-orm . Something like sqlite-orm-dev

fnc12 avatar Jul 11 '19 08:07 fnc12

@fnc12 as I know if you are resolved important or critical problem in code you can release this library with increasing patch version, ( as you know in semantic versioning) after you create this tag, we can publish new releases in all package manager repository

soroshsabz avatar Jul 11 '19 09:07 soroshsabz

@soroshsabz Yeah I understand how it works. However I am not ready to publish 1.4 right now. It would be great to have ability of adding package with sqlite-orm-dev for developer's own risk just like we can do with apt-get packages

fnc12 avatar Jul 11 '19 10:07 fnc12