diff --git a/reference/mssql/constants.xml b/reference/mssql/constants.xml index 01edd747cf..d23d94eac7 100644 --- a/reference/mssql/constants.xml +++ b/reference/mssql/constants.xml @@ -1,5 +1,5 @@ - + &reftitle.constants; &extension.constants; @@ -11,7 +11,9 @@ - + Return an associative array. Used on + mssql_fetch_array's + result_type parameter. @@ -22,7 +24,9 @@ - + Return an array with numeric keys. Used on + mssql_fetch_array's + result_type parameter. @@ -33,7 +37,10 @@ - + Return an array with both numeric keys and + keys with their field name. This is the + default value for mssql_fetch_array's + result_type parameter. @@ -44,7 +51,9 @@ - + Indicates the 'TEXT' type in MSSQL, used by + mssql_bind's type + parameter. @@ -55,7 +64,9 @@ - + Indicates the 'VARCHAR' type in MSSQL, used by + mssql_bind's type + parameter. @@ -66,7 +77,9 @@ - + Indicates the 'CHAR' type in MSSQL, used by + mssql_bind's type + parameter. @@ -77,7 +90,7 @@ - + Represents one byte, with a range of -128 to 127. @@ -88,7 +101,8 @@ - + Represents two bytes, with a range of -32768 + to 32767. @@ -99,7 +113,8 @@ - + Represents four bytes, with a range if -2147483648 + to 2147483647. @@ -110,7 +125,9 @@ - + Indicates the 'BIT' type in MSSQL, used by + mssql_bind's type + parameter. @@ -121,7 +138,7 @@ - + Represents an eight byte float. diff --git a/reference/mssql/functions/mssql-bind.xml b/reference/mssql/functions/mssql-bind.xml index d3d80191cc..d7ce9ed3cf 100644 --- a/reference/mssql/functions/mssql-bind.xml +++ b/reference/mssql/functions/mssql-bind.xml @@ -1,5 +1,5 @@ - + mssql_bind @@ -117,22 +117,27 @@ &reftitle.examples; - <function>mssql_bind</function> Example + <function>mssql_bind</function> example ]]> diff --git a/reference/mssql/functions/mssql-connect.xml b/reference/mssql/functions/mssql-connect.xml index 54831e9443..f87920735d 100644 --- a/reference/mssql/functions/mssql-connect.xml +++ b/reference/mssql/functions/mssql-connect.xml @@ -1,5 +1,5 @@ - + mssql_connect @@ -112,7 +112,8 @@ \ +// Server in the this format: \ or +// , when using a non default port number $server = 'KALLESPC\SQLEXPRESS'; $link = mssql_connect($server, 'sa', 'phpfi'); diff --git a/reference/mssql/functions/mssql-data-seek.xml b/reference/mssql/functions/mssql-data-seek.xml index 3061cfd9cf..1c9a272509 100644 --- a/reference/mssql/functions/mssql-data-seek.xml +++ b/reference/mssql/functions/mssql-data-seek.xml @@ -1,5 +1,5 @@ - + mssql_data_seek @@ -52,6 +52,47 @@ &return.success; + + + &reftitle.examples; + + + <function>mssql_fetch_array</function> example + += 13'); + +if(!$result) +{ + die('Query failed.'); +} + +// Select every 4th student in the results +for($i = mssql_num_rows($result) - 1; $i % 4; $i++) +{ + if(!mssql_data_seek($result, $i)) + { + continue; + } + + // Fetch the row ... +} + +// Free the query result +mssql_free_result($result); +?> +]]> + + + + + + mssql_execute @@ -41,6 +41,39 @@ + + &reftitle.examples; + + + <function>mssql_execute</function> example + + +]]> + + + + + &reftitle.notes; diff --git a/reference/mssql/functions/mssql-fetch-array.xml b/reference/mssql/functions/mssql-fetch-array.xml index 73227b0ccc..24bcba87ae 100644 --- a/reference/mssql/functions/mssql-fetch-array.xml +++ b/reference/mssql/functions/mssql-fetch-array.xml @@ -1,5 +1,5 @@ - + mssql_fetch_array @@ -63,6 +63,43 @@ + + &reftitle.examples; + + + <function>mssql_fetch_array</function> example + + +]]> + + + + + &reftitle.notes; &database.field-case; diff --git a/reference/mssql/functions/mssql-fetch-assoc.xml b/reference/mssql/functions/mssql-fetch-assoc.xml index b4b56fd45f..74996bbff5 100644 --- a/reference/mssql/functions/mssql-fetch-assoc.xml +++ b/reference/mssql/functions/mssql-fetch-assoc.xml @@ -1,5 +1,5 @@ - + mssql_fetch_assoc @@ -37,6 +37,46 @@ + + &reftitle.examples; + + + <function>mssql_fetch_assoc</function> example + +'; + + while($row = mssql_fetch_assoc($query)) + { + echo '
  • ' . $row['name'] . ' (' . $row['username'] . ')
  • '; + } + + echo ''; +} + +// Free the query result +mssql_free_result($query); +?> +]]> +
    +
    +
    +
    + &reftitle.returnvalues; diff --git a/reference/mssql/functions/mssql-fetch-batch.xml b/reference/mssql/functions/mssql-fetch-batch.xml index 5dbd3d82bd..df495b9936 100644 --- a/reference/mssql/functions/mssql-fetch-batch.xml +++ b/reference/mssql/functions/mssql-fetch-batch.xml @@ -1,5 +1,5 @@ - + mssql_fetch_batch @@ -45,20 +45,32 @@ &reftitle.examples; - <function>mssql_fetch_batch</function> Example + <function>mssql_fetch_batch</function> example 0) { - while ($arrRow = mssql_fetch_assoc($result)) { - // Do stuff ... - } - $intNumRows = mssql_fetch_batch($result); +while(($records - 1) != -1) +{ + while($row = mssql_fetch_assoc($result)) + { + // Do stuff ... + } + + --$records; +} + +if($batchsize = mssql_fetch_batch($result)) +{ + // $batchsize is the number of records left + // in the result, but not shown above } ?> ]]> diff --git a/reference/mssql/functions/mssql-fetch-field.xml b/reference/mssql/functions/mssql-fetch-field.xml index 7f9016607e..4222d6dd6b 100644 --- a/reference/mssql/functions/mssql-fetch-field.xml +++ b/reference/mssql/functions/mssql-fetch-field.xml @@ -1,5 +1,5 @@ - + mssql_fetch_field @@ -85,6 +85,62 @@ + + &reftitle.examples; + + + <function>mssql_fetch_field</function> example + +Table structure for \'persons\''; +echo ''; + +// Table header +echo ''; +echo ''; +echo ''; +echo ''; +echo ''; +echo ''; +echo ''; + +// Dump all fields +echo ''; + +for($i = 0; $i < mssql_num_fields($query); ++$i) +{ + // Fetch the field information + $field = mssql_fetch_field($query, $i); + + // Print the row + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; +} + +echo ''; +echo '
    Field nameData typeMax length
    ' . $field->name . '' . strtoupper($field->type) . '' . $field->max_length . '
    '; + +// Free the query result +mssql_free_result($query); +?> +]]> +
    +
    +
    +
    + &reftitle.seealso; diff --git a/reference/mssql/functions/mssql-fetch-object.xml b/reference/mssql/functions/mssql-fetch-object.xml index ca4484674c..5324aad8e1 100644 --- a/reference/mssql/functions/mssql-fetch-object.xml +++ b/reference/mssql/functions/mssql-fetch-object.xml @@ -1,5 +1,5 @@ - + mssql_fetch_object @@ -52,6 +52,46 @@ + + &reftitle.examples; + + + <function>mssql_fetch_object</function> example + +'; + + while($row = mssql_fetch_object($query)) + { + echo '
  • ' . $row->name . ' (' . $row->username . ')
  • '; + } + + echo ''; +} + +// Free the query result +mssql_free_result($query); +?> +]]> +
    +
    +
    +
    + &reftitle.notes; &database.field-case; diff --git a/reference/mssql/functions/mssql-fetch-row.xml b/reference/mssql/functions/mssql-fetch-row.xml index 396bbb600d..2ef9e4ed52 100644 --- a/reference/mssql/functions/mssql-fetch-row.xml +++ b/reference/mssql/functions/mssql-fetch-row.xml @@ -1,5 +1,5 @@ - + mssql_fetch_row @@ -50,6 +50,45 @@ + + &reftitle.examples; + + + <function>mssql_field_row</function> example + + +]]> + + &example.outputs.similar; + + + + + + + &reftitle.notes; &database.fetch-null; diff --git a/reference/mssql/functions/mssql-field-length.xml b/reference/mssql/functions/mssql-field-length.xml index cb82021829..0e73399245 100644 --- a/reference/mssql/functions/mssql-field-length.xml +++ b/reference/mssql/functions/mssql-field-length.xml @@ -1,5 +1,5 @@ - + mssql_field_length @@ -51,14 +51,48 @@ + + &reftitle.examples; + + + <function>mssql_field_length</function> example + + +]]> + + &example.outputs.similar; + + + + + + + &reftitle.notes; - Note to Win32 Users + Note to Windows Users - Due to a limitation in the underlying API used by PHP (MS DbLib C API), - the length of VARCHAR fields is limited to 255. If - you need to store more data, use a TEXT field instead. + Due to a limitation in the underlying API used by PHP (MS DBLib C API), + the length of VARCHAR fields is limited to + 255. If you need to store more data, use a + TEXT field instead. diff --git a/reference/mssql/functions/mssql-field-name.xml b/reference/mssql/functions/mssql-field-name.xml index 96109ea8fc..e87441fbb3 100644 --- a/reference/mssql/functions/mssql-field-name.xml +++ b/reference/mssql/functions/mssql-field-name.xml @@ -1,5 +1,5 @@ - + mssql_field_name @@ -51,6 +51,43 @@ + + &reftitle.examples; + + + <function>mssql_field_name</function> example + + +]]> + + &example.outputs.similar; + + + + + + + &reftitle.seealso; diff --git a/reference/mssql/functions/mssql-field-seek.xml b/reference/mssql/functions/mssql-field-seek.xml index a342210268..4fb0326549 100644 --- a/reference/mssql/functions/mssql-field-seek.xml +++ b/reference/mssql/functions/mssql-field-seek.xml @@ -1,5 +1,5 @@ - + mssql_field_seek @@ -52,6 +52,68 @@ + + &reftitle.examples; + + + Using <function>mssql_field_type</function> on the example for <function>mssql_fetch_field</function> + +Table structure for \'persons\''; +echo ''; + +// Table header +echo ''; +echo ''; +echo ''; +echo ''; +echo ''; +echo ''; +echo ''; + +// Dump all fields +echo ''; + +for($i = 0; $i < mssql_num_fields($query); ++$i) +{ + // Fetch the field information, notice the + // field_offset parameter is not set. See + // the mssql_field_seek call below + $field = mssql_fetch_field($query); + + // Print the row + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + + // Move the internal seek pointer to the next + // row in the result set + mssql_field_seek($query, $i + 1); +} + +echo ''; +echo '
    Field nameData typeMax length
    ' . $field->name . '' . strtoupper($field->type) . '' . $field->max_length . '
    '; + +// Free the query result +mssql_free_result($query); +?> +]]> +
    +
    +
    +
    + &reftitle.seealso; diff --git a/reference/mssql/functions/mssql-field-type.xml b/reference/mssql/functions/mssql-field-type.xml index 6b9eb77c51..585ddc799e 100644 --- a/reference/mssql/functions/mssql-field-type.xml +++ b/reference/mssql/functions/mssql-field-type.xml @@ -1,5 +1,5 @@ - + mssql_field_type @@ -51,6 +51,41 @@ + + &reftitle.examples; + + + <function>mssql_field_type</function> example + + +]]> + + &example.outputs.similar; + + + + + + + &reftitle.seealso; diff --git a/reference/mssql/functions/mssql-free-result.xml b/reference/mssql/functions/mssql-free-result.xml index 9b745f2986..c64661f122 100644 --- a/reference/mssql/functions/mssql-free-result.xml +++ b/reference/mssql/functions/mssql-free-result.xml @@ -1,5 +1,5 @@ - + mssql_free_result @@ -45,6 +45,38 @@ &return.success; + + + &reftitle.examples; + + + <function>mssql_free_result</function> example + + + + + + + + + &reftitle.seealso; + + + mssql_free_statement + + + +
    + mssql_free_statement @@ -45,6 +45,29 @@ + + &reftitle.examples; + + + <function>mssql_free_statement</function> example + + +]]> + + + + + &reftitle.seealso; @@ -52,6 +75,7 @@ mssql_bind mssql_execute mssql_init + mssql_free_result diff --git a/reference/mssql/functions/mssql-get-last-message.xml b/reference/mssql/functions/mssql-get-last-message.xml index ef8b3c77c6..6e9128df5f 100644 --- a/reference/mssql/functions/mssql-get-last-message.xml +++ b/reference/mssql/functions/mssql-get-last-message.xml @@ -1,5 +1,5 @@ - + mssql_get_last_message @@ -10,11 +10,68 @@ &reftitle.description; stringmssql_get_last_message - + + + Gets the last message from the MS-SQL server + + - &warn.undocumented.func; + + &reftitle.parameters; + &no.function.parameters; + + + &reftitle.returnvalues; + + Returns last error message from server, or an empty string if + no error messages are returned from MSSQL. + + + + + &reftitle.examples; + + + <function>mssql_get_last_message</function> example + + +]]> + + &example.outputs; + + + + + + + + + &reftitle.seealso; + + + mssql_min_error_severity + mssql_min_message_Severity + + diff --git a/reference/mssql/functions/mssql-guid-string.xml b/reference/mssql/functions/mssql-guid-string.xml index 8476f331d6..3bfba4b7eb 100644 --- a/reference/mssql/functions/mssql-guid-string.xml +++ b/reference/mssql/functions/mssql-guid-string.xml @@ -1,5 +1,5 @@ - + mssql_guid_string @@ -34,7 +34,7 @@ short_format - ... + Whenever to use short to use short format, defaults to &false; @@ -49,6 +49,32 @@ + + &reftitle.examples; + + + <function>mssql_guid_string</function> example + + +]]> + + &example.outputs; + + + + + + + + mssql_init @@ -53,6 +53,42 @@ + + &reftitle.examples; + + + <function>mssql_init</function> example + + +]]> + + &example.outputs; + + + + + + + &reftitle.seealso; diff --git a/reference/mssql/functions/mssql-min-error-severity.xml b/reference/mssql/functions/mssql-min-error-severity.xml index 596d1f1fd7..ce1e67f3d8 100644 --- a/reference/mssql/functions/mssql-min-error-severity.xml +++ b/reference/mssql/functions/mssql-min-error-severity.xml @@ -1,9 +1,9 @@ - + mssql_min_error_severity - Sets the lower error severity + Sets the minimum error severity @@ -12,9 +12,9 @@ voidmssql_min_error_severity intseverity - - &warn.undocumented.func; - + + Sets the minimum error severity. + @@ -25,6 +25,7 @@ severity + The new error severity. @@ -38,6 +39,40 @@ &return.void; + + + &reftitle.examples; + + + <function>mssql_min_message_severity</function> example + + +]]> + + + + + + mssql_min_message_severity - Sets the lower message severity + Sets the minimum message severity @@ -12,9 +12,9 @@ voidmssql_min_message_severity intseverity - - &warn.undocumented.func; - + + Sets the minimum message severity. + @@ -25,6 +25,7 @@ severity + The new message severity. @@ -38,6 +39,38 @@ &return.void; + + + &reftitle.examples; + + + <function>mssql_min_message_severity</function> example + + +]]> + + &example.outputs; + + + + + + + + mssql_next_result @@ -55,15 +55,26 @@ ]]> diff --git a/reference/mssql/functions/mssql-num-fields.xml b/reference/mssql/functions/mssql-num-fields.xml index 2338f89f9c..2570a09153 100644 --- a/reference/mssql/functions/mssql-num-fields.xml +++ b/reference/mssql/functions/mssql-num-fields.xml @@ -1,5 +1,5 @@ - + mssql_num_fields @@ -42,6 +42,72 @@ + + &reftitle.examples; + + + <function>mssql_num_fields</function> example + +'; + +$header = false; + +// Iterate through returned results +while($row = mssql_fetch_array($data)) +{ + // Build the table header + if(!$header) + { + echo ''; + echo ''; + + for($i = 1; ($i + 1) <= mssql_num_fields($data); ++$i) + { + echo '' . ucfirst($row[$i]) . ''; + } + + echo ''; + echo ''; + echo ''; + + $header = true; + } + + // Build the row + echo ''; + + foreach($row as $value) + { + echo '' . $value . ''; + } + + echo ''; +} + +// Close table +echo ''; +echo ''; + +// Clean up +mssql_free_result($data); +mssql_close($link); +?> +]]> + + + + + &reftitle.seealso; diff --git a/reference/mssql/functions/mssql-pconnect.xml b/reference/mssql/functions/mssql-pconnect.xml index d83d92d2a1..cd85ef95a2 100644 --- a/reference/mssql/functions/mssql-pconnect.xml +++ b/reference/mssql/functions/mssql-pconnect.xml @@ -1,5 +1,5 @@ - + mssql_pconnect @@ -90,6 +90,29 @@ &false; on error. + + + &reftitle.examples; + + + <function>mssql_pconnect</function> using the <parameter>new_link</parameter> example + + +]]> + + + + + + mssql_query @@ -77,8 +77,12 @@ - + mssql_result @@ -71,6 +71,77 @@ + + &reftitle.examples; + + + <function>mssql_result</function> example + + +]]> + + &example.outputs.similar; + + + + + + + + Faster alternative to above example + + +]]> + + + + + &reftitle.notes; @@ -90,6 +161,7 @@ mssql_fetch_row mssql_fetch_array + mssql_fetch_assoc mssql_fetch_object diff --git a/reference/mssql/functions/mssql-rows-affected.xml b/reference/mssql/functions/mssql-rows-affected.xml index 0b862df247..9cbae7e94c 100644 --- a/reference/mssql/functions/mssql-rows-affected.xml +++ b/reference/mssql/functions/mssql-rows-affected.xml @@ -1,5 +1,5 @@ - + mssql_rows_affected @@ -49,7 +49,7 @@ <function>mssql_rows_affected</function> example - +
    &reftitle.runtime; &extension.runtime; @@ -100,6 +100,12 @@ PHP_INI_ALL Available since PHP 4.3.0. + + mssql.charset + "" + PHP_INI_ALL + Available since PHP 5.1.2 when built with FreeTDS. + diff --git a/reference/mssql/setup.xml b/reference/mssql/setup.xml index 4bd9aba346..4b193d8142 100644 --- a/reference/mssql/setup.xml +++ b/reference/mssql/setup.xml @@ -1,5 +1,5 @@ - + &reftitle.setup; @@ -32,7 +32,7 @@ - In Windows, the DBLIB from Microsoft is used. Functions that return a + On Windows, the DBLIB from Microsoft is used. Functions that return a column name are based on the dbcolname() function in DBLIB. DBLIB was developed for SQL Server 6.x where the max identifier length is 30. For this reason, the maximum column length @@ -43,10 +43,12 @@ On Windows, if you're using MSSQL 2005 or greater you must copy the - ntwdblib.dll into the directory where you have installed php and overwrite - the one thats already in there. This is due to the version distributed is - old and outdated. Alternatively you can use the - ODBC extension, to talk to MSSQL. + ntwdblib.dll into the directory where you have + installed php and overwrite the one thats already in there. This is + due to the version distributed is old and outdated. Alternatively you + can use the ODBC extension, + PDO_DBLIB or + PDO_ODBC, to talk to MSSQL.