Goto main content

connect

Connect to a databse

CONNECT

NAME

connect - Connect to a databse

SYNOPSIS

connect(dbhost:string,dbuser:string,dbpass:string,dbname:string,dbchar:string[, dbport);

DESCRIPTION

This function is used to connect to an altername database.

PARAMETERS

dbhost
Host to connect. Default is 127.0.0.1
dbuser
User
dbpass
Password
dbname
Database name
dbport
Database port. Default is 0 which is the normal port. Avalaible at version 5.91.
dbchar
Character set. Default is utf8.

RETURN

This function return a pointer to the database which is used in all database function

EXAMPLES

            a = connect(dbname:"extenso",dbpass:"....",dbuser:"extenso");
            a.type();
            x=sql(db:a,single:true,wantarray:true,"SELECT DATABASE()");
            x.rows[0];
            x=sql(single:true,wantarray:true,"SELECT DATABASE()");
            x.rows[0];
            disconnect(a);

SEE ALSO

{{ include("includes/database.sn") }}

AUTHOR

Written by Pierre Laplante, <laplante@sednove.com>

MODIFICATIONS

1.0 2014-09-09 21:24:14 laplante@sednove.com

1.1 2017-10-23 laplante@sednove.com dbport is available from version 5.91

Edit

© 2024 extenso Inc. All rights reserved.