Author: wyoung
Date: Wed Nov 28 03:13:07 2007
New Revision: 1891
URL: http://svn.gna.org/viewcvs/mysqlpp?rev=1891&view=rev
Log:
Removed a bunch of problematic aliases in ResUse's public interface
- names(const std::string&) -> field_num (buggy and ungrammatical)
- names(int) -> field_name(int) (ungrammatical)
- names() -> field_names() (just pointless)
- types(int) -> field_type(int) (ungrammatical)
- types() -> field_type() (pointless)
Modified:
trunk/examples/dbinfo.cpp
trunk/examples/fieldinf.cpp
trunk/examples/multiquery.cpp
trunk/lib/result.h
trunk/lib/row.cpp
Modified: trunk/examples/dbinfo.cpp
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/examples/dbinfo.cpp?rev=1891&r1=1890&r2=1891&view=diff
==============================================================================
--- trunk/examples/dbinfo.cpp (original)
+++ trunk/examples/dbinfo.cpp Wed Nov 28 03:13:07 2007
@@ -100,7 +100,7 @@
unsigned int columns = res.num_fields();
vector<int> widths;
for (int i = 0; i < columns; ++i) {
- string s = res.names(i);
+ string s = res.field_name(i);
if (s.compare("field") == 0) {
widths.push_back(22);
}
@@ -121,7 +121,7 @@
}
if (widths[i]) {
- cout << '|' << setw(widths[i]) << res.names(i)
<< '|';
+ cout << '|' << setw(widths[i]) <<
res.field_name(i) << '|';
}
}
cout << endl;
Modified: trunk/examples/fieldinf.cpp
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/examples/fieldinf.cpp?rev=1891&r1=1890&r2=1891&view=diff
==============================================================================
--- trunk/examples/fieldinf.cpp (original)
+++ trunk/examples/fieldinf.cpp Wed Nov 28 03:13:07 2007
@@ -68,19 +68,19 @@
}
cout << endl;
- for (size_t i = 0; i < res.names()->size(); i++) {
+ for (size_t i = 0; i < res.field_names()->size(); i++) {
// Suppress C++ type name outputs when run under dtest,
// as they're system-specific.
- const char* cname = dtest_mode ? "n/a" :
res.types(i).name();
- cout << setw(widths[0]) << res.names(i).c_str() <<
- setw(widths[1]) <<
res.types(i).sql_name() <<
+ const char* cname = dtest_mode ? "n/a" :
res.field_type(i).name();
+ cout << setw(widths[0]) << res.field_name(i).c_str() <<
+ setw(widths[1]) <<
res.field_type(i).sql_name() <<
setw(widths[2]) << cname <<
endl;
}
cout << endl;
// Simple type check
- if (res.types(0) == typeid(string)) {
+ if (res.field_type(0) == typeid(string)) {
cout << "SQL type of 'item' field most closely
resembles "
"the C++ string type." << endl;
}
@@ -88,16 +88,16 @@
// Tricky type check: the 'if' path shouldn't happen because the
// description field has the NULL attribute. We need to dig a
// little deeper if we want to ignore this in our type checks.
- if (res.types(5) == typeid(string)) {
+ if (res.field_type(5) == typeid(string)) {
cout << "Should not happen! Type check failure." <<
endl;
}
- else if (res.types(5) ==
typeid(mysqlpp::Null<mysqlpp::String>)) {
+ else if (res.field_type(5) ==
typeid(mysqlpp::Null<mysqlpp::String>)) {
cout << "SQL type of 'description' field resembles "
"a nullable variant of the C++ string
type." << endl;
}
else {
cout << "Weird: fifth field's type is now " <<
- res.types(5).name() << endl;
+ res.field_type(5).name() << endl;
cout << "Did something recently change in resetdb?" <<
endl;
}
}
Modified: trunk/examples/multiquery.cpp
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/examples/multiquery.cpp?rev=1891&r1=1890&r2=1891&view=diff
==============================================================================
--- trunk/examples/multiquery.cpp (original)
+++ trunk/examples/multiquery.cpp Wed Nov 28 03:13:07 2007
@@ -49,8 +49,8 @@
print_header(IntVectorType& widths, Result& res)
{
cout << " |" << setfill(' ');
- for (size_t i = 0; i < res.names()->size(); i++) {
- cout << " " << setw(widths.at(i)) << res.names(i) << " |";
+ for (size_t i = 0; i < res.field_names()->size(); i++) {
+ cout << " " << setw(widths.at(i)) << res.field_name(i) << " |";
}
cout << endl;
}
@@ -97,8 +97,8 @@
int size = res.num_fields();
for (int i = 0; i < size; i++) {
mysql_type_info mti(res.fields(i));
- widths.push_back((res.names(i).size() > mti.max_length()) ?
- res.names(i).size() : mti.max_length());
+ widths.push_back((res.field_name(i).size() > mti.max_length()) ?
+ res.field_name(i).size() : mti.max_length());
}
// Print result set header
Modified: trunk/lib/result.h
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/result.h?rev=1891&r1=1890&r2=1891&view=diff
==============================================================================
--- trunk/lib/result.h (original)
+++ trunk/lib/result.h Wed Nov 28 03:13:07 2007
@@ -186,22 +186,6 @@
/// result set.
const FieldTypes& field_types() const;
- /// \brief Alias for field_num()
- int names(const std::string & s) const { return field_num(s); }
-
- /// \brief Alias for field_name()
- const std::string& names(int i) const { return field_name(i); }
-
- /// \brief Alias for field_names()
- const RefCountedPointer<FieldNames> names() const
- { return field_names(); }
-
- /// \brief Alias for field_type()
- const mysql_type_info& types(int i) const { return field_type(i); }
-
- /// \brief Alias for field_types()
- const FieldTypes& types() const { return field_types(); }
-
/// \brief Get the underlying Fields structure.
const Fields& fields() const { return fields_; }
Modified: trunk/lib/row.cpp
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/row.cpp?rev=1891&r1=1890&r2=1891&view=diff
==============================================================================
--- trunk/lib/row.cpp (original)
+++ trunk/lib/row.cpp Wed Nov 28 03:13:07 2007
@@ -37,7 +37,7 @@
size_(r ? r->num_fields() : 0)
{
if (r) {
- field_names_ = r->names();
+ field_names_ = r->field_names();
}
if (d && r) {
@@ -47,7 +47,7 @@
data_.push_back(value_type(
is_null ? "NULL" : d[i],
is_null ? 4 : lengths[i],
- r->types(i),
+ r->field_type(i),
is_null));
}
_______________________________________________
Mysqlpp-commits mailing list
[email protected]
https://mail.gna.org/listinfo/mysqlpp-commits