sybase_select_db
(PHP 4, PHP 5)
sybase_select_db — Selects a Sybase database
Описание
bool sybase_select_db
( string
$database_name
[, resource $link_identifier
] )sybase_select_db() sets the current active database on the server that's associated with the specified link identifier.
Every subsequent call to sybase_query() will be made on the active database.
Список параметров
-
database_name
-
-
link_identifier
-
If no link identifier is specified, the last opened link is assumed. If no link is open, the function will try to establish a link as if sybase_connect() was called, and use it.
Возвращаемые значения
Возвращает TRUE
в случае успешного завершения или FALSE
в случае возникновения ошибки.
Смотрите также
- sybase_connect() - Opens a Sybase server connection
- sybase_pconnect() - Open persistent Sybase connection
- sybase_query() - Sends a Sybase query
- PHP Руководство
- Функции по категориям
- Индекс функций
- Справочник функций
- Расширения для работы с базами данных
- Расширения для работы с базами данных отдельных производителей
- Sybase
- sybase_affected_rows
- sybase_close
- sybase_connect
- sybase_data_seek
- sybase_deadlock_retry_count
- sybase_fetch_array
- sybase_fetch_assoc
- sybase_fetch_field
- sybase_fetch_object
- sybase_fetch_row
- sybase_field_seek
- sybase_free_result
- sybase_get_last_message
- sybase_min_client_severity
- sybase_min_error_severity
- sybase_min_message_severity
- sybase_min_server_severity
- sybase_num_fields
- sybase_num_rows
- sybase_pconnect
- sybase_query
- sybase_result
- sybase_select_db
- sybase_set_message_handler
- sybase_unbuffered_query
Коментарии
Using this function is not required under Sybase, because Sybase SQL Server users can be configured with a default database to use at connection time. You only need this function if your SQL Server has multiple database names, and you want to switch your queries from one database to another one on the same SQLServer, for example if the connection user name has "master" as its default database name and you want to process queries in your application database, or if the username (in fact the loginname in Sybase terminology) has an application database configured for its default database, and you want to process some queries in the "master", "tempdb", or "sybsystemprocs" database.
When you call this function, and it returns successfully, the "username" parameter in the sybase_connect or sybase_pconnect function calls is NOT the user name that holds the access rights in that database. In fact, the "username" is used by Sybase only as a loginname for the SQL Server, and it is mapped to a database-specific username according to the contents of the database sysusers system table that maps logins to database users. Many databases only have a "dbo" username, whatever the loginname you configured on the server's "master" database; in that case to the database is specified by the default servername for the specified loginname, and the access rights are determined by the database's map in sysusers system table which specifies with login is associated with the "dbo" user. You may elect to configure another user in your application database, with limited granted rights, and then add a new server login with a specific password and this database as its default database to use. Such a configuration will add an extra level of security for your database, avoiding full privileges (thus forbidding alteration of the database schema by PHP3 scripts). You may also give strict grants with select-only access rights to the new user, so that PHP3 will only be able to select data from the database, but won't be granted to modify the database contents.