source: branches/FACT++_lidctrl_new_eth/scripts/doc/Database.js@ 18795

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