This function library is almost exactly the same as the SQL Server database function library, which is actually the first occurrence of this function before the SQL Server database function library appears.
Sybase and MS SQL Server 6.x are almost identical to the user's point of view. Of course, the difference after MS SQL Server 7.0 is quite large.
Sybase_affected_rows: Gets the number of columns affected by the last query.
Sybase_close: Closes the connection to the database.
Sybase_connect: Connect to the database.
Sybase_data_seek: Move the column pointer.
Sybase_fetch_array: Returns the array data.
Sybase_fetch_field: Get field information.
Sybase_fetch_object: Return class data.
Sybase_fetch_row: Returns the individual fields of a single column.
Sybase_field_seek: Configures a pointer to a field that returns a value.
Sybase_free_result: Free back to occupy memory.
Sybase_num_fields: Gets the number of returned fields.
Sybase_num_rows: Gets the number of returned columns.
Sybase_pconnect: Open Server continuous connection.
Sybase_query: Send out a query string.
Sybase_result: Gets the results of the query.
SYBASE_SELECT_DB: Select a database.
Sybase_affected_rows
Gets the number of columns affected by the last query.
Syntax: int sybase_affected_rows (int [link_identifier]);
return value: Integer
Function Type: Database function
Description: This function is used to get the last number of columns affected by the query command on the database, such as INSERT, UPDATE, or DELETE directives, while the SELECT does not affect. Parameter link_identifier can be omitted to open the connection code for the database. The return value is the number of columns.
Sybase_close
Closes the connection to the database.
Syntax: boolean sybase_close (int link_identifier);
Return Value: Boolean value
Function Type: Database function
Content Description: This function is used to close the connection to Sybase database, can be closed for the use of the Sybase_connect () function Open database, if the use of Sybase_pconnect () Open database can not be closed with this function. Parameter link_identifier can be omitted to open the connection code for the database. Returns a true value if the shutdown succeeds.
Reference: Sybase_connect () Sybase_pconnect ()
Sybase_connect
Connect to the database.
Syntax: int sybase_connect (string [servername], string [username], string [password]);
return value: Integer
Function Type: Database function
Content Description: This function is used to open a connection to the Sybase database. parameter servername is the name of the database server you want to connect to. Parameters username and password can be omitted, respectively, for the connection to use the account number and password. Use this function to pay attention to the early shutdown of the database to reduce the burden on the system. Successful connection returns the connection code for the database, and the failure returns a value of false.
Reference: Sybase_close () Sybase_pconnect ()
Sybase_data_seek
Move the column pointer.
Syntax: boolean sybase_data_seek (int result_identifier, int row_number);
Return Value: Boolean value
Function Type: Database function
Description: This function is used to move the column pointer in the Sybase table to the specified column, which can be used by functions such as Sybase_fetch_row (). The parameter result_identifier is the code value for the query. Parameter row_number is the number of columns you want to move to. Returns a value of False if it fails.
Reference: Sybase_close () Sybase_pconnect ()
Sybase_fetch_array
Returns the array data.
Syntax: array sybase_fetch_array (int result);
return value: Array
Function Type: Database function
Description: This function is used to split query result results into an array variable. Returns the value of False if result has no data. This function can be said to be a sybase_fetch_row (), in addition to the return column and the numeric index can be placed in the array, you can also put the text index into the array.
Usage examples
This is an example of joey@samaritan.com (22-feb-1999)
<?php
$q = Sybase_query ("Select COUNT (DISTINCT opportun99vy_id) from m_opp_interests WHERE interest_id = $i _id", $db);
while ($op _by_int = Sybase_fetch_arr
Ay ($q)) {
while (the list ($k, $v) = each ($op _by_int)) {
echo "\ $op [$k] => $v \ n";
}
?>
The return information is as follows
$op [0] => 2164
$OP [computed] => 2164 Sybase_fetch_field
Gets the field information.
Syntax: Object Sybase_fetch_field (int result, int field_offset);
Return value: Class
Types of functions: mathematical operations
Content Description: The class data returned by this function is the field (Column) information for result. The properties of the returned class are as follows:
Name-Field names
Column_source-table name of the table in which the field is located
Max_length-Maximum length of field
Numeric-If 1 indicates that this field is a numeric type (numeric)
Reference: Sybase_field_seek ()
Sybase_fetch_object
Returns the class data.
Syntax: Object sybase_fetch_object (int result);
Return value: Class
Function Type: Database function
Description: This function is used to split query result results into class variables. The use method is almost the same as Sybase_fetch_array (), except that the return data for this function is a class rather than an array. Returns the value of False if result has no data. It is also noteworthy that the index of the retrieved class data can only be text but not numbers, because of the attributes of the class. All property names in attributes of class data cannot be numbers, so you have to use literal strings as indexes. With regard to speed, the processing speed of this function is almost the same as that of Sybase_fetch_array () and Sybase_fetch_row () two functions, which function to use or to see the requirements of the use of the decision.
Reference: Sybase_fetch_array () Sybase_fetch_row ()
Sybase_fetch_row
Returns the individual fields of a single column.
Syntax: array sybase_fetch_row (int result);
return value: Array
Function Type: Database function
Description: This function is used to disassemble the result of query results into an array variable. The index of an array is a numeric index, and the first index value is 0. Returns the value of False if result has no data.
Reference: Sybase_fetch_array () Sybase_fetch_object () Sybase_data_seek () Sybase_result ()
Sybase_field_seek
Configure the pointer to a field that returns a value.
Syntax: int sybase_field_seek (int result, int field_offset);
return value: Integer
Function Type: Database function
Description: This function configures the current pointer to a specific field of the returned value. The argument result is the return value code. The parameter field_offset is the specified field ordinal.
Reference: Sybase_fetch_field ()
Sybase_free_result
Release returns memory consumption.
Syntax: int sybase_free_result (int result);
return value: Integer
Function Type: Database function
Description: This function frees up memory used by the current Sybase database query return. This function is typically used only if you are very concerned about the likelihood that the memory may not be sufficient for use. The PHP program is automatically released at the end.
Sybase_num_fields
Gets the number of returned fields.
Syntax: int sybase_num_fields (int result);
return value: Integer
Function Type: Database function
Content Description: This function can get the number of returned fields. The argument result is the return value code.