You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i use c++ to create a struct which has a "char[]" member, so how shoud i create this member's fileld in SQLite whit sqlite_orm. struct User{ int age; char name[20]; };
You can try to make row_extractor for it but I am not sure whether it will work cause char[20] is not an object which has copy ctor and other useful stuff which is required for row_extractor. Usually row_extractor is used to add custom types bindings like enum or QString but all of them are C++ types which can be copied and moved. char[20] doesn't have copy and move ctor so I am not sure one can do this. Also assume char[20] can be copied and moved, you created row_extractor and other required extensions. But technically SQLite field may contain string with LENGTH > 20. What will your code do in this case?
So from my perspective the best approach for you is to use std::string instead of char[20]
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
i use c++ to create a struct which has a "char[]" member, so how shoud i create this member's fileld in SQLite whit sqlite_orm.
struct User{ int age; char name[20]; };
Beta Was this translation helpful? Give feedback.
All reactions