MySQL Forums
Forum List  »  Connector/C++

Re: Connector/C++ v 8 and binding parameters
Posted by: Luis Silva
Date: January 25, 2020 05:04AM

Hi Walter,

For binding, you need to do it using prepared statements:

For :
create table newtable(f0 int, f1 varchar(1024));

insert into newtable VALUES(1,"1");
insert into newtable VALUES(2,"2");
insert into newtable VALUES(3,"3");


Code:

sql::PreparedStatement *pstmt = conn->prepareStatement("select f1 from newtable where f0 > ? ");

//Bind position (starts in 1)
pstmt->setInt(1, 1);

sql::ResultSet *res = pstmt->executeQuery();

Hope it helps!

Cheers,
Luís

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Connector/C++ v 8 and binding parameters
152
January 25, 2020 05:04AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.