Welcome to nanodbc Discussions! #287
Replies: 1 comment 3 replies
-
Intro: I hope to use this community to assist with gaining adequate knowledge of nanodbc to redevelop an existing high-level database interface in an existing application. Today, I have run into an apparent limitation in nanodbc, and would gladly accept insults for my naïvity, should they be warranted and accompanied by friendly guidance... As explained, I am working with an existing application so change of schema is not practical - I need to find a way of working with what I have. My question: Sample code snippets:
This works perfectly, but is plainly not using parameters. The content of the record created can be correctly read using the following code:
Note that it was discovered that std::string could also be used where my typedef "bin" is used, and the byte content of the string so populated was as had been written to the record. Implicitly then, a vector<uint8_t> is the correct data-storage type for binary data. In turn, this implies that, a prepared INSERT statement would then be written something like the following:
However, this causes a linker error - the bind to the vector<uint8_t> has no matching "external symbol". Given that the read of a binary field can be performed into a std::string, this was tried instead.
This links without error. However, when run the ODBC driver complains:
Implicitly, it is attempting to treat the stream of bytes as a UTF-8 string, but invalid code sequences were (unsurprisingly) found. I have run out of ideas about how to implement this. Hence my question... Full source uploaded as a text file. |
Beta Was this translation helpful? Give feedback.
-
👋 Welcome!
We’re using Discussions as a place to connect with other members of our community. We hope that you:
build together 💪.
To get started, comment below with an introduction of yourself and tell us about what you do with this community.
Beta Was this translation helpful? Give feedback.
All reactions