Driver features were introduced in the section called “Driver features”. A driver feature is actually an interface (abstract class) which each driver may or may not implement. Two basic features are defined by iopcdb - the TypeMappingFeature and SqlStatementsFeature. See their documentation for detailed description.
The database driver feature interface provides basically only two things - it allows us to ask whether the driver supports the feature specified and allows us to obtain a reference to its implementation. This is best illustrated by an example:
Driver& d = conn->getDriver();
if (d.supportsFeature<SqlStatementsFeature>()) {
TypeMappingFeature& f = d.getFeature<TypeMappingFeature>();
string sqlType = f.getTypeSql(TypeDesc<string>::getType());
cout << sqlType << endl;
}
First, we obtain a driver reference from an existing connection. We want to use the TypeMappingFeature to obtain a SQL type definition for the std::string type. Then we ask, if the driver even supports such feature and finally we obtain a reference to its implementation. Having reference to the feature implementation we may call methods of the feature according to its interface and documentation. This example returns a VARCHAR2(2000) string representing a SQL type which corresponds to std::string. The number 2000 is taken from the db.type.length default metadata specified on the std::string type.