Comparing strings with contents of columns
The obvious approach here would be to use a map or unordered_map to convert from a column name to a pointer (or reference) to the actual column. This will typically reduce the line count by about 2:1. More importantly, however, it makes most of that simple initialization, and the code that executes at run time is about 3 lines or so. An implementation would look something like this:

struct PaymentTransaction {
    int id;
    int gas_station_id;
    int nozzle_id;
    // more members here
public:
    void setAttributes(sqlite3_statement const *);
};
void PaymentTransaction::setAttributes(sqlite3_statement const *statement) {
    for (int i = 0; i &lt; statement-&gt;sqlite3_column_count(); i++) {
        std::string name = sqlite3_column_name(statement, i);

        static const std::map&lt;std::string, int &amp;&gt; int_members{
            { "id", id},
            {"gas_station_id", gas_station_id},
            {"nozzle_id", nozzle_id}
            // ...
        };

        auto pos = int_members.find(name);
        if (pos != int_members.end()) {
            pos-&gt;second = sqlite3_column_int(statement, i);
        }
    }
    // Possibly similar code for members of other types
}


Note that this requires a separate map for each type of column (integer vs. floating point vs. string) but can have a single map for all the columns of one type.

You could separate the map from the function, and make the function a template to avoid duplicating that code (but this may be more trouble than it's worth, depending on how many types you need to deal with--all you've shown are ints, but I don't know how accurately that reflects you real use.