Retrieves the precision of a field in a result set.
Syntax
int ads_field_precision ( resource result_id,
int field_number )
Parameters
result_id (I) |
ID of a result set. |
field_number (I) |
Number of the field in the result set. |
Remarks
ads_field_precision returns the length of a field in a result set or returns False in the event of an error. For the field_number parameter, the index of the first field of a result set is 1.
Example
<?
echo "Connecting to Server<br>\n";
$rConn = ads_connect( "DataDirectory=\\\\server1\\share1\\data\\;ServerTypes=2", "", "" );
echo "Connected<br>\n";
echo "Selecting the customers table.<br>\n";
$rResult = ads_do( $rConn, "SELECT * FROM customers" );
echo "Describing the customers table.<br>\n";
$iNumFields =ads_num_fields( $rResult );
echo "The number of fields is: " . $iNumFields . "<br>\n";
for ( $iField = 1; $iField < $iNumFields; $iField++ )
{
echo "Field Number: " . $iField . "<br>\n";
$strField = ads_field_name( $rResult, $iField );
echo " Name: " . $strField . "<br>\n";
$strField = ads_field_type( $rResult, $iField );
echo " Type: " . $strField . "<br>\n";
$iFieldLen = ads_field_len( $rResult, $iField );
echo " Length: " . $iFieldLen . "<br>\n";
$iFieldLen = ads_field_precision( $rResult, $iField );
echo " Precision: " . $iFieldLen . "<br>\n";
$iFieldLen = ads_field_scale( $rResult, $iField );
echo " Scale: " . $iFieldLen. "<br>\n";
}
echo "Closing the connection<br>\n";
ads_close( $rConn );
echo "Disconnected<br>\n";
?>
See Also