14#if __DCL_HAVE_ALLOC_DEBUG
15#undef __DCL_ALLOC_LEVEL
16#define __DCL_ALLOC_LEVEL __DCL_ALLOC_INTERNAL
32#define __DCL_TRACE0_N __DCL_TRACE0
33#define __DCL_TRACE1_N __DCL_TRACE1
34#define __DCL_TRACE2_N __DCL_TRACE2
35#define __DCL_TRACE3_N __DCL_TRACE3
36#define __DCL_TRACE4_N __DCL_TRACE4
38#define __DCL_TRACE0_N(fmt)
39#define __DCL_TRACE1_N(fmt, arg)
40#define __DCL_TRACE2_N(fmt, arg1, arg2)
41#define __DCL_TRACE3_N(fmt, arg1, arg2, arg3)
42#define __DCL_TRACE4_N(fmt, arg1, arg2, arg3, arg4)
50#define __SET_ERROR(_error) \
51 connection()->setErrorStatus(_error, __THIS_FILE__, __LINE__)
52#define __SET_ERROR_MSG(_msg) \
53 conn()->setErrorMessage(_msg, __THIS_FILE__, __LINE__)
54#define __SET_ERROR_HANDLE(_rc, _htype, _handle) \
55 conn()->setErrorHandle(_rc, _htype, _handle, __THIS_FILE__, __LINE__)
79 Param::__queryHandle = _query;
91 SQLSMALLINT paramType = SQL_PARAM_TYPE_UNKNOWN;
92 SQLPOINTER valuePtr =
NULL;
99 __bind->lenORind = (SQLLEN)__valSize;
104 __bind->lenORind = SQL_DATA_AT_EXEC;
108 valuePtr =
__bind->valuePtr;
113 __bind->lenORind = SQL_NULL_DATA;
115 paramType = SQL_PARAM_INPUT;
123 memcpy(
__bind->valuePtr, __val, __valSize);
124 __bind->lenORind = (SQLLEN)__valSize;
131 __bind->lenORind = (SQLLEN)read;
138 paramType = SQL_PARAM_INPUT_OUTPUT;
141 paramType = SQL_PARAM_OUTPUT;
143 valuePtr =
__bind->valuePtr;
152 __bind->lenORind = SQL_LEN_DATA_AT_EXEC((SQLLEN)__valSize);
156 __bind->lenORind = SQL_DATA_AT_EXEC;
165 paramType = SQL_PARAM_INPUT_OUTPUT_STREAM;
168 __bind->lenORind = SQL_NULL_DATA;
169 paramType = SQL_PARAM_OUTPUT_STREAM;
173 SQLRETURN rc = SQLBindParameter(
175 paramType,
__bind->valueType,
179 if (rc != SQL_SUCCESS) {
197 SQLRETURN rc = SQLPutData(
query()->stmtHandle(), __val, (SQLLEN)__valSize);
198 if (rc != SQL_SUCCESS) {
210 SQLLEN read =
sizeof(buf);
211 if ((read = input->read(buf, read))) {
212 SQLRETURN rc = SQLPutData(
query()->stmtHandle(), buf, read);
213 if (rc != SQL_SUCCESS) {
278 if (
__bind->valueType == SQL_C_DEFAULT) {
279 __bind->valueType = SQL_C_SLONG;
280 __bind->lenORind =
sizeof(int32_t);
285 if (
__bind->valueType == SQL_C_DEFAULT) {
286 __bind->valueType = SQL_C_ULONG;
287 __bind->lenORind =
sizeof(uint32_t);
292 if (
__bind->valueType == SQL_C_DEFAULT) {
293 __bind->valueType = SQL_C_DOUBLE;
294 __bind->lenORind =
sizeof(double);
299 if (
__bind->valueType == SQL_C_DEFAULT) {
300 __bind->valueType = SQL_C_CHAR;
306 if (
__bind->valueType == SQL_C_DEFAULT) {
307 __bind->valueType = SQL_C_TYPE_DATE;
308 __bind->lenORind =
sizeof(DATE_STRUCT);
314 if (
__bind->valueType == SQL_C_DEFAULT) {
315 __bind->valueType = SQL_C_TYPE_TIME;
316 __bind->lenORind =
sizeof(TIME_STRUCT);
322 if (
__bind->valueType == SQL_C_DEFAULT) {
323 __bind->valueType = SQL_C_TYPE_TIMESTAMP;
324 __bind->lenORind =
sizeof(TIMESTAMP_STRUCT);
329 if (
__bind->valueType == SQL_C_DEFAULT) {
330 __bind->valueType = SQL_C_INTERVAL_YEAR_TO_MONTH;
331 __bind->lenORind =
sizeof(SQL_INTERVAL_STRUCT);
337 if (
__bind->valueType == SQL_C_DEFAULT) {
338 __bind->valueType = SQL_C_INTERVAL_DAY_TO_SECOND;
339 __bind->lenORind =
sizeof(SQL_INTERVAL_STRUCT);
346 if (
__bind->valueType == SQL_C_DEFAULT) {
347 __bind->valueType = SQL_C_CHAR;
355 if (
__bind->valueType == SQL_C_DEFAULT) {
356 __bind->valueType = SQL_C_BINARY;
366 Param::__dataType = __outputType = _sqlType;
375 __bind->valueType = SQL_C_DEFAULT;
376 __bind->lenORind = SQL_NULL_DATA;
404 case sizeof(float) : {
405 *(
double*)
__bind->valuePtr = (
double) * (
float*)_val;
408 case sizeof(double) : {
409 *(
double*)
__bind->valuePtr = *(
double*)_val;
417 __bind->valueType = SQL_C_DOUBLE;
418 __bind->lenORind =
sizeof(double);
424 DATE_STRUCT* date = (DATE_STRUCT*)
__bind->valuePtr;
425 date->year = p->
year;
426 date->month = p->
month;
428 __bind->valueType = SQL_C_TYPE_DATE;
429 __bind->lenORind =
sizeof(DATE_STRUCT);
440 if (p->
frac &&
__bind->type == SQL_SS_TIME2) {
441 SQL_SS_TIME2_STRUCT* time =
442 (SQL_SS_TIME2_STRUCT*)
__bind->valuePtr;
443 time->hour = p->
hour;
444 time->minute = p->
min;
445 time->second = p->
sec;
446 time->fraction = p->
frac;
447 __bind->valueType = SQL_C_SS_TIME2;
448 __bind->lenORind =
sizeof(SQL_SS_TIME2_STRUCT);
451 TIME_STRUCT* time = (TIME_STRUCT*)
__bind->valuePtr;
452 time->hour = p->
hour;
453 time->minute = p->
min;
454 time->second = p->
sec;
455 __bind->valueType = SQL_C_TYPE_TIME;
456 __bind->lenORind =
sizeof(TIME_STRUCT);
469 SQL_SS_TIMESTAMPOFFSET_STRUCT* ts =
470 (SQL_SS_TIMESTAMPOFFSET_STRUCT*)
__bind->valuePtr;
472 ts->month = p->
month;
477 ts->fraction = p->
frac;
478 ts->timezone_hour = p->
tzoff / 60;
479 ts->timezone_minute = p->
tzoff % 60;
480 __bind->valueType = SQL_C_SS_TIMESTAMPOFFSET;
481 __bind->lenORind =
sizeof(SQL_SS_TIMESTAMPOFFSET_STRUCT);
484 TIMESTAMP_STRUCT* ts =
485 (TIMESTAMP_STRUCT*)
__bind->valuePtr;
487 ts->month = p->
month;
492 ts->fraction = p->
frac;
493 __bind->valueType = SQL_C_TYPE_TIMESTAMP;
494 __bind->lenORind =
sizeof(TIMESTAMP_STRUCT);
505#define __ABS(n) (n < 0) ? -n : n
507 SQL_INTERVAL_STRUCT* iv =
508 (SQL_INTERVAL_STRUCT*)
__bind->valuePtr;
510 iv->interval_type = SQL_IS_YEAR_TO_MONTH;
511 iv->interval_sign = p->
years < 0 || p->
months < 0 ? 1 : 0;
512 SQL_YEAR_MONTH_STRUCT& ym = iv->intval.year_month;
515 __bind->valueType = SQL_C_INTERVAL_YEAR_TO_MONTH;
516 __bind->lenORind =
sizeof(SQL_INTERVAL_STRUCT);
519 iv->interval_type = SQL_IS_DAY_TO_SECOND;
520 iv->interval_sign = p->
days
522 SQL_DAY_SECOND_STRUCT& ds = iv->intval.day_second;
528 __bind->valueType = SQL_C_INTERVAL_DAY_TO_SECOND;
529 __bind->lenORind =
sizeof(SQL_INTERVAL_STRUCT);
542 if (
__bind->size && _size != (
size_t)-1) {
547 case SQL_WLONGVARCHAR:
562 __bind->valueType = SQL_C_CHAR;
568 __bind->valueType = SQL_C_BINARY;
590 __valType = _valType;
598 switch (
__bind->valueType) {
600 case SQL_C_SBIGINT: {
602 case sizeof(int8_t) : {
603 *(int64_t*)
__bind->valuePtr = (int64_t) * (int8_t*)_val;
606 case sizeof(int16_t) : {
607 *(int64_t*)
__bind->valuePtr = (int64_t) * (int16_t*)_val;
610 case sizeof(int32_t) : {
611 *(int64_t*)
__bind->valuePtr = (int64_t) * (int32_t*)_val;
614 case sizeof(int64_t) : {
615 *(int64_t*)
__bind->valuePtr = (int64_t) * (int64_t*)_val;
623 __bind->lenORind =
sizeof(int64_t);
626 case SQL_C_UBIGINT: {
628 case sizeof(int8_t) : {
629 *(uint64_t*)
__bind->valuePtr = (uint64_t) * (int8_t*)_val;
632 case sizeof(int16_t) : {
633 *(uint64_t*)
__bind->valuePtr = (uint64_t) * (int16_t*)_val;
636 case sizeof(int32_t) : {
637 *(uint64_t*)
__bind->valuePtr = (uint64_t) * (int32_t*)_val;
640 case sizeof(int64_t) : {
641 *(uint64_t*)
__bind->valuePtr = (uint64_t) * (int64_t*)_val;
649 __bind->lenORind =
sizeof(uint64_t);
655 case sizeof(int8_t) : {
656 *(int32_t*)
__bind->valuePtr = (int32_t) * (int8_t*)_val;
657 __bind->valueType = SQL_C_SLONG;
658 __bind->lenORind =
sizeof(int32_t);
661 case sizeof(int16_t) : {
662 *(int32_t*)
__bind->valuePtr = (int32_t) * (int16_t*)_val;
663 __bind->valueType = SQL_C_SLONG;
664 __bind->lenORind =
sizeof(int32_t);
667 case sizeof(int32_t) : {
668 *(int32_t*)
__bind->valuePtr = (int32_t) * (int32_t*)_val;
669 __bind->valueType = SQL_C_SLONG;
670 __bind->lenORind =
sizeof(int32_t);
673 case sizeof(int64_t) : {
674 *(int64_t*)
__bind->valuePtr = (int64_t) * (int64_t*)_val;
675 __bind->valueType = SQL_C_SBIGINT;
676 __bind->lenORind =
sizeof(int64_t);
691 switch (
__bind->valueType) {
693 case SQL_C_SBIGINT: {
695 case sizeof(int8_t) : {
696 *(int64_t*)
__bind->valuePtr = (int64_t) * (int8_t*)_val;
699 case sizeof(int16_t) : {
700 *(int64_t*)
__bind->valuePtr = (int64_t) * (int16_t*)_val;
703 case sizeof(int32_t) : {
704 *(int64_t*)
__bind->valuePtr = (int64_t) * (int32_t*)_val;
707 case sizeof(int64_t) : {
708 *(int64_t*)
__bind->valuePtr = (int64_t) * (int64_t*)_val;
716 __bind->lenORind =
sizeof(int64_t);
719 case SQL_C_UBIGINT: {
721 case sizeof(int8_t) : {
722 *(uint64_t*)
__bind->valuePtr = (uint64_t) * (int8_t*)_val;
725 case sizeof(int16_t) : {
726 *(uint64_t*)
__bind->valuePtr = (uint64_t) * (int16_t*)_val;
729 case sizeof(int32_t) : {
730 *(uint64_t*)
__bind->valuePtr = (uint64_t) * (int32_t*)_val;
733 case sizeof(int64_t) : {
734 *(uint64_t*)
__bind->valuePtr = (uint64_t) * (int64_t*)_val;
742 __bind->lenORind =
sizeof(uint64_t);
748 case sizeof(uint8_t) : {
749 *(uint32_t*)
__bind->valuePtr = (uint32_t) * (uint8_t*)_val;
750 __bind->valueType = SQL_C_ULONG;
751 __bind->lenORind =
sizeof(uint32_t);
754 case sizeof(uint16_t) : {
755 *(uint32_t*)
__bind->valuePtr = (uint32_t) * (uint16_t*)_val;
756 __bind->valueType = SQL_C_ULONG;
757 __bind->lenORind =
sizeof(uint32_t);
760 case sizeof(uint32_t) : {
761 *(uint32_t*)
__bind->valuePtr = (uint32_t) * (uint32_t*)_val;
762 __bind->valueType = SQL_C_ULONG;
763 __bind->lenORind =
sizeof(uint32_t);
766 case sizeof(uint64_t) : {
767 *(uint64_t*)
__bind->valuePtr = (uint64_t) * (uint64_t*)_val;
768 __bind->valueType = SQL_C_UBIGINT;
769 __bind->lenORind =
sizeof(uint64_t);
#define __DCL_TRACE3_N(fmt, arg1, arg2, arg3)
#define __DCL_TRACE4_N(fmt, arg1, arg2, arg3, arg4)
#define __SET_ERROR_MSG(_message)
#define __SET_ERROR_HANDLE(_SQLCODE)
__DCL_BEGIN_NAMESPACE union __PARAM_BUFFER_MINIMAL PARAM_BUFFER_MINIMAL
#define __DCL_ASSERT(expr)
#define IMPLEMENT_CLASSINFO(class_name, base_class_name)
#define __SET_ERROR(_errorCode)
String toStringAll() const
bool __getData(void *_buf, size_t *_size, SQL::DataType _bufType)
SQL::DataType init(BIND *_bind)
const wchar_t * serverDataTypeName() const
bool __getDataSize(size_t *_size, bool _maxsize)
virtual bool __getData(void *_buf, size_t *_size, SQL::DataType _bufType)
virtual bool __setData(_CONST void *_val, size_t _size, SQL::DataType _valType, SQL::DataType _sqlType)
virtual bool __getDataSize(size_t *_size, bool _maxsize)
bool setInteger(const void *_val, size_t _size)
virtual ODBCQuery * query() const
bool setUInteger(const void *_val, size_t _size)
bool init(SQL::Query *_query, BIND *_bind)
virtual const wchar_t * serverDataTypeName() const
virtual bool __setOutputType(SQL::DataType _sqlType)