Esempio n. 1
0
File: row.cpp Progetto: ryjen/db
            row::column_type row::column(const string &name) const
            {
                if (name.empty()) {
                    throw no_such_column_exception();
                }

                for (size_t i = 0; i < size_; i++) {
                    const char *col_name = PQfname(stmt_.get(), i);

                    if (name == col_name) {
                        return column(i);
                    }
                }
                throw no_such_column_exception(name);
            }
Esempio n. 2
0
 int column::sql_type() const
 {
     if (!is_valid()) {
         throw no_such_column_exception();
     }
     return PQftype(stmt_.get(), column_);
 }
Esempio n. 3
0
File: row.cpp Progetto: ryjen/db
            string row::column_name(size_t nPosition) const
            {
                if (nPosition >= size()) {
                    throw no_such_column_exception();
                }

                return PQfname(stmt_.get(), nPosition);
            }
Esempio n. 4
0
File: row.cpp Progetto: ryjen/db
            row::column_type row::column(size_t nPosition) const
            {
                if (nPosition >= size() || row_ == -1) {
                    throw no_such_column_exception();
                }

                return column_type(make_shared<postgres::column>(stmt_, row_, nPosition));
            }
Esempio n. 5
0
            sql_value column::to_value() const
            {
                if (!is_valid()) {
                    throw no_such_column_exception();
                }

                return data_mapper::to_value(stmt_, column_);
            }
Esempio n. 6
0
            row::column_type row::column(size_t nPosition) const
            {
                if (nPosition >= size()) {
                    throw no_such_column_exception();
                }

                return column_type(make_shared<sqlite::column>(stmt_, nPosition));
            }
Esempio n. 7
0
            sql_value column::to_value() const
            {
                if (!is_valid()) {
                    throw no_such_column_exception();
                }

                return data_mapper::to_value(PQftype(stmt_.get(), column_), PQgetvalue(stmt_.get(), row_, column_),
                                             PQgetlength(stmt_.get(), row_, column_));
            }