Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CBRD-24949] CAS Protocol V12, send oracle_compat_number_behavior system parameter to the clients #4620

Merged
merged 3 commits into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/broker/cas.c
Original file line number Diff line number Diff line change
Expand Up @@ -1417,6 +1417,11 @@ cas_main (void)
}
cas_bi_set_cci_pconnect (shm_appl->cci_pconnect);

if (DOES_CLIENT_UNDERSTAND_THE_PROTOCOL (req_info.client_version, PROTOCOL_V12))
{
cas_bi_set_oracle_compat_number_behavior (prm_get_bool_value (PRM_ID_ORACLE_COMPAT_NUMBER_BEHAVIOR));
}

cas_info[CAS_INFO_STATUS] = CAS_INFO_STATUS_ACTIVE;
/* todo: casting T_BROKER_VERSION to T_CAS_PROTOCOL */
cas_send_connect_reply_to_driver ((T_CAS_PROTOCOL) req_info.client_version, client_sock_fd, cas_info);
Expand Down
15 changes: 15 additions & 0 deletions src/broker/cas_meta.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,21 @@ cas_bi_get_cci_pconnect (void)
return broker_info[BROKER_INFO_CCI_PCONNECT];
}

void
cas_bi_set_oracle_compat_number_behavior (char oracle_compat_number_behavior)
{
assert (oracle_compat_number_behavior == 0 || oracle_compat_number_behavior == 1);

if (oracle_compat_number_behavior)
{
SET_BIT (broker_info[BROKER_INFO_SYSTEM_PARAM], MASK_ORACLE_COMPAT_NUMBER_BEHAVIOR);
}
else
{
CLEAR_BIT (broker_info[BROKER_INFO_SYSTEM_PARAM], MASK_ORACLE_COMPAT_NUMBER_BEHAVIOR);
}
}

void
cas_bi_set_protocol_version (const char protocol_version)
{
Expand Down
12 changes: 10 additions & 2 deletions src/broker/cas_protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,12 @@ extern "C"
#define CCI_PCONNECT_OFF 0
#define CCI_PCONNECT_ON 1

#define ORACLE_COMPAT_NUMBER_BEHAVIOR_NO 0
#define ORACLE_COMPAT_NUMBER_BEHAVIOR_YES 1

/* BITMASK for System Parameter */
#define MASK_ORACLE_COMPAT_NUMBER_BEHAVIOR 0x01 // oracle_compat_number_behavior

#define CAS_REQ_HEADER_JDBC "JDBC"
#define CAS_REQ_HEADER_ODBC "ODBC"
#define CAS_REQ_HEADER_PHP "PHP"
Expand Down Expand Up @@ -233,7 +239,8 @@ extern "C"
PROTOCOL_V9 = 9, /* cas health check: get function status */
PROTOCOL_V10 = 10, /* Secure Broker/CAS using SSL */
PROTOCOL_V11 = 11, /* make out resultset */
CURRENT_PROTOCOL = PROTOCOL_V11
PROTOCOL_V12 = 12, /* Remove trailing zeros from double and float types */
CURRENT_PROTOCOL = PROTOCOL_V12
};
typedef enum t_cas_protocol T_CAS_PROTOCOL;

Expand All @@ -245,7 +252,7 @@ extern "C"
BROKER_INFO_CCI_PCONNECT,
BROKER_INFO_PROTO_VERSION,
BROKER_INFO_FUNCTION_FLAG,
BROKER_INFO_RESERVED2,
BROKER_INFO_SYSTEM_PARAM,
BROKER_INFO_RESERVED3
};
typedef enum t_broker_info_pos T_BROKER_INFO_POS;
Expand Down Expand Up @@ -358,6 +365,7 @@ extern "C"
extern char cas_bi_get_statement_pooling (void);
extern void cas_bi_set_cci_pconnect (const char cci_pconnect);
extern char cas_bi_get_cci_pconnect (void);
extern void cas_bi_set_oracle_compat_number_behavior ( char oracle_compat_number_behavior);
extern void cas_bi_set_protocol_version (const char protocol_version);
extern char cas_bi_get_protocol_version (void);
extern void cas_bi_set_renewed_error_code (const bool renewed_error_code);
Expand Down