-
Notifications
You must be signed in to change notification settings - Fork 680
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Landmark Routing 1 PR: Landmark database #4189
Conversation
Just updated new commits to address the code reviews. But the geom column still doesn't work. |
@vesperlou are you doing it inside of a transation? if so you need to commit it every so often so that it actually makes it into the database. transations are a good idea they are a way to batch update the database (shoudl perform better). maybe your class can take have a batch size and then on every batch_size'th item it can commit. the destructor should also commit of course to make sure everything makes it into the database |
No I am not using transactions. The current problem is name and type data can store in the database, only points can’t. All points are NULL. |
i dont understand how the insert query doesnt fail then. i haven't looked at the code all that closely for that specific part but i assume yuou check the return code about whether it succeeded or failed. to me this looks like it needs a pair programming debug session. alternatively you can just get on the command line msql client and try the queries directly on yoru database. i would instrument the code to print out each query that is made when it is made and then do them in the same order by starting an sqlite session. you can start the session by running the program |
oh and also what platform are you on, are you on linux? |
Yes I’m on linux. |
@nilsnolde @kevinkreiser Update: I managed to use DB Browser for SQLite with spatialite extension to check my database and sql statements. It turns out my database is working as expected, the I suspect the problem is adding problematic spatialite extension. In the project I found many functions are not supported such as In DB Browser I manually added |
@nilsnolde @kevinkreiser No problem anymore. |
|
||
struct Landmark { | ||
std::string name; | ||
std::string type; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in the next pr where you add parsing real data this will need to be come an enum of type uint8_t
sqlite3* db; | ||
sqlite3_stmt* stmt; | ||
sqlite3_stmt* insert_stmt; | ||
sqlite3_stmt* bounding_box_stmt; | ||
uint32_t ret; | ||
char* err_msg = NULL; | ||
std::string sql; | ||
const std::string database; | ||
AccessMode access_mode_; | ||
int open_flags = 0; | ||
std::shared_ptr<void> db_conn; | ||
bool did_inserts = false; | ||
|
||
bool open_database(); | ||
bool create_landmarks_table(); | ||
bool create_spatial_index(); | ||
void close_database(); | ||
bool connect_database(); | ||
bool prepare_insert_stmt(); | ||
bool prepare_bounding_box_stmt(); | ||
bool vacuum_analyze(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
honestly we should take all this crap and make a pimpl out of it but we can do it some other time. maybe i can pr that in my free time so you can move on to the next task
close_database(); | ||
} | ||
|
||
bool insert_landmark(const Landmark& landmark); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i know it seems convenient but it is wasteful for the parser to have to allocate (copy) the parsed data into a new structure just so you can push it into the database. if the builder itself takes a long time this is a place we can look to speed it up. for now we can leave it alone
611be0a
to
4b08422
Compare
Related work items: valhalla#4062, valhalla#4071, valhalla#4080, valhalla#4084, valhalla#4087, valhalla#4093, valhalla#4154, valhalla#4159, valhalla#4170, valhalla#4175, valhalla#4179, valhalla#4182, valhalla#4189, valhalla#4204, valhalla#4207, valhalla#4209, valhalla#4227, valhalla#4231, valhalla#4233
fixes #4134
Issue
Implement a sqlite database as the intermediate storage for parsed landmarks.
Landmark Routing 1: Intermediate Storage for Parsed Landmarks
Parent project
GSOC Landmark-based navigation