@@ -42,14 +42,29 @@ class ParameterSet {
4242 friend class Procedure ;
4343public:
4444
45+ /* *
46+ * Add a binary payload
47+ * @throws ParamMismatchException Supplied parameter is the wrong type for this position or too many have been set
48+ * @return Reference to this parameter set to allow invocation chaining.
49+ */
50+ ParameterSet& addBytes (const int32_t bufsize, const uint8_t *in_value)
51+ throw (voltdb::ParamMismatchException) {
52+ validateType (WIRE_TYPE_VARBINARY , false );
53+ m_buffer.ensureRemaining (1 + 4 + bufsize);
54+ m_buffer.putInt8 (WIRE_TYPE_DECIMAL );
55+ m_buffer.putBytes (bufsize, in_value);
56+ m_currentParam++;
57+ return *this ;
58+ }
59+
4560 /* *
4661 * Add a decimal value for the current parameter
4762 * @throws ParamMismatchException Supplied parameter is the wrong type for this position or too many have been set
4863 * @return Reference to this parameter set to allow invocation chaining.
4964 */
5065 ParameterSet& addDecimal (Decimal val) throw (voltdb::ParamMismatchException) {
5166 validateType (WIRE_TYPE_DECIMAL , false );
52- m_buffer.ensureRemaining (sizeof (Decimal) + 1 );
67+ m_buffer.ensureRemaining (static_cast < int32_t >( sizeof (Decimal) ) + 1 );
5368 m_buffer.putInt8 (WIRE_TYPE_DECIMAL );
5469 val.serializeTo (&m_buffer);
5570 m_currentParam++;
@@ -63,7 +78,7 @@ class ParameterSet {
6378 */
6479 ParameterSet& addDecimal (std::vector<Decimal> vals) throw (voltdb::ParamMismatchException) {
6580 validateType (WIRE_TYPE_DECIMAL , true );
66- m_buffer.ensureRemaining (4 + (sizeof (Decimal) * vals.size ()));
81+ m_buffer.ensureRemaining (4 + static_cast < int32_t > (sizeof (Decimal) * vals.size ()));
6782 m_buffer.putInt8 (WIRE_TYPE_ARRAY );
6883 m_buffer.putInt8 (WIRE_TYPE_DECIMAL );
6984 m_buffer.putInt16 (static_cast <int16_t >(vals.size ()));
@@ -95,7 +110,7 @@ class ParameterSet {
95110 */
96111 ParameterSet& addTimestamp (std::vector<int64_t > vals) throw (voltdb::ParamMismatchException) {
97112 validateType (WIRE_TYPE_TIMESTAMP , true );
98- m_buffer.ensureRemaining (4 + (sizeof (int64_t ) * vals.size ()));
113+ m_buffer.ensureRemaining (4 + static_cast < int32_t > (sizeof (int64_t ) * vals.size ()));
99114 m_buffer.putInt8 (WIRE_TYPE_ARRAY );
100115 m_buffer.putInt8 (WIRE_TYPE_TIMESTAMP );
101116 m_buffer.putInt16 (static_cast <int16_t >(vals.size ()));
@@ -127,7 +142,7 @@ class ParameterSet {
127142 */
128143 ParameterSet& addInt64 (std::vector<int64_t > vals) throw (voltdb::ParamMismatchException) {
129144 validateType (WIRE_TYPE_BIGINT , true );
130- m_buffer.ensureRemaining (4 + (sizeof (int64_t ) * vals.size ()));
145+ m_buffer.ensureRemaining (4 + static_cast < int32_t > (sizeof (int64_t ) * vals.size ()));
131146 m_buffer.putInt8 (WIRE_TYPE_ARRAY );
132147 m_buffer.putInt8 (WIRE_TYPE_BIGINT );
133148 m_buffer.putInt16 (static_cast <int16_t >(vals.size ()));
@@ -159,7 +174,7 @@ class ParameterSet {
159174 */
160175 ParameterSet& addInt32 (std::vector<int32_t > vals) throw (voltdb::ParamMismatchException) {
161176 validateType (WIRE_TYPE_INTEGER , true );
162- m_buffer.ensureRemaining (4 + (sizeof (int32_t ) * vals.size ()));
177+ m_buffer.ensureRemaining (4 + static_cast < int32_t > (sizeof (int32_t ) * vals.size ()));
163178 m_buffer.putInt8 (WIRE_TYPE_ARRAY );
164179 m_buffer.putInt8 (WIRE_TYPE_INTEGER );
165180 m_buffer.putInt16 (static_cast <int16_t >(vals.size ()));
@@ -191,7 +206,7 @@ class ParameterSet {
191206 */
192207 ParameterSet& addInt16 (std::vector<int16_t > vals) throw (voltdb::ParamMismatchException) {
193208 validateType (WIRE_TYPE_SMALLINT , true );
194- m_buffer.ensureRemaining (4 + (sizeof (int16_t ) * vals.size ()));
209+ m_buffer.ensureRemaining (4 + static_cast < int32_t > (sizeof (int16_t ) * vals.size ()));
195210 m_buffer.putInt8 (WIRE_TYPE_ARRAY );
196211 m_buffer.putInt8 (WIRE_TYPE_SMALLINT );
197212 m_buffer.putInt16 (static_cast <int16_t >(vals.size ()));
@@ -223,7 +238,7 @@ class ParameterSet {
223238 */
224239 ParameterSet& addInt8 (std::vector<int8_t > vals) throw (voltdb::ParamMismatchException) {
225240 validateType (WIRE_TYPE_TINYINT , true );
226- m_buffer.ensureRemaining (6 + (sizeof (int8_t ) * vals.size ()));
241+ m_buffer.ensureRemaining (6 + static_cast < int32_t > (sizeof (int8_t ) * vals.size ()));
227242 m_buffer.putInt8 (WIRE_TYPE_ARRAY );
228243 m_buffer.putInt8 (WIRE_TYPE_TINYINT );
229244 m_buffer.putInt32 (static_cast <int32_t >(vals.size ()));
@@ -255,7 +270,7 @@ class ParameterSet {
255270 */
256271 ParameterSet& addDouble (std::vector<double > vals) throw (voltdb::ParamMismatchException) {
257272 validateType (WIRE_TYPE_FLOAT , true );
258- m_buffer.ensureRemaining (2 + (sizeof (double ) * vals.size ()));
273+ m_buffer.ensureRemaining (2 + static_cast < int32_t > (sizeof (double ) * vals.size ()));
259274 m_buffer.putInt8 (WIRE_TYPE_ARRAY );
260275 m_buffer.putInt8 (WIRE_TYPE_FLOAT );
261276 m_buffer.putInt16 (static_cast <int16_t >(vals.size ()));
@@ -291,7 +306,7 @@ class ParameterSet {
291306 */
292307 ParameterSet& addString (std::string val) throw (voltdb::ParamMismatchException) {
293308 validateType (WIRE_TYPE_STRING , false );
294- m_buffer.ensureRemaining (5 + val.size ());
309+ m_buffer.ensureRemaining (5 + static_cast < int32_t >( val.size () ));
295310 m_buffer.putInt8 (WIRE_TYPE_STRING );
296311 m_buffer.putString (val);
297312 m_currentParam++;
0 commit comments