Method Sql.Sql()
- Method
Sql
ConnectionSql(__deprecated__(Connection)con)
ConnectionSql(__deprecated__(Connection)con,stringdb)- Description
Create a new generic SQL connection (DEPRECATED).
- Parameter
con Use this connection to access the SQL-database.
- Parameter
db Select this database.
- Note
In Pike 8.1 and later this function is essentially a noop; if you actually need it, you may want to use 8.0::Sql.Sql.
- Returns
Returns con.
- See also
- Method
Sql
ConnectionSql(stringhost)
ConnectionSql(stringhost,stringdb)
ConnectionSql(stringhost,mapping(string:int|string)options)
ConnectionSql(stringhost,stringdb,stringuser)
ConnectionSql(stringhost,stringdb,stringuser,stringpassword)
ConnectionSql(stringhost,stringdb,stringuser,stringpassword,mapping(string:int|string)options)- Description
Create a new generic SQL connection.
- Parameter
host stringConnect to the server specified. The string should be on the format: dbtype://[user[:password]@]hostname[:port][/database] Use the dbtype protocol to connect to the database server on the specified host. If the hostname is
""then the port can be a file name to access through a UNIX-domain socket or similar, e g"mysql://root@:/tmp/mysql.sock/".There is a special dbtype
"mysqls"which works like"mysql"but sets the CLIENT_SSL option and loads the /etc/my.cnf config file to find the SSL parameters. The same function can be achieved using the"mysql"dbtype.int(0)Access through a UNIX-domain socket or similar.
- Parameter
db Select this database.
- Parameter
user User name to access the database as.
- Parameter
password Password to access the database.
- Parameter
options Optional mapping of options. See the SQL-database documentation for the supported options. (eg Mysql.mysql()->create()).
- Note
In versions of Pike prior to 7.2 it was possible to leave out the dbtype, but that has been deprecated, since it never worked well.
- Note
Exactly which databases are supported by pike depends on the installed set of client libraries when pike was compiled.
The possible ones are
- mysql
libmysql based mysql connection
- mysqls
libmysql based mysql connection, using SSL
- dsn
ODBCbased connection- msql
- odbc
ODBCbased connection- oracle
Oracle using oracle libraries
- pgsql
PostgreSQL direct network access. This module is independent of any external libraries.
- postgres
PostgreSQL libray access. Uses the Postgres module.
- rsql
Remote SQL api, requires a rsql server running on another host. This is an API that uses sockets to communicate with a remote pike running pike -x rsqld on another host.
- sqlite
In-process SQLite database, uses the SQLite module
- sybase
Uses the
sybasemodule to access sybase- tds
Sybase and Microsoft SQL direct network access using the TDS protocol. This module is independent of any external libraries.
- Note
Support for options was added in Pike 7.3.
- Note
Use of an object host was deprecated in Pike 8.1.
- Note
Prior to Pike 8.1 this was a wrapper class.
- See also