Change-Id: If66f65ed01854c88b8229b4fe606ef7302d2107a
auto command = getStatement(StmtType::EGetAuthorId);
command->BindString(1, pkgName);
- if (command->Step()) {
+ if (command->Step() && !command->IsNull(0)) {
authorGId = command->GetColumnInteger(0);
return true;
}
* @throw Exception::InvalidColumn
*/
std::string GetColumnString(ColumnIndex column);
+
+ /**
+ * Check if the column is null in the current row.
+ *
+ * @throw Exception::InvalidColumn
+ */
+ bool IsNull(SqlConnection::ColumnIndex column);
};
// Move on copy semantics
return std::string(value);
}
+bool SqlConnection::DataCommand::IsNull(SqlConnection::ColumnIndex column)
+{
+ LogDB("SQL data command check if column is null: [" << column << "]");
+ CheckColumnIndex(column);
+
+ return SQLITE_NULL == sqlite3_column_type(m_stmt, column);
+}
+
void SqlConnection::Connect(const std::string &address,
Flag::Type type,
Flag::Option flag)