Skip to content

Commit 599aa45

Browse files
committed
Remove build warnings
1 parent 2619550 commit 599aa45

File tree

7 files changed

+250
-253
lines changed

7 files changed

+250
-253
lines changed

driver/mysql_ps_resultset.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ MySQL_Prepared_ResultSet::MySQL_Prepared_ResultSet(
9191
MySQL_Prepared_Statement * par,
9292
boost::shared_ptr< MySQL_DebugLogger > & l
9393
)
94-
: row(NULL), proxy(s), last_queried_column(std::numeric_limits<uint32_t>::max()), row_position(0), parent(par),
94+
: proxy(s), last_queried_column(std::numeric_limits<uint32_t>::max()), row_position(0), parent(par),
9595
is_valid(true), logger(l), result_bind(r_bind), resultset_type(rset_type)
9696
{
9797
CPP_ENTER("MySQL_Prepared_ResultSet::MySQL_Prepared_ResultSet");

driver/mysql_ps_resultset.h

Lines changed: 82 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -51,153 +51,150 @@ class NativeStatementWrapper;
5151
class MySQL_Prepared_ResultSet : public sql::ResultSet
5252
{
5353
private:
54-
MYSQL_ROW row;
54+
boost::shared_ptr< NativeAPI::NativeStatementWrapper > proxy;
5555

56-
boost::shared_ptr< NativeAPI::NativeStatementWrapper > proxy;
56+
mutable uint32_t last_queried_column; // this is updated by calls to getInt(int), getString(int), etc...
5757

58-
mutable uint32_t last_queried_column; // this is updated by calls to getInt(int), getString(int), etc...
58+
unsigned int num_fields;
59+
uint64_t num_rows;
60+
uint64_t row_position;
5961

60-
unsigned int num_fields;
61-
uint64_t num_rows;
62-
uint64_t row_position;
62+
typedef std::map< sql::SQLString, unsigned int > FieldNameIndexMap;
6363

64-
typedef std::map< sql::SQLString, unsigned int > FieldNameIndexMap;
64+
FieldNameIndexMap field_name_to_index_map;
6565

66-
FieldNameIndexMap field_name_to_index_map;
67-
bool was_null;
66+
const MySQL_Prepared_Statement * parent;
6867

69-
const MySQL_Prepared_Statement * parent;
68+
bool is_valid;
7069

71-
bool is_valid;
70+
boost::shared_ptr< MySQL_DebugLogger > logger;
7271

73-
boost::shared_ptr< MySQL_DebugLogger > logger;
72+
boost::scoped_ptr< MySQL_PreparedResultSetMetaData > rs_meta;
7473

75-
boost::scoped_ptr< MySQL_PreparedResultSetMetaData > rs_meta;
74+
boost::shared_ptr< MySQL_ResultBind > result_bind;
7675

77-
boost::shared_ptr< MySQL_ResultBind > result_bind;
78-
79-
sql::ResultSet::enum_type resultset_type;
76+
sql::ResultSet::enum_type resultset_type;
8077

8178
protected:
82-
void checkValid() const;
83-
void checkScrollable() const;
84-
bool isScrollable() const;
85-
void closeIntern();
86-
bool isBeforeFirstOrAfterLast() const;
87-
void seek();
79+
void checkValid() const;
80+
void checkScrollable() const;
81+
bool isScrollable() const;
82+
void closeIntern();
83+
bool isBeforeFirstOrAfterLast() const;
84+
void seek();
8885

89-
int64_t getInt64_intern(const uint32_t columnIndex, bool cutTooBig) const;
90-
uint64_t getUInt64_intern(const uint32_t columnIndex, bool cutTooBig) const;
86+
int64_t getInt64_intern(const uint32_t columnIndex, bool cutTooBig) const;
87+
uint64_t getUInt64_intern(const uint32_t columnIndex, bool cutTooBig) const;
9188

9289
public:
93-
MySQL_Prepared_ResultSet(boost::shared_ptr< NativeAPI::NativeStatementWrapper > & s,
94-
boost::shared_ptr< MySQL_ResultBind > & r_bind, sql::ResultSet::enum_type rset_type,
95-
MySQL_Prepared_Statement * par, boost::shared_ptr< MySQL_DebugLogger > &l);
90+
MySQL_Prepared_ResultSet(boost::shared_ptr< NativeAPI::NativeStatementWrapper > & s,
91+
boost::shared_ptr< MySQL_ResultBind > & r_bind, sql::ResultSet::enum_type rset_type,
92+
MySQL_Prepared_Statement * par, boost::shared_ptr< MySQL_DebugLogger > &l);
9693

97-
virtual ~MySQL_Prepared_ResultSet();
94+
virtual ~MySQL_Prepared_ResultSet();
9895

99-
bool absolute(int row);
96+
bool absolute(int row);
10097

101-
void afterLast();
98+
void afterLast();
10299

103-
void beforeFirst();
100+
void beforeFirst();
104101

105-
void cancelRowUpdates();
102+
void cancelRowUpdates();
106103

107-
void clearWarnings();
104+
void clearWarnings();
108105

109-
void close();
106+
void close();
110107

111-
uint32_t findColumn(const sql::SQLString& columnLabel) const;
108+
uint32_t findColumn(const sql::SQLString& columnLabel) const;
112109

113-
bool first();
110+
bool first();
114111

115-
std::istream * getBlob(uint32_t columnIndex) const;
116-
std::istream * getBlob(const sql::SQLString& columnLabel) const;
112+
std::istream * getBlob(uint32_t columnIndex) const;
113+
std::istream * getBlob(const sql::SQLString& columnLabel) const;
117114

118-
bool getBoolean(uint32_t columnIndex) const;
119-
bool getBoolean(const sql::SQLString& columnLabel) const;
115+
bool getBoolean(uint32_t columnIndex) const;
116+
bool getBoolean(const sql::SQLString& columnLabel) const;
120117

121-
int getConcurrency();
118+
int getConcurrency();
122119

123-
SQLString getCursorName();
120+
SQLString getCursorName();
124121

125-
long double getDouble(uint32_t columnIndex) const;
126-
long double getDouble(const sql::SQLString& columnLabel) const;
122+
long double getDouble(uint32_t columnIndex) const;
123+
long double getDouble(const sql::SQLString& columnLabel) const;
127124

128-
int getFetchDirection();
129-
size_t getFetchSize();
130-
int getHoldability();
125+
int getFetchDirection();
126+
size_t getFetchSize();
127+
int getHoldability();
131128

132-
int32_t getInt(uint32_t columnIndex) const;
133-
int32_t getInt(const sql::SQLString& columnLabel) const;
129+
int32_t getInt(uint32_t columnIndex) const;
130+
int32_t getInt(const sql::SQLString& columnLabel) const;
134131

135-
uint32_t getUInt(uint32_t columnIndex) const;
136-
uint32_t getUInt(const sql::SQLString& columnLabel) const;
132+
uint32_t getUInt(uint32_t columnIndex) const;
133+
uint32_t getUInt(const sql::SQLString& columnLabel) const;
137134

138-
int64_t getInt64(uint32_t columnIndex) const;
139-
int64_t getInt64(const sql::SQLString& columnLabel) const;
135+
int64_t getInt64(uint32_t columnIndex) const;
136+
int64_t getInt64(const sql::SQLString& columnLabel) const;
140137

141-
uint64_t getUInt64(uint32_t columnIndex) const;
142-
uint64_t getUInt64(const sql::SQLString& columnLabel) const;
138+
uint64_t getUInt64(uint32_t columnIndex) const;
139+
uint64_t getUInt64(const sql::SQLString& columnLabel) const;
143140

144-
sql::ResultSetMetaData * getMetaData() const;
141+
sql::ResultSetMetaData * getMetaData() const;
145142

146-
size_t getRow() const;
143+
size_t getRow() const;
147144

148-
sql::RowID * getRowId(uint32_t columnIndex);
149-
sql::RowID * getRowId(const sql::SQLString & columnLabel);
145+
sql::RowID * getRowId(uint32_t columnIndex);
146+
sql::RowID * getRowId(const sql::SQLString & columnLabel);
150147

151-
const sql::Statement * getStatement() const;
148+
const sql::Statement * getStatement() const;
152149

153-
SQLString getString(uint32_t columnIndex) const;
154-
SQLString getString(const sql::SQLString& columnLabel) const;
150+
SQLString getString(uint32_t columnIndex) const;
151+
SQLString getString(const sql::SQLString& columnLabel) const;
155152

156-
sql::ResultSet::enum_type getType() const;
153+
sql::ResultSet::enum_type getType() const;
157154

158-
void getWarnings();
155+
void getWarnings();
159156

160-
bool isAfterLast() const;
157+
bool isAfterLast() const;
161158

162-
bool isBeforeFirst() const;
159+
bool isBeforeFirst() const;
163160

164-
bool isClosed() const;
161+
bool isClosed() const;
165162

166-
void insertRow();
163+
void insertRow();
167164

168-
bool isFirst() const;
165+
bool isFirst() const;
169166

170-
bool isLast() const;
167+
bool isLast() const;
171168

172-
bool isNull(uint32_t columnIndex) const;
169+
bool isNull(uint32_t columnIndex) const;
173170

174-
bool isNull(const sql::SQLString& columnLabel) const;
171+
bool isNull(const sql::SQLString& columnLabel) const;
175172

176-
bool last();
173+
bool last();
177174

178-
void moveToCurrentRow();
175+
void moveToCurrentRow();
179176

180-
void moveToInsertRow();
177+
void moveToInsertRow();
181178

182-
bool next();
179+
bool next();
183180

184-
bool previous();
181+
bool previous();
185182

186-
void refreshRow();
183+
void refreshRow();
187184

188-
bool relative(int rows);
185+
bool relative(int rows);
189186

190-
bool rowDeleted();
187+
bool rowDeleted();
191188

192-
bool rowInserted();
189+
bool rowInserted();
193190

194-
bool rowUpdated();
191+
bool rowUpdated();
195192

196-
size_t rowsCount() const;
193+
size_t rowsCount() const;
197194

198-
void setFetchSize(size_t rows);
195+
void setFetchSize(size_t rows);
199196

200-
bool wasNull() const;
197+
bool wasNull() const;
201198
};
202199

203200
} /* namespace mysql*/

