fixed indentations
This commit is contained in:
parent
11e29c0ff6
commit
c45853a74c
|
@ -706,9 +706,9 @@ int pdo_sqlsrv_stmt_get_col_data(pdo_stmt_t *stmt, int colno,
|
||||||
sqlsrv_phptype sqlsrv_php_type;
|
sqlsrv_phptype sqlsrv_php_type;
|
||||||
SQLSRV_ASSERT( colno >= 0 && colno < static_cast<int>( driver_stmt->current_meta_data.size()),
|
SQLSRV_ASSERT( colno >= 0 && colno < static_cast<int>( driver_stmt->current_meta_data.size()),
|
||||||
"Invalid column number in pdo_sqlsrv_stmt_get_col_data" );
|
"Invalid column number in pdo_sqlsrv_stmt_get_col_data" );
|
||||||
sqlsrv_php_type = driver_stmt->sql_type_to_php_type(static_cast<SQLUINTEGER>(driver_stmt->current_meta_data[colno]->field_type),
|
sqlsrv_php_type = driver_stmt->sql_type_to_php_type( static_cast<SQLUINTEGER>( driver_stmt->current_meta_data[ colno ]->field_type ),
|
||||||
static_cast<SQLUINTEGER>(driver_stmt->current_meta_data[colno]->field_size),
|
static_cast<SQLUINTEGER>( driver_stmt->current_meta_data[ colno ]->field_size ),
|
||||||
true );
|
true );
|
||||||
|
|
||||||
// set the encoding if the user specified one via bindColumn, otherwise use the statement's encoding
|
// set the encoding if the user specified one via bindColumn, otherwise use the statement's encoding
|
||||||
sqlsrv_php_type.typeinfo.encoding = driver_stmt->encoding();
|
sqlsrv_php_type.typeinfo.encoding = driver_stmt->encoding();
|
||||||
|
@ -817,9 +817,9 @@ int pdo_sqlsrv_stmt_set_attr(pdo_stmt_t *stmt, zend_long attr, zval *val TSRMLS_
|
||||||
core_sqlsrv_set_buffered_query_limit( driver_stmt, val TSRMLS_CC );
|
core_sqlsrv_set_buffered_query_limit( driver_stmt, val TSRMLS_CC );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SQLSRV_ATTR_FETCHES_NUMERIC_TYPE:
|
case SQLSRV_ATTR_FETCHES_NUMERIC_TYPE:
|
||||||
driver_stmt->fetch_numeric = ( zend_is_true( val )) ? true : false;
|
driver_stmt->fetch_numeric = ( zend_is_true( val )) ? true : false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
THROW_PDO_ERROR( driver_stmt, PDO_SQLSRV_ERROR_INVALID_STMT_ATTR );
|
THROW_PDO_ERROR( driver_stmt, PDO_SQLSRV_ERROR_INVALID_STMT_ATTR );
|
||||||
|
@ -1269,7 +1269,7 @@ int pdo_sqlsrv_stmt_param_hook(pdo_stmt_t *stmt,
|
||||||
|
|
||||||
|
|
||||||
// Returns a sqlsrv_phptype for a given SQL Server data type.
|
// Returns a sqlsrv_phptype for a given SQL Server data type.
|
||||||
sqlsrv_phptype pdo_sqlsrv_stmt::sql_type_to_php_type(SQLINTEGER sql_type, SQLUINTEGER size, bool prefer_string_over_stream )
|
sqlsrv_phptype pdo_sqlsrv_stmt::sql_type_to_php_type( SQLINTEGER sql_type, SQLUINTEGER size, bool prefer_string_over_stream )
|
||||||
{
|
{
|
||||||
sqlsrv_phptype sqlsrv_phptype;
|
sqlsrv_phptype sqlsrv_phptype;
|
||||||
int local_encoding = this->encoding();
|
int local_encoding = this->encoding();
|
||||||
|
|
|
@ -1817,8 +1817,8 @@ namespace core {
|
||||||
|
|
||||||
|
|
||||||
inline void SQLColAttribute( sqlsrv_stmt* stmt, SQLUSMALLINT field_index, SQLUSMALLINT field_identifier,
|
inline void SQLColAttribute( sqlsrv_stmt* stmt, SQLUSMALLINT field_index, SQLUSMALLINT field_identifier,
|
||||||
_Out_ SQLPOINTER field_type_char, SQLSMALLINT buffer_length,
|
_Out_ SQLPOINTER field_type_char, SQLSMALLINT buffer_length,
|
||||||
_Out_ SQLSMALLINT* out_buffer_length, _Out_ SQLLEN* field_type_num TSRMLS_DC )
|
_Out_ SQLSMALLINT* out_buffer_length, _Out_ SQLLEN* field_type_num TSRMLS_DC )
|
||||||
{
|
{
|
||||||
SQLRETURN r = ::SQLColAttribute( stmt->handle(), field_index, field_identifier, field_type_char,
|
SQLRETURN r = ::SQLColAttribute( stmt->handle(), field_index, field_identifier, field_type_char,
|
||||||
buffer_length, out_buffer_length, field_type_num );
|
buffer_length, out_buffer_length, field_type_num );
|
||||||
|
@ -1829,11 +1829,11 @@ namespace core {
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SQLColAttributeW( sqlsrv_stmt* stmt, SQLUSMALLINT field_index, SQLUSMALLINT field_identifier,
|
inline void SQLColAttributeW( sqlsrv_stmt* stmt, SQLUSMALLINT field_index, SQLUSMALLINT field_identifier,
|
||||||
_Out_ SQLPOINTER field_type_char, SQLSMALLINT buffer_length,
|
_Out_ SQLPOINTER field_type_char, SQLSMALLINT buffer_length,
|
||||||
_Out_ SQLSMALLINT* out_buffer_length, _Out_ SQLLEN* field_type_num TSRMLS_DC )
|
_Out_ SQLSMALLINT* out_buffer_length, _Out_ SQLLEN* field_type_num TSRMLS_DC )
|
||||||
{
|
{
|
||||||
SQLRETURN r = ::SQLColAttributeW( stmt->handle(), field_index, field_identifier, field_type_char,
|
SQLRETURN r = ::SQLColAttributeW( stmt->handle(), field_index, field_identifier, field_type_char,
|
||||||
buffer_length, out_buffer_length, field_type_num );
|
buffer_length, out_buffer_length, field_type_num );
|
||||||
|
|
||||||
CHECK_SQL_ERROR_OR_WARNING( r, stmt ) {
|
CHECK_SQL_ERROR_OR_WARNING( r, stmt ) {
|
||||||
throw CoreException();
|
throw CoreException();
|
||||||
|
@ -1854,12 +1854,12 @@ namespace core {
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void SQLDescribeColW( sqlsrv_stmt* stmt, SQLSMALLINT colno, _Out_ SQLWCHAR* col_name, SQLSMALLINT col_name_length,
|
inline void SQLDescribeColW( sqlsrv_stmt* stmt, SQLSMALLINT colno, _Out_ SQLWCHAR* col_name, SQLSMALLINT col_name_length,
|
||||||
_Out_ SQLSMALLINT* col_name_length_out, SQLSMALLINT* data_type, _Out_ SQLULEN* col_size,
|
_Out_ SQLSMALLINT* col_name_length_out, SQLSMALLINT* data_type, _Out_ SQLULEN* col_size,
|
||||||
_Out_ SQLSMALLINT* decimal_digits, _Out_ SQLSMALLINT* nullable TSRMLS_DC )
|
_Out_ SQLSMALLINT* decimal_digits, _Out_ SQLSMALLINT* nullable TSRMLS_DC )
|
||||||
{
|
{
|
||||||
SQLRETURN r;
|
SQLRETURN r;
|
||||||
r = ::SQLDescribeColW( stmt->handle(), colno, col_name, col_name_length, col_name_length_out,
|
r = ::SQLDescribeColW( stmt->handle(), colno, col_name, col_name_length, col_name_length_out,
|
||||||
data_type, col_size, decimal_digits, nullable );
|
data_type, col_size, decimal_digits, nullable );
|
||||||
|
|
||||||
CHECK_SQL_ERROR_OR_WARNING( r, stmt ) {
|
CHECK_SQL_ERROR_OR_WARNING( r, stmt ) {
|
||||||
throw CoreException();
|
throw CoreException();
|
||||||
|
|
|
@ -815,19 +815,17 @@ field_meta_data* core_sqlsrv_field_metadata( sqlsrv_stmt* stmt, SQLSMALLINT coln
|
||||||
|
|
||||||
meta_data = new ( sqlsrv_malloc( sizeof( field_meta_data ))) field_meta_data();
|
meta_data = new ( sqlsrv_malloc( sizeof( field_meta_data ))) field_meta_data();
|
||||||
field_name_temp = static_cast<SQLWCHAR*>( sqlsrv_malloc( SS_MAXCOLNAMELEN * 2 + 1 ));
|
field_name_temp = static_cast<SQLWCHAR*>( sqlsrv_malloc( SS_MAXCOLNAMELEN * 2 + 1 ));
|
||||||
SQLSRV_ENCODING encoding = ( (stmt->encoding() == SQLSRV_ENCODING_DEFAULT ) ? stmt->conn->encoding() :
|
SQLSRV_ENCODING encoding = ( (stmt->encoding() == SQLSRV_ENCODING_DEFAULT ) ? stmt->conn->encoding() : stmt->encoding());
|
||||||
stmt->encoding());
|
|
||||||
try{
|
try{
|
||||||
core::SQLDescribeColW( stmt, colno + 1, field_name_temp, SS_MAXCOLNAMELEN * 2 + 1 , &field_len_temp,
|
core::SQLDescribeColW( stmt, colno + 1, field_name_temp, SS_MAXCOLNAMELEN * 2 + 1 , &field_len_temp,
|
||||||
&( meta_data->field_type ), & ( meta_data->field_size ), & ( meta_data->field_scale ),
|
&( meta_data->field_type ), & ( meta_data->field_size ), & ( meta_data->field_scale ),
|
||||||
&( meta_data->field_is_nullable ) TSRMLS_CC );
|
&( meta_data->field_is_nullable ) TSRMLS_CC );
|
||||||
}
|
}
|
||||||
catch ( core::CoreException& e ) {
|
catch ( core::CoreException& e ) {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool converted = convert_string_from_utf16( encoding, field_name_temp,
|
bool converted = convert_string_from_utf16( encoding, field_name_temp, field_len_temp, ( char** ) &( meta_data->field_name ), field_name_len );
|
||||||
field_len_temp, ( char** ) &( meta_data->field_name ), field_name_len );
|
|
||||||
|
|
||||||
CHECK_CUSTOM_ERROR( !converted, stmt, SQLSRV_ERROR_FIELD_ENCODING_TRANSLATE, get_last_error_message() ) {
|
CHECK_CUSTOM_ERROR( !converted, stmt, SQLSRV_ERROR_FIELD_ENCODING_TRANSLATE, get_last_error_message() ) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
|
|
|
@ -1815,39 +1815,34 @@ void fetch_fields_common( _Inout_ ss_sqlsrv_stmt* stmt, zend_long fetch_type, _O
|
||||||
// store them off for successive fetches.
|
// store them off for successive fetches.
|
||||||
if(( fetch_type & SQLSRV_FETCH_ASSOC ) && stmt->fetch_field_names == NULL ) {
|
if(( fetch_type & SQLSRV_FETCH_ASSOC ) && stmt->fetch_field_names == NULL ) {
|
||||||
|
|
||||||
SQLLEN field_name_len = 0;
|
SQLLEN field_name_len = 0;
|
||||||
SQLSMALLINT field_name_len_w = 0;
|
SQLSMALLINT field_name_len_w = 0;
|
||||||
SQLWCHAR field_name_w[( SS_MAXCOLNAMELEN + 1 ) * 2 ] = { L'\0' };
|
SQLWCHAR field_name_w[( SS_MAXCOLNAMELEN + 1 ) * 2 ] = { L'\0' };
|
||||||
sqlsrv_malloc_auto_ptr<char> field_name;
|
sqlsrv_malloc_auto_ptr<char> field_name;
|
||||||
sqlsrv_malloc_auto_ptr<sqlsrv_fetch_field_name> field_names;
|
sqlsrv_malloc_auto_ptr<sqlsrv_fetch_field_name> field_names;
|
||||||
field_names = static_cast<sqlsrv_fetch_field_name*>( sqlsrv_malloc( num_cols * sizeof( sqlsrv_fetch_field_name )));
|
field_names = static_cast<sqlsrv_fetch_field_name*>( sqlsrv_malloc( num_cols * sizeof( sqlsrv_fetch_field_name )));
|
||||||
SQLSRV_ENCODING encoding = (( stmt->encoding() == SQLSRV_ENCODING_DEFAULT ) ? stmt->conn->encoding() :
|
SQLSRV_ENCODING encoding = (( stmt->encoding() == SQLSRV_ENCODING_DEFAULT ) ? stmt->conn->encoding() : stmt->encoding());
|
||||||
stmt->encoding());
|
for( int i = 0; i < num_cols; ++i ) {
|
||||||
for( int i = 0; i < num_cols; ++i ) {
|
|
||||||
|
|
||||||
core::SQLColAttributeW( stmt, i + 1, SQL_DESC_NAME, field_name_w, ( SS_MAXCOLNAMELEN + 1 ) * 2, &field_name_len_w, NULL
|
|
||||||
TSRMLS_CC );
|
|
||||||
|
|
||||||
bool converted = convert_string_from_utf16( encoding, field_name_w,
|
|
||||||
field_name_len_w, ( char** ) &field_name, field_name_len );
|
|
||||||
|
|
||||||
|
core::SQLColAttributeW( stmt, i + 1, SQL_DESC_NAME, field_name_w, ( SS_MAXCOLNAMELEN + 1 ) * 2, &field_name_len_w, NULL TSRMLS_CC );
|
||||||
|
bool converted = convert_string_from_utf16( encoding, field_name_w, field_name_len_w, ( char** ) &field_name, field_name_len );
|
||||||
CHECK_CUSTOM_ERROR( !converted, stmt, SQLSRV_ERROR_FIELD_ENCODING_TRANSLATE, get_last_error_message() ) {
|
CHECK_CUSTOM_ERROR( !converted, stmt, SQLSRV_ERROR_FIELD_ENCODING_TRANSLATE, get_last_error_message() ) {
|
||||||
throw core::CoreException();
|
throw core::CoreException();
|
||||||
}
|
}
|
||||||
|
|
||||||
field_names[i].name = static_cast<char*>( sqlsrv_malloc( field_name_len, sizeof( char ), 1 ));
|
field_names[i].name = static_cast<char*>( sqlsrv_malloc( field_name_len, sizeof( char ), 1 ));
|
||||||
memcpy_s(( void* )field_names[i].name, ( field_name_len * sizeof( char )) , ( void* ) field_name, field_name_len );
|
memcpy_s(( void* )field_names[i].name, ( field_name_len * sizeof( char )) , ( void* ) field_name, field_name_len );
|
||||||
field_names[i].name[field_name_len] = '\0'; // null terminate the field name since SQLColAttribute doesn't.
|
field_names[i].name[field_name_len] = '\0'; // null terminate the field name since SQLColAttribute doesn't.
|
||||||
field_names[i].len = field_name_len + 1;
|
field_names[i].len = field_name_len + 1;
|
||||||
field_name.reset();
|
field_name.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stmt->fetch_field_names = field_names;
|
||||||
|
stmt->fetch_fields_count = num_cols;
|
||||||
|
field_names.transferred();
|
||||||
|
}
|
||||||
|
|
||||||
stmt->fetch_field_names = field_names;
|
int zr = array_init( &fields );
|
||||||
stmt->fetch_fields_count = num_cols;
|
|
||||||
field_names.transferred();
|
|
||||||
}
|
|
||||||
|
|
||||||
int zr = array_init( &fields );
|
|
||||||
CHECK_ZEND_ERROR( zr, stmt, SQLSRV_ERROR_ZEND_HASH ) {
|
CHECK_ZEND_ERROR( zr, stmt, SQLSRV_ERROR_ZEND_HASH ) {
|
||||||
throw ss::SSException();
|
throw ss::SSException();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue