I've been looking at the OTL (Oracle, Odbc and DB2-CLI Template Library) for C++ database access. I'm unsure of whether the query I pass in is converted to a parameterized query for the underlying database, or if it's basically just concatenating all the arguments into one big string and passing the query to the database that way. I see that the query you pass in to it can include type information for the arguments, but what happens between then and the query hitting the database, I can't tell.
Is C++ OTL SQL database library using parameterized queries under the hood, or string concat?
4k Views Asked by Brett Rossier At
2
There are 2 best solutions below
6
Ken Bloom
On
The documentation talks all about bind variables. I assume that the library is rewriting your query, but it's probably just changing the format of the bind variables into the format your DBMS expects, and then binding the values to the bind variables.
Related Questions in C++
- How to immediately apply DISPLAYCONFIG_SCALING display scaling mode with SetDisplayConfig and DISPLAYCONFIG_PATH_TARGET_INFO
- Why can't I use templates members in its specialization?
- How to fix "Access violation executing location" when using GLFW and GLAD
- Dynamic array of structures in C++/ cannot fill a dynamic array of doubles in structure from dynamic array of structures
- How do I apply the interface concept with the base-class in design?
- File refuses to compile std::erase() even if using -std=g++23
- How can I do a successful map when the number of elements to be mapped is not consistent in Thrust C++
- Can std::bit_cast be applied to an empty object?
- Unexpected inter-thread happens-before relationships from relaxed memory ordering
- How i can move element of dynamic vector in argument of function push_back for dynamic vector
- Brick Breaker Ball Bounce
- Thread-safe lock-free min where both operands can change c++
- Watchdog Timer Reset on ESP32 using Webservers
- How to solve compiler error: no matching function for call to 'dmhFS::dmhFS()' in my case?
- Conda CMAKE CXX Compiler error while compiling Pytorch
Related Questions in SQL
- SQL schema for a fill-in-the-blank exercise
- Hibernate: JOIN inheritance question - why the need for two left joins
- What's supposed to be the problem in this query?
- Compare fields in two tables
- How to change woocomerce or full wordpress currency with value from USD to AUD
- Dynamic query creation with Array like implementation
- SQL query to get student enrolled in this month in a course - Moodle
- SQL LAG() function returning 0 for every row despite available previous rows
- Convert C# DateTime.Ticks to Bigquery DateTime Format
- Use row values from another table to select them as columns and establish relations between them (pivot table)
- SQL: Generate combination table based on source and destination column from same table
- how to use system's environnement variables in sql script
- PHP fetchAll on JOIN
- Multitable joining in Sql
- How to display name starting from 'z' by using BETWEEN cmd only?
Related Questions in PARAMETERIZED
- JUnit 5 Dynamic file path for @CsvFileSource
- Accessing the `UniqueId` passed to a JUnit5 Session from inside an Extension
- pymssql cursor execute parameterized query errors
- JUnit5 - can I parameterize execution of entire test class?
- Is it safe to use Python % string operator to compose a Psycopg SQL query as long as values are passed separately to cursor.execute()
- Using Classes as Paramaterized Types
- Use MockMvc With Junit Parameterized tests
- Invoking a deleted constructor in C++
- How to pass a function name in parametrize in pytest and How can i use that in testcase?
- JUnit 5 / Intellij / custom test engine / method selection issue
- Compilation error with Java Generics: Required type 'capture of ? extends MyInterface' when passing object implementing MyInterface
- How to Parameterized Queries with the SqlDataSource (VB)
- Why parameterized or theories tests are ignored by Github workflows
- sqlite, python, apsw: trouble parameterizing nested select
- why the provided time text changes in cucumber java?
Related Questions in OTL
- C++ MySQL OTL Getting Started. ODBC Configuration & Errors
- Using OTL library (c++) to INSERT without binding parameters
- When passing gmock object as reference the setup expectations doesnt match
- OTL problem with oracle with clause and function in it in C++
- Is there any methods to use "try,catch,throw in C++" in the Chromium Project Code
- How to connect C++ to MySQL with OTL ODBC driver?
- C++ writing to mongo, string fields not working in aggregation pipeline
- Cannot resolve Symbol otl_connect (otl_connect class not including)
- Execute a oracle stored procedure using otl in c++
- Calling stored procedure with table type argument
- How to include the OTL header in other files besides main.cpp?
- updating database blobs with otl crashes
- C++ OTL doesn't see external database changes
- OTL4.0 otl_stream bind issues
- When use Change Notification interface, the ORA-24912: Listener thread failed. Listen failed error occur?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
OTL author's response to my e-mail:
OTL passes queries with placeholders into the DB API layers. The naming conventions for actual bind variables are different for different DB types. Say, for Oracle,
will be translated into:
plus a bunch of host variable bind calls.
For MS SQL Server, or DB2, the same SELECT would look like this:
It's described in the manual that you can't have a placeholder with the same name more than once for MS SQL, DB2. SQL statements with placeholder / bind variables are relatively expensive to create, so if you instantiate an parameterized SQL via an otl_stream, it makes sense to reuse the stream as much as you can.
If you have more questions, or suggestions on how I can improve the OTL manual, feel free to email me.
Cheers, Sergei
pheadbaq wrote:
Hi, I've been evaluating C++ DB libraries recently to use as a base for an ORM library I wish to build, and have been gravitating more and more towards the OTL. It looks very nice by the way, and seems like it would meet most of the needs I have. I just have one lingering question that I can't seem to clarify by reading the docs. Does OTL pass a parameterized query on to the underlying DBMS, or is it concatenating the arguments and query I pass to the OTL stream into a single string and hand that to the DBMS?
In other words, if I hand OTL this MSSQL query, along with with the string "Bob" as the bind variable:
Does the OTL parser produce this:
Or this:
along with my string as a parameter
I've posted this same question to StackOverflow.com if you care to respond there: Is C++ OTL SQL database library using parameterized queries under the hood, or string concat?
Thank you for your time