8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-24 19:23:02 +01:00

added 2 functions, later placed in services

This commit is contained in:
alexpeshkoff 2008-02-02 18:21:39 +00:00
parent f7eb178769
commit c424f3bc3f
2 changed files with 43 additions and 1 deletions

View File

@ -28,6 +28,7 @@
#include "../jrd/gds_proto.h" #include "../jrd/gds_proto.h"
#include "../jrd/msg_encode.h" #include "../jrd/msg_encode.h"
#include "../jrd/iberr.h" #include "../jrd/iberr.h"
#include "../jrd/err_proto.h"
#ifndef INCLUDE_FB_BLK #ifndef INCLUDE_FB_BLK
#include "../include/fb_blk.h" #include "../include/fb_blk.h"
@ -75,7 +76,7 @@ void CMD_UTIL_put_svc_status(ISC_STATUS* svc_status,
// Don't want to overflow the status vector. // Don't want to overflow the status vector.
for (unsigned int loop = 0; loop < 5 && loop < arg.getCount(); ++loop) for (unsigned int loop = 0; loop < 5 && loop < arg.getCount(); ++loop)
{ {
SVC_STATUS_ARG(status, arg.getCell(loop)); CMD_UTIL_put_status_arg(status, arg.getCell(loop));
tmp_status_len += 2; tmp_status_len += 2;
} }
@ -146,3 +147,41 @@ void CMD_UTIL_put_svc_status(ISC_STATUS* svc_status,
} }
} }
void CMD_UTIL_put_status_arg(ISC_STATUS*& status, const MsgFormat::safe_cell& value)
{
using MsgFormat::safe_cell;
switch (value.type)
{
case safe_cell::at_int64:
case safe_cell::at_uint64:
*status++ = isc_arg_number;
*status++ = static_cast<SLONG>(value.i_value); // May truncate number!
break;
case safe_cell::at_str:
{
*status++ = isc_arg_string;
const char* s = value.st_value.s_string;
*status++ = (ISC_STATUS) ERR_cstring(s);
}
break;
case safe_cell::at_counted_str:
{
*status++ = isc_arg_string;
const char* s = value.st_value.s_string;
*status++ = (ISC_STATUS) ERR_string(s, value.st_value.s_len);
}
break;
default:
break;
}
}
void CMD_UTIL_put_status_arg(ISC_STATUS*& status, const char* value)
{
*status++ = isc_arg_string;
*status++ = (ISC_STATUS) ERR_cstring(value);
}

View File

@ -31,5 +31,8 @@ void CMD_UTIL_put_svc_status(ISC_STATUS* svc_status,
USHORT errcode, USHORT errcode,
const MsgFormat::SafeArg& arg = MsgFormat::SafeArg()); const MsgFormat::SafeArg& arg = MsgFormat::SafeArg());
void CMD_UTIL_put_status_arg(ISC_STATUS*& status, const MsgFormat::safe_cell& value);
void CMD_UTIL_put_status_arg(ISC_STATUS*& status, const char* value);
#endif // UTILITIES_CMD_UTIL_PROTO_H #endif // UTILITIES_CMD_UTIL_PROTO_H