summaryrefslogtreecommitdiff
path: root/libmysqlpp/my-column.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2019-02-17 16:16:00 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2019-02-17 16:16:00 +0000
commit34800459e7645fea3640214b5f7f6d7de183d332 (patch)
tree6c5a18224d3a52a2b9161a05afed2e1a501c6440 /libmysqlpp/my-column.cpp
parentModernize clang tidy fixes (diff)
downloadlibdbpp-mysql-34800459e7645fea3640214b5f7f6d7de183d332.tar.bz2
libdbpp-mysql-34800459e7645fea3640214b5f7f6d7de183d332.tar.xz
libdbpp-mysql-34800459e7645fea3640214b5f7f6d7de183d332.zip
Enable hicpp checks and fix accordingly
Diffstat (limited to 'libmysqlpp/my-column.cpp')
-rw-r--r--libmysqlpp/my-column.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/libmysqlpp/my-column.cpp b/libmysqlpp/my-column.cpp
index 488538e..403933c 100644
--- a/libmysqlpp/my-column.cpp
+++ b/libmysqlpp/my-column.cpp
@@ -5,7 +5,9 @@
#include <boost/date_time/gregorian/gregorian_types.hpp>
MySQL::ColumnBase::ColumnBase(const char * name, unsigned int i) :
- DB::Column(name, i)
+ DB::Column(name, i),
+ is_null(false),
+ length(0)
{
}
@@ -17,21 +19,17 @@ MySQL::ColumnBase::isNull() const
MySQL::StringColumn::StringColumn(const char * name, unsigned int field, MYSQL_BIND * b, unsigned int len) :
ColumnBase(name, field),
- value(new char[len])
+ value(len),
+ length(0)
{
b->is_null = &is_null;
b->buffer_type = MYSQL_TYPE_STRING;
b->is_unsigned = 0;
- b->buffer = value;
+ b->buffer = value.data();
b->buffer_length = len;
b->length = &length;
}
-MySQL::StringColumn::~StringColumn()
-{
- delete[] value;
-}
-
void
MySQL::StringColumn::apply(DB::HandleField & h) const
{
@@ -39,7 +37,7 @@ MySQL::StringColumn::apply(DB::HandleField & h) const
h.null();
}
else {
- h.string({ value, length });
+ h.string({ value.data(), length });
}
}