Method Msql.msql()->create()
- Method create
Msql.msql Msql.msql(
void
|string
dbserver
,void
|string
dbname
,void
|string
username
,void
|string
passwd
)- Description
With one argument, this function tries to connect to the specified (use hostname or IP address) database server. To connect to a server running on the local host via UNIX domain sockets use
"localhost"
. To connect to the local host via TCP/IP sockets you have to use the IP address"127.0.0.1"
. With two arguments it also selects a database to use on the server. With no arguments it tries to connect to the server on localhost, using UNIX sockets.- Throws
You need to have a database selected before using the sql-object, otherwise you'll get exceptions when you try to query it. Also notice that this function can raise exceptions if the db server doesn't respond, if the database doesn't exist or is not accessible by you.
- Note
You don't need bothering about syncronizing the connection to the database: it is automatically closed (and the database is sync-ed) when the msql object is destroyed.
- See also