fix according to code review
This commit is contained in:
parent
cdc60e7018
commit
376461fab4
|
@ -172,6 +172,7 @@ const int SQL_SERVER_MAX_FIELD_SIZE = 8000;
|
|||
const int SQL_SERVER_MAX_PRECISION = 38;
|
||||
const int SQL_SERVER_MAX_TYPE_SIZE = 0;
|
||||
const int SQL_SERVER_MAX_PARAMS = 2100;
|
||||
// increase the maximum message length to accommodate for the long error returned for operand type clash
|
||||
const int SQL_MAX_ERROR_MESSAGE_LENGTH = SQL_MAX_MESSAGE_LENGTH * 4;
|
||||
|
||||
// max size of a date time string when converting from a DateTime object to a string
|
||||
|
@ -2196,14 +2197,14 @@ namespace core {
|
|||
}
|
||||
}
|
||||
|
||||
inline void SQLSetDescField(_Inout_ sqlsrv_stmt* stmt, _In_ SQLSMALLINT rec_num, _In_ SQLSMALLINT fld_id, _In_reads_bytes_opt_(str_len) SQLPOINTER value_ptr, _In_ SQLINTEGER str_len TSRMLS_DC)
|
||||
inline void SQLSetDescField( _Inout_ sqlsrv_stmt* stmt, _In_ SQLSMALLINT rec_num, _In_ SQLSMALLINT fld_id, _In_reads_bytes_opt_( str_len ) SQLPOINTER value_ptr, _In_ SQLINTEGER str_len TSRMLS_DC )
|
||||
{
|
||||
SQLRETURN r;
|
||||
SQLHDESC hIpd = NULL;
|
||||
core::SQLGetStmtAttr(stmt, SQL_ATTR_IMP_PARAM_DESC, &hIpd, 0, 0);
|
||||
r = ::SQLSetDescField(hIpd, rec_num, fld_id, value_ptr, str_len);
|
||||
core::SQLGetStmtAttr( stmt, SQL_ATTR_IMP_PARAM_DESC, &hIpd, 0, 0 );
|
||||
r = ::SQLSetDescField( hIpd, rec_num, fld_id, value_ptr, str_len );
|
||||
|
||||
CHECK_SQL_ERROR_OR_WARNING(r, stmt) {
|
||||
CHECK_SQL_ERROR_OR_WARNING( r, stmt ) {
|
||||
throw CoreException();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -559,6 +559,7 @@ void core_sqlsrv_bind_param( _Inout_ sqlsrv_stmt* stmt, _In_ SQLUSMALLINT param_
|
|||
// avoid this silent truncation, we set the column_size to be "MAX" size for
|
||||
// string types. This will guarantee that there is no silent truncation for
|
||||
// output parameters.
|
||||
// if column encryption is enabled, do not set the length to unlimited since SQLDescribe paramter already derive the length for us
|
||||
if( direction == SQL_PARAM_OUTPUT && !stmt->conn->ce_option.enabled ) {
|
||||
|
||||
switch( sql_type ) {
|
||||
|
@ -2530,7 +2531,7 @@ void resize_output_buffer_if_necessary( _Inout_ sqlsrv_stmt* stmt, _Inout_ zval*
|
|||
SQLULEN field_size = column_size;
|
||||
// with AE on, when column_size is retrieved from SQLDescribeParam, column_size does not include the decimal place
|
||||
// include the decimal for output params by adding elem_size
|
||||
if ( stmt->conn->ce_option.enabled && decimal_digits != 0 )
|
||||
if ( stmt->conn->ce_option.enabled && decimal_digits > 0 )
|
||||
{
|
||||
field_size += elem_size;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue