1MyDB.connect(3kaya) Kaya module reference MyDB.connect(3kaya)
2
3
4
6 MyDB::connect - Connect to a database.
7
9 MyDB connect( String host, String user, String pwd, String db, Int
10 port=0 )
11
13 host The database host to connect to
14
15 user The database user to connect as
16
17 pwd The password for that user
18
19 db The database to connect to
20
21 port The port that the database server is running on. This defaults to
22 zero, which is suitable when connecting to a server on 'localhost'. The
23 usual MySQL port for remote servers is 3306.
24
26 Use this function to connect to the database. You can then use the
27 functions from DB(3kaya) to query the database.
28
29
30 db = MyDB::connect("localhost","web","WHSpWXPPh5","mysite");
31 res = exec(db,"SELECT * FROM pagedata WHERE page_id = 10");
32
34 Kaya standard library by Edwin Brady, Chris Morris and others
35 (kaya@kayalang.org). For further information see http://kayalang.org/
36
38 The Kaya standard library is free software; you can redistribute it
39 and/or modify it under the terms of the GNU Lesser General Public
40 License (version 2.1 or any later version) as published by the Free
41 Software Foundation.
42
44 DB(3kaya)
45
46
47
48Kaya December 2010 MyDB.connect(3kaya)