diff options
Diffstat (limited to 'src/common/sql.c')
-rw-r--r-- | src/common/sql.c | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/src/common/sql.c b/src/common/sql.c index 1eae1b29b..9a90f9807 100644 --- a/src/common/sql.c +++ b/src/common/sql.c @@ -778,8 +778,6 @@ int SqlStmt_NextRow(struct SqlStmt *self) // check for errors if (err == MYSQL_NO_DATA) return SQL_NO_DATA; -#if defined(MYSQL_DATA_TRUNCATED) - // MySQL 5.0/5.1 defines and returns MYSQL_DATA_TRUNCATED [FlavioJS] if (err == MYSQL_DATA_TRUNCATED) { my_bool truncated; @@ -804,7 +802,6 @@ int SqlStmt_NextRow(struct SqlStmt *self) ShowSQL("DB error - data truncated (unknown source)\n"); return SQL_ERROR; } -#endif if (err) { ShowSQL("DB error - %s\n", mysql_stmt_error(self->stmt)); hercules_mysql_error_handler(mysql_stmt_errno(self->stmt)); @@ -816,18 +813,6 @@ int SqlStmt_NextRow(struct SqlStmt *self) for (i = 0; i < cols; ++i) { unsigned long length = self->column_lengths[i].length; MYSQL_BIND *column = &self->columns[i]; -#if !defined(MYSQL_DATA_TRUNCATED) - // MySQL 4.1/(below?) returns success even if data is truncated, so we test truncation manually [FlavioJS] - if (column->buffer_length < length) { - // report truncated column - if (column->buffer_type == MYSQL_TYPE_STRING || column->buffer_type == MYSQL_TYPE_BLOB) { - // string/enum/blob column - SqlStmt_P_ShowDebugTruncatedColumn(self, i); - return SQL_ERROR; - } - // FIXME numeric types and null [FlavioJS] - } -#endif if (self->column_lengths[i].out_length) *self->column_lengths[i].out_length = (uint32)length; if (column->buffer_type == MYSQL_TYPE_STRING) { @@ -880,10 +865,10 @@ void SqlStmt_Free(struct SqlStmt *self) } /* receives mysql error codes during runtime (not on first-time-connects) */ void hercules_mysql_error_handler(unsigned int ecode) { - static unsigned int retry = 1; switch( ecode ) { case 2003:/* Can't connect to MySQL (this error only happens here when failing to reconnect) */ if( mysql_reconnect_type == 1 ) { + static unsigned int retry = 1; if( ++retry > mysql_reconnect_count ) { ShowFatalError("MySQL has been unreachable for too long, %u reconnects were attempted. Shutting Down\n", retry); exit(EXIT_FAILURE); |