source: trunk/FACT++/scripts/doc/Database.js@ 14646

Last change on this file since 14646 was 14644, checked in by tbretz, 12 years ago
File size: 2.7 KB
Line 
1/**
2 * @fileOverview
3 * Documentation of Database connection object
4 */
5
6/**
7 * @class
8 *
9 * Returns a connection to a MySQL server or a specific database.
10 *
11 * For connection the MySQL++ library is used. MySQL++ throws exceptions
12 * in case of errors, e.g. connection timeout.<P>
13 *
14 * Note that although the object is created with 'new' and there
15 * is a 'delete' is JavaScript, it will not call any kind of
16 * destructor. To close a Subscription you have to explicitly call
17 * the close() member function. 'delete' in JavaScript is only
18 * to remove a property from an Object.
19 *
20 * @param {String} database
21 * The databse argument is of this form (optional parts ar given in brackets):<br>
22 * <tt>user:password@server.domain.com[:port]/database</tt>
23 *
24 * @throws
25 * <li> If number or type of arguments is wrong
26 * <li> If no connection could be opened, an exception with the reason is
27 * thrown.
28 *
29 * @example
30 * var db = new Database("thomas@sql.at-home.com/database");
31 */
32function Database()
33{
34 /**
35 * User connected to the database
36 * @constant
37 */
38 this.user = user;
39
40 /**
41 * Server which is connected
42 * @constant
43 */
44 this.server = server;
45
46 /**
47 * Database which is connected
48 * @constant
49 */
50 this.database = database;
51
52 /**
53 * Port connected (if no port was given 'undefined')
54 * @constant
55 */
56 this.port = port;
57
58 /**
59 * Returns the result of an sql query sent to the database.
60 *
61 * @param arguments
62 * The arguments specify the query to be sent
63 *
64 * @throws
65 * If no connection could be opened, an exception with the reason is
66 * thrown.
67 *
68 * @returns
69 * An array is returned. Each entry in the array corresponds to one
70 * row of the table and is expressed an an associative array (object).
71 * The names of the entries (columns) in each row are stored in
72 * a property cols which is an array itself. For convenience,
73 * table and query are stored in identically names properties.
74 *
75 * @example
76 * var table = db.query("SELECT * FROM table WHERE value BETWEEN", 5, "AND 20");
77 * for (var row=0; row&lt;table.length; row++)
78 * for (var col in table.cols)
79 * dim.out("table["+row+"]['"+col+"']="+table[row][col]);
80 *
81 */
82 this.query = function() { /* [native code] */ }
83
84 /**
85 *
86 * Close the connection to the database.
87 *
88 * The connection is automaically closed at cript termination.
89 *
90 * @returns {Boolean}
91 * If the connection was successfully closed, i.e. it
92 * was still open, true is returned, false otherwise.
93 *
94 */
95 this.close = function() { /* [native code] */ }
96};
Note: See TracBrowser for help on using the repository browser.