Exemple tdslite - whitc parameters
I don't know if this is the place to ask this question. It's about the tdslite library, make a SELECT with parameters.
I am tested on examples 05-query-wicht-parameters.
In this table, I have several lines where I have "test", but I'm only interested in the line where "b" is the largest.
I need to make a query to a database and I only want the record where a="test" and of all these, the one where the value of b is the largest of all.
The example query returns all the lines where a="test" and b=1
Don't make the inquiry!!!
// Execute SELECT query on every tenth loop.
if (0 == (loop_counter % 10)) {
auto query{TDSL_PMEMSTR("SELECT * FROM #example_table WHERE a = @p0 AND b = @p1")};
SERIAL_PRINTF("Executing query: ");
SERIAL_PRINTLNF_PROGMEM(query.raw_data());
// We're using the row
tdsl::sql_parameter_varchar a{"test"};
tdsl::sql_parameter_int b{1};
tdsl::sql_parameter_binding params []{a, b};
driver.execute_rpc(query, params, tdsl::rpc_mode::executesql, row_callback);
// SERIAL_PRINTLNF("Result: %d", ra);
}