{"action":"created","issue":{"url":"https://api.github.com/repos/fnc12/sqlite_orm/issues/84","repository_url":"https://api.github.com/repos/fnc12/sqlite_orm","labels_url":"https://api.github.com/repos/fnc12/sqlite_orm/issues/84/labels{/name}","comments_url":"https://api.github.com/repos/fnc12/sqlite_orm/issues/84/comments","events_url":"https://api.github.com/repos/fnc12/sqlite_orm/issues/84/events","html_url":"https://github.com/fnc12/sqlite_orm/issues/84","id":293368828,"number":84,"title":"update() compile error when called twice","user":{"login":"JoeyZhu1994","id":24824021,"avatar_url":"https://avatars2.githubusercontent.com/u/24824021?v=4","gravatar_id":"","url":"https://api.github.com/users/JoeyZhu1994","html_url":"https://github.com/JoeyZhu1994","followers_url":"https://api.github.com/users/JoeyZhu1994/followers","following_url":"https://api.github.com/users/JoeyZhu1994/following{/other_user}","gists_url":"https://api.github.com/users/JoeyZhu1994/gists{/gist_id}","starred_url":"https://api.github.com/users/JoeyZhu1994/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JoeyZhu1994/subscriptions","organizations_url":"https://api.github.com/users/JoeyZhu1994/orgs","repos_url":"https://api.github.com/users/JoeyZhu1994/repos","events_url":"https://api.github.com/users/JoeyZhu1994/events{/privacy}","received_events_url":"https://api.github.com/users/JoeyZhu1994/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-02-01T01:07:10Z","updated_at":"2018-02-01T06:04:56Z","closed_at":null,"author_association":"NONE","body":"env: vs2017 15.5\r\nbelow code seems not work and report error in line 4929\r\n```\r\nauto table1 = make_table(...);\r\nauto table2  = make_table(...);\r\nauto storage1 = make_storage(table1);\r\nauto storage2 = make_storage(table2);\r\n\r\nfor(storage1.iterate<A>())\r\n{\r\n   if(...)\r\n   {\r\n       storage1.update()\r\n   }\r\n}\r\n\r\nfor(storage2.iterate<B>())\r\n{\r\n   if(...)\r\n   {\r\n       storage2.update()\r\n   }\r\n}\r\n```\r\n\r\nBTW I'm a fresher to c++11, is that a wrong way to use it?"},"comment":{"url":"https://api.github.com/repos/fnc12/sqlite_orm/issues/comments/362167928","html_url":"https://github.com/fnc12/sqlite_orm/issues/84#issuecomment-362167928","issue_url":"https://api.github.com/repos/fnc12/sqlite_orm/issues/84","id":362167928,"user":{"login":"JoeyZhu1994","id":24824021,"avatar_url":"https://avatars2.githubusercontent.com/u/24824021?v=4","gravatar_id":"","url":"https://api.github.com/users/JoeyZhu1994","html_url":"https://github.com/JoeyZhu1994","followers_url":"https://api.github.com/users/JoeyZhu1994/followers","following_url":"https://api.github.com/users/JoeyZhu1994/following{/other_user}","gists_url":"https://api.github.com/users/JoeyZhu1994/gists{/gist_id}","starred_url":"https://api.github.com/users/JoeyZhu1994/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JoeyZhu1994/subscriptions","organizations_url":"https://api.github.com/users/JoeyZhu1994/orgs","repos_url":"https://api.github.com/users/JoeyZhu1994/repos","events_url":"https://api.github.com/users/JoeyZhu1994/events{/privacy}","received_events_url":"https://api.github.com/users/JoeyZhu1994/received_events","type":"User","site_admin":false},"created_at":"2018-02-01T06:04:56Z","updated_at":"2018-02-01T06:04:56Z","author_association":"NONE","body":"Thanks for your kindly reply:\r\n\r\nIt's just pseudocode, I'm sorroy for that.\r\nThis is detail one:\r\nvoid CSqlite_Access::Initialize()\r\n{\r\n\t// 1. 建立映射，这里可以同时建立多个表与storage的映射关系，make_storage是可变参的\r\n\tauto table_employee = make_table(Employee::Table_Employee,\r\n\t\tmake_column(Employee::Column_ID, &Employee::Table::id, primary_key()),\r\n\t\tmake_column(Employee::Column_Name, &Employee::Table::name),\r\n\t\tmake_column(Employee::Column_Age, &Employee::Table::age),\r\n\t\tmake_column(Employee::Column_Address, &Employee::Table::address),\r\n\t\tmake_column(Employee::Column_Salary, &Employee::Table::salary));\r\n\r\n\tauto storage_employee = make_storage(m_File_Name, table_employee);\r\n\r\n\t// 2. 将表中的数据同步\r\n\tstorage_employee.sync_schema();\r\n\r\n\tstorage_employee.begin_transaction();\r\n\r\n\t// 3. 校验表中数据的合法性，使用C++11 Style的迭代方式\r\n\t// 如果表中某行数据不合法，则将其id保存下来\r\n\tfor (auto &it : storage_employee.iterate<Employee::Table>())\r\n\t{\r\n\t\tif (!it.IsValid())\r\n\t\t{\r\n\t\t\tit.Reset();\r\n\t\t\tstorage_employee.update(it);\r\n\t\t}\r\n\t}\r\n\r\n\r\n\tstorage_employee.commit(); //  or storage.rollback();\r\n\r\n\tauto table_student = make_table(Student::Table_Student,\r\n\t\tmake_column(Student::Column_ID, &Student::Table::id, primary_key()),\r\n\t\tmake_column(Student::Column_Name, &Student::Table::name),\r\n\t\tmake_column(Student::Column_Age, &Student::Table::age),\r\n\t\tmake_column(Student::Column_School, &Student::Table::school));\r\n\r\n\tauto storage_student = make_storage(m_File_Name, table_student);\r\n\r\n\t// 2. 将表中的数据同步\r\n\tstorage_student.sync_schema();\r\n\r\n\tstorage_student.begin_transaction();\r\n\t// 3. 校验表中数据的合法性，使用C++11 Style的迭代方式\r\n\t// 如果表中某行数据不合法，则将其id保存下来\r\n\tfor (auto &it : storage_student.iterate<Student::Table>())\r\n\t{\r\n\t\tif (!it.IsValid())\r\n\t\t{\r\n\t\t\tit.Reset();\r\n\t\t\tstorage_student.update(it);\r\n\t\t}\r\n\t}\r\n\tstorage_student.commit();\r\n}\r\n\r\nIf there only exist one update function, compile is OK, If two, the compiler report : \"setColumnNames: 未声明的标识符 (means that setColumnNames is not declared)\"\r\n"}}
{"actor":{"display_login":"JoeyZhu1994"}}