Skip to content

Commit

Permalink
cosmetic changes
Browse files Browse the repository at this point in the history
  • Loading branch information
yukiwongky committed Oct 13, 2017
1 parent 628e04e commit b5a0d1f
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 23 deletions.
4 changes: 2 additions & 2 deletions source/shared/core_stmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ void core_sqlsrv_bind_param( _Inout_ sqlsrv_stmt* stmt, _In_ SQLUSMALLINT param_
}
if( zval_was_long ){
convert_to_string( param_z );
encoding = SQLSRV_ENCODING_SYSTEM;
encoding = SQLSRV_ENCODING_SYSTEM;
match = Z_TYPE_P( param_z ) == IS_STRING;
}
else {
Expand Down Expand Up @@ -565,7 +565,7 @@ void core_sqlsrv_bind_param( _Inout_ sqlsrv_stmt* stmt, _In_ SQLUSMALLINT param_
buffer, buffer_len TSRMLS_CC );

// save the parameter to be adjusted and/or converted after the results are processed
sqlsrv_output_param output_param( param_ref, encoding, param_num, static_cast<SQLUINTEGER>( buffer_len ), zval_was_long );
sqlsrv_output_param output_param( param_ref, encoding, param_num, static_cast<SQLUINTEGER>( buffer_len ), zval_was_long );

save_output_param_for_later( stmt, output_param TSRMLS_CC );

Expand Down
10 changes: 5 additions & 5 deletions test/functional/pdo_sqlsrv/pdo_bigint_outparam.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ $conn = connect();
$tbname = "bigint_table";
createTable($conn, $tbname, array("c1_bigint" => "bigint"));

// Create a Store Procedure
// Create a Stored Procedure
$spname = "selectBigint";
$spSql = "CREATE PROCEDURE $spname (@c1_bigint bigint OUTPUT) AS
SELECT @c1_bigint = c1_bigint FROM $tbname";
Expand All @@ -21,7 +21,7 @@ $conn->query($spSql);
// Insert a large bigint
insertRow($conn, $tbname, array("c1_bigint" => 922337203685479936));

// Call store procedure with output
// Call stored procedure with output
$outSql = "{CALL $spname (?)}";
$bigintOut = 0;
$stmt = $conn->prepare($outSql);
Expand All @@ -31,7 +31,7 @@ printf("Large bigint output:\n" );
var_dump($bigintOut);
printf("\n");

// Call store procedure with inout
// Call stored procedure with inout
$bigintOut = 0;
$stmt = $conn->prepare($outSql);
$stmt->bindParam(1, $bigintOut, PDO::PARAM_INT | PDO::PARAM_INPUT_OUTPUT, PDO::SQLSRV_PARAM_OUT_DEFAULT_SIZE);
Expand All @@ -45,7 +45,7 @@ $conn->exec("TRUNCATE TABLE $tbname");
// Insert a small bigint
insertRow($conn, $tbname, array("c1_bigint" => 922337203));

// Call store procedure with output
// Call stored procedure with output
$bigintOut = 0;
$stmt = $conn->prepare($outSql);
$stmt->bindParam(1, $bigintOut, PDO::PARAM_INT, PDO::SQLSRV_PARAM_OUT_DEFAULT_SIZE);
Expand All @@ -54,7 +54,7 @@ printf("Small bigint output:\n" );
var_dump($bigintOut);
printf("\n");

// Call store procedure with inout
// Call stored procedure with inout
$bigintOut = 0;
$stmt = $conn->prepare($outSql);
$stmt->bindParam(1, $bigintOut, PDO::PARAM_INT | PDO::PARAM_INPUT_OUTPUT, PDO::SQLSRV_PARAM_OUT_DEFAULT_SIZE);
Expand Down
10 changes: 5 additions & 5 deletions test/functional/pdo_sqlsrv/pdo_bool_outparam.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ $conn = connect();
$tbname = "bool_table";
createTable($conn, $tbname, array("c1_bool" => "int"));

// Create a Store Procedure
// Create a Stored Procedure
$spname = "selectBool";
$spSql = "CREATE PROCEDURE $spname (@c1_bool int OUTPUT) AS
SELECT @c1_bool = c1_bool FROM $tbname";
Expand All @@ -21,7 +21,7 @@ $conn->query($spSql);
// Insert 1
insertRow($conn, $tbname, array("c1_bool" => 1));

// Call store procedure with output
// Call stored procedure with output
$outSql = "{CALL $spname (?)}";
$boolOut = false;
$stmt = $conn->prepare($outSql);
Expand All @@ -31,7 +31,7 @@ printf("True bool output:\n" );
var_dump($boolOut);
printf("\n");

// Call store procedure with inout
// Call stored procedure with inout
$boolOut = false;
$stmt = $conn->prepare($outSql);
$stmt->bindParam(1, $boolOut, PDO::PARAM_INT | PDO::PARAM_INPUT_OUTPUT, PDO::SQLSRV_PARAM_OUT_DEFAULT_SIZE);
Expand All @@ -45,7 +45,7 @@ $conn->exec("TRUNCATE TABLE $tbname");
// Insert 0
insertRow($conn, $tbname, array("c1_bool" => 0));

// Call store procedure with output
// Call stored procedure with output
$boolOut = true;
$stmt = $conn->prepare($outSql);
$stmt->bindParam(1, $boolOut, PDO::PARAM_INT, PDO::SQLSRV_PARAM_OUT_DEFAULT_SIZE);
Expand All @@ -54,7 +54,7 @@ printf("True bool output:\n" );
var_dump($boolOut);
printf("\n");

// Call store procedure with inout
// Call stored procedure with inout
$boolOut = true;
$stmt = $conn->prepare($outSql);
$stmt->bindParam(1, $boolOut, PDO::PARAM_INT | PDO::PARAM_INPUT_OUTPUT, PDO::SQLSRV_PARAM_OUT_DEFAULT_SIZE);
Expand Down
12 changes: 6 additions & 6 deletions test/functional/sqlsrv/sqlsrv_bigint_outparam.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ $tbname = "bigint_table";
AE\createTable($conn, $tbname, array(new AE\ColumnMeta("bigint", "c1_bigint")));


// Create a Store Procedure with output
// Create a Stored Procedure with output
$spname = "selectBigint";
$spSql = "CREATE PROCEDURE $spname (@c1_bigint bigint OUTPUT) AS
SELECT @c1_bigint = c1_bigint FROM $tbname";
sqlsrv_query( $conn, $spSql );

// Insert a large bigint
AE\insertRow($conn, $tbname, array("c1_bigint" => 922337203685479936));
AE\insertRow($conn, $tbname, array("c1_bigint" => 922,337,203,685,479,936));

// Call store procedure with SQLSRV_PARAM_OUT
// Call stored procedure with SQLSRV_PARAM_OUT
$outSql = "{CALL $spname (?)}";
$bigintOut = 0;
$stmt = sqlsrv_prepare($conn, $outSql, array(array(&$bigintOut, SQLSRV_PARAM_OUT)));
Expand All @@ -31,7 +31,7 @@ printf("Large bigint output:\n");
var_dump($bigintOut);
printf("\n");

// Call store procedure with SQLSRV_PARAM_INOUT
// Call stored procedure with SQLSRV_PARAM_INOUT
$bigintOut = 0;
$stmt = sqlsrv_prepare($conn, $outSql, array(array(&$bigintOut, SQLSRV_PARAM_INOUT)));
sqlsrv_execute($stmt);
Expand All @@ -43,15 +43,15 @@ sqlsrv_query($conn, "TRUNCATE TABLE $tbname");
// Insert a small bigint
AE\insertRow($conn, $tbname, array("c1_bigint" => 922337203));

// Call store procedure with SQLSRV_PARAM_OUT
// Call stored procedure with SQLSRV_PARAM_OUT
$bigintOut = 0;
$stmt = sqlsrv_prepare($conn, $outSql, array(array(&$bigintOut, SQLSRV_PARAM_OUT)));
sqlsrv_execute($stmt);
printf("Small bigint output:\n");
var_dump($bigintOut);
printf("\n");

// Call store procedure with SQLSRV_PARAM_INOUT
// Call stored procedure with SQLSRV_PARAM_INOUT
$bigintOut = 0;
$stmt = sqlsrv_prepare($conn, $outSql, array(array(&$bigintOut, SQLSRV_PARAM_INOUT)));
sqlsrv_execute($stmt);
Expand Down
10 changes: 5 additions & 5 deletions test/functional/sqlsrv/sqlsrv_bool_outparam.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ $tbname = "bool_table";
AE\createTable($conn, $tbname, array(new AE\ColumnMeta("int", "c1_bool")));


// Create a Store Procedure with output
// Create a Stored Procedure with output
$spname = "selectBool";
$spSql = "CREATE PROCEDURE $spname (@c1_bool int OUTPUT) AS
SELECT @c1_bool = c1_bool FROM $tbname";
Expand All @@ -22,7 +22,7 @@ sqlsrv_query( $conn, $spSql );
// Insert 1
AE\insertRow($conn, $tbname, array("c1_bool" => 1));

// Call store procedure with SQLSRV_PARAM_OUT
// Call stored procedure with SQLSRV_PARAM_OUT
$outSql = "{CALL $spname (?)}";
$boolOut = false;
$stmt = sqlsrv_prepare($conn, $outSql, array(array(&$boolOut, SQLSRV_PARAM_OUT, SQLSRV_PHPTYPE_INT)));
Expand All @@ -31,7 +31,7 @@ printf("True bool output:\n");
var_dump($boolOut);
printf("\n");

// Call store procedure with SQLSRV_PARAM_INOUT
// Call stored procedure with SQLSRV_PARAM_INOUT
$boolOut = false;
$stmt = sqlsrv_prepare($conn, $outSql, array(array(&$boolOut, SQLSRV_PARAM_INOUT, SQLSRV_PHPTYPE_INT)));
sqlsrv_execute($stmt);
Expand All @@ -43,15 +43,15 @@ sqlsrv_query($conn, "TRUNCATE TABLE $tbname");
// Insert 0
AE\insertRow($conn, $tbname, array("c1_bool" => 0));

// Call store procedure with SQLSRV_PARAM_OUT
// Call stored procedure with SQLSRV_PARAM_OUT
$boolOut = true;
$stmt = sqlsrv_prepare($conn, $outSql, array(array(&$boolOut, SQLSRV_PARAM_OUT, SQLSRV_PHPTYPE_INT)));
sqlsrv_execute($stmt);
printf("False bool output:\n");
var_dump($boolOut);
printf("\n");

// Call store procedure with SQLSRV_PARAM_INOUT
// Call stored procedure with SQLSRV_PARAM_INOUT
$boolOut = true;
$stmt = sqlsrv_prepare($conn, $outSql, array(array(&$boolOut, SQLSRV_PARAM_INOUT, SQLSRV_PHPTYPE_INT)));
sqlsrv_execute($stmt);
Expand Down

0 comments on commit b5a0d1f

Please sign in to comment.