+ q = "SELECT name, value FROM certAvas WHERE certid='" + this->escape_string( job->target ) + "'";
+ std::tie( err, res ) = query( q );
+
+ if( err ) {
+ std::cout << mysql_error( this->conn.get() );
+ return std::shared_ptr<TBSCertificate>();
+
+ }
+
+ while( ( row = mysql_fetch_row( res.get() ) ) ) {
+ unsigned long* l = mysql_fetch_lengths( res.get() );
+
+ if( !l ) {
+ return std::shared_ptr<TBSCertificate>();
+ }
+
+ std::shared_ptr<AVA> nAVA = std::shared_ptr<AVA>( new AVA() );
+ nAVA->name = std::string( row[0], row[0] + l[0] );
+ nAVA->value = std::string( row[1], row[1] + l[1] );
+ cert->AVAs.push_back( nAVA );
+ }
+