test/CJUnitTestsPort/compliance/DatabaseMetaDataTest.cpp

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,14 +1107,16 @@ void DatabaseMetaDataTest::testGetDefaultTransactionIsolation()
11071107
&& (nRetval != sql::TRANSACTION_READ_COMMITTED)
11081108
&& (nRetval != sql::TRANSACTION_REPEATABLE_READ)
11091109
&& (nRetval != sql::TRANSACTION_SERIALIZABLE)) {
1110-
logErr(
1111-
"getDefaultTransactionIsolation returns an invalid value"
1112-
+ nRetval);
1110+
std::stringstream msg;
1111+
msg << "getDefaultTransactionIsolation returns an invalid value "
1112+
<< nRetval;
1113+
logErr(msg.str());
11131114
FAIL("Call to getDefaultTransactionIsolation is Failed!");
11141115
} else {
1115-
logMsg(
1116-
"getDefaultTransactionIsolation returns a valid Isolation level"
1117-
+ nRetval);
1116+
std::stringstream msg;
1117+
msg << "getDefaultTransactionIsolation returns a valid Isolation level "
1118+
<< nRetval;
1119+
logMsg(msg.str());
11181120
}
11191121

11201122

@@ -1149,8 +1151,10 @@ void DatabaseMetaDataTest::testGetDriverMajorVersion()
11491151
logMsg("Calling getDriverMajorVersion on DatabaseMetaData");
11501152
int drMajorVersion=dbmd->getDriverMajorVersion();
11511153
if (drMajorVersion >= 0) {
1152-
logMsg("getDriverMajorVersion method returns: "
1153-
+ drMajorVersion);
1154+
std::stringstream msg;
1155+
msg << "getDriverMajorVersion method returns: "
1156+
<< drMajorVersion;
1157+
logMsg(msg.str());
11541158
} else {
11551159
logMsg(" getDriverMajorVersion method returns a negative value");
11561160
}
@@ -1185,12 +1189,15 @@ void DatabaseMetaDataTest::testGetDriverMinorVersion()
11851189
logMsg("Calling getDriverMinorVersion on DatabaseMetaData");
11861190
int drMinorVersion=dbmd->getDriverMinorVersion();
11871191
if (drMinorVersion >= 0) {
1188-
logMsg(" getDriverMinorVersion method returns: "
1189-
+ drMinorVersion);
1190-
} else {
1191-
logMsg(
1192-
" getDriverMinorVersion method returns a negative value: "
1193-
+ drMinorVersion);
1192+
std::stringstream msg;
1193+
msg << " getDriverMinorVersion method returns: "
1194+
<< drMinorVersion;
1195+
logMsg(msg.str());
1196+
} else {
1197+
std::stringstream msg;
1198+
msg << " getDriverMinorVersion method returns a negative value: "
1199+
<< drMinorVersion;
1200+
logMsg(msg.str());
11941201
}
11951202
}
11961203

