poco icon indicating copy to clipboard operation
poco copied to clipboard

Bind by position or placeholder name?

Open petko opened this issue 2 years ago • 1 comments

I am creating statement wrapper class for C++Builder (C++98), which calls Poco functionality from modern C++ VS DLL. So I need to build the statement by calling different functions from the DLL like CreateStatement, BindInt, etc.. (can't use STL, because of the memory boundaries and different run-times).

Is it possible to bind values to a statement using specific position? The only way that I see right now is binding values in a proper order one after another:

Statement stmt = ( session << "INSERT INTO FORENAME VALUES(?, ?, ?)" );
stmt.addBind(bind(first_value));
stmt.addBind(bind(second_value));
stmt.addBind(bind(third_value));

What I need for my use case is to be able to bind by position:

Statement stmt = ( session << "INSERT INTO FORENAME VALUES(?, ?, ?)" );
stmt.addBind(bind(2, second_value));
stmt.addBind(bind(1, first_value));
stmt.addBind(bind(3, third_value));

Or by name:

Statement stmt = ( session << "INSERT INTO FORENAME VALUES(:first, :second, :third)" );
stmt.addBind(bind(":second", second_value));
stmt.addBind(bind(":first", first_value));
stmt.addBind(bind(":third", third_value));

Is this possible in Poco or is it something that is not yet supported?

petko avatar Jan 29 '23 16:01 petko

This issue is stale because it has been open for 365 days with no activity.

github-actions[bot] avatar Jan 30 '24 02:01 github-actions[bot]

This issue was closed because it has been inactive for 60 days since being marked as stale.

github-actions[bot] avatar Mar 30 '24 02:03 github-actions[bot]