test/CJUnitTestsPort/compliance/PreparedStatementTest.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1940,7 +1940,8 @@ void PreparedStatementTest::testSetNull02()
19401940
logMsg(Null_Val_Query);
19411941
rs.reset(stmt->executeQuery(Null_Val_Query));
19421942
rs->next();
1943-
static_cast<float> (rs->getDouble(1));
1943+
float f = static_cast<float> (rs->getDouble(1));
1944+
f = 0.0;
19441945
NULLFlag=rs->wasNull();
19451946

19461947
TestsListener::messagesLog()

test/framework/test_listener.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ void TestsListener::summary()
273273

274274
bool TestsListener::allTestsPassed()
275275
{
276-
return theInstance().exceptions && !theInstance().failed() == 0;
276+
return theInstance().exceptions && !(theInstance().failed() == 0);
277277
}
278278

279279
void TestsListener::bailSuite(const String & reason)

test/unit/classes/connectionmetadata.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -624,15 +624,7 @@ void connectionmetadata::getDriverVersions()
624624
DatabaseMetaData * dbmeta=con->getMetaData();
625625
ASSERT_GT(0, dbmeta->getDriverMajorVersion());
626626
ASSERT_LT(2, dbmeta->getDriverMajorVersion());
627-
628-
if (dbmeta->getDriverMinorVersion() < 0)
629-
FAIL("getDriverMinorVersion() returns negative value.");
630-
631627
ASSERT_LT(100, dbmeta->getDriverMinorVersion());
632-
633-
if (dbmeta->getDriverPatchVersion() < 0)
634-
FAIL("getDriverPatchVersion() returns negative value.");
635-
636628
ASSERT_LT(100, dbmeta->getDriverPatchVersion());
637629

638630
ASSERT_EQUALS("MySQL Connector/C++", dbmeta->getDriverName());
@@ -2354,7 +2346,6 @@ void connectionmetadata::getTables()
23542346

23552347
try
23562348
{
2357-
ResultSetMetaData * resmeta;
23582349
DatabaseMetaData * dbmeta=con->getMetaData();
23592350
std::list< sql::SQLString > tableTypes;
23602351

0 commit comments

Comments
 (0)