Permalink
Browse files

Fix naming, now all sync functions have sync suffix. Closes #23

  • Loading branch information...
1 parent 27d3348 commit b26d27f8559c8c48dc473e5e9c0f549b6cfc77cf @Sannis committed Aug 21, 2010
@@ -12,23 +12,24 @@ MysqlConn class
class MysqlConn {
/* Constructor */
- require('mysql-sync').createConnection(servername, user, password, dbname, port, socket);
+ require('mysql-sync').createConnectionSync(servername, user, password, dbname, port, socket);
/* Methods */
- Integer affectedRows();
- Boolean changeUser(user, password, dbname);
- Boolean connect(hostname, user, password, dbname, port, socket);
- Integer connectErrno();
- String connectError();
- Boolean close();
- Integer errno();
- String error();
- String escape();
- Object getInfo();
- Integer lastInsertId();
- Boolean ping();
+ Integer affectedRowsSync();
+ Boolean changeUserSync(user, password, dbname);
+ Boolean connectSync(hostname, user, password, dbname, port, socket);
+ Integer connectErrnoSync();
+ String connectErrorSync();
+ Boolean closeSync();
+ Integer errnoSync();
+ String errorSync();
+ String escapeSync();
+ Object getInfoSync();
+ Integer lastInsertIdSync();
+ Boolean pingSync();
MysqlResult query();
- Integer warningCount();
+ MysqlResult querySync();
+ Integer warningCountSync();
}
@@ -37,19 +38,19 @@ Connection, options, errors and information
### Connection ###
- require('mysql-sync').createConnection(servername, user, password, dbname, port, socket);
+ require('mysql-sync').createConnectionSync(servername, user, password, dbname, port, socket);
- Boolean changeUser(user, password, dbname);
- Boolean connect(hostname, user, password, dbname, port, socket);
- Integer connectErrno();
- String connectError();
- Boolean close();
- Object getCharset();
- String getCharsetName();
- Boolean ping();
- Boolean selectDb (dbname);
- Boolean setCharset (charset);
- Undefined setSsl(key, cert, ca, capath, cipher);
+ Boolean changeUserSync(user, password, dbname);
+ Boolean connectSync(hostname, user, password, dbname, port, socket);
+ Integer connectErrnoSync();
+ String connectErrorSync();
+ Boolean closeSync();
+ Object getCharsetSync();
+ String getCharsetNameSync();
+ Boolean pingSync();
+ Boolean selectDbSync(dbname);
+ Boolean setCharsetSync(charset);
+ Undefined setSslSync(key, cert, ca, capath, cipher);
### Options ###
@@ -59,37 +60,38 @@ Nothing yet.
### Errors ###
- Integer errno();
- String error();
- String sqlState;
+ Integer errnoSync();
+ String errorSync();
+ String sqlStateSync();
### Information ###
- Object getInfo();
- String getInfoString();
- Array getWarnings();
- Integer warningCount();
+ Object getInfoSync();
+ String getInfoStringSync();
+ Array getWarningsSync();
+ Integer warningCountSync();
- Undefined debug(message);
- Boolean dumpDebugInfo();
- String stat();
+ Undefined debugSync(message);
+ Boolean dumpDebugInfoSync();
+ String statSync();
Query
-----
- Integer affectedRows();
- String escape(escapestr);
- Integer fieldCount();
- Integer lastInsertId();
- Boolean multiMoreResults();
- Boolean multiNextResult()
- Boolean multiRealQuery(query);
+ Integer affectedRowsSync();
+ String escapeSync(escapestr);
+ Integer fieldCountSync();
+ Integer lastInsertIdSync();
+ Boolean multiMoreResultsSync();
+ Boolean multiNextResultSync()
+ Boolean multiRealQuerySync(query);
MysqlResult query(query);
- Boolean realQuery(query);
- MysqlResult storeResult();
- MysqlResult useResult();
+ MysqlResult querySync(query);
+ Boolean realQuerySync(query);
+ MysqlResult storeResultSync();
+ MysqlResult useResultSync();
Statements
@@ -101,37 +103,37 @@ Statements
Transactions
------------
- Boolean autoCommit(mode);
- Boolean commit();
- Boolean rollback();
+ Boolean autoCommitSync(mode);
+ Boolean commitSync();
+ Boolean rollbackSync();
Other
-----
- Integer threadId();
- Boolean threadKill(pid);
- Boolean threadSafe();
+ Integer threadIdSync();
+ Boolean threadKillSync(pid);
+ Boolean threadSafeSync();
MysqlResult class
-----------------
class MysqlResult {
/* Methods */
- Undefined dataSeek();
- Array fetchAll();
- Array fetchArray();
- Object fetchField();
- Object fetchFieldDirect();
- Array fetchFields();
- Array fetchLengths();
- Object fetchObject();
- Integer fieldCount();
- Undefined fieldSeek();
- Integer fieldTell();
- Undefined free();
- Integer numRows();
+ Undefined dataSeekSync();
+ Array fetchAllSync();
+ Array fetchArraySync();
+ Object fetchFieldSync();
+ Object fetchFieldDirectSync();
+ Array fetchFieldsSync();
+ Array fetchLengthsSync();
+ Object fetchObjectSync();
+ Integer fieldCountSync();
+ Undefined fieldSeekSync();
+ Integer fieldTellSync();
+ Undefined freeSync();
+ Integer numRowsSync();
}
@@ -140,7 +142,7 @@ MysqlStatement class
class MysqlStatement {
/* Methods */
- Boolean prepare(query);
+ Boolean prepareSync(query);
}
@@ -14,14 +14,14 @@ Close and connect again
You can use all this argument in mysql_libmysqlclient.createConnection too.
- conn.close();
- conn.connect(servername, user, password, database, port, socket);
+ conn.closeSync();
+ conn.connectSync(servername, user, password, database, port, socket);
Execute query and fetch result
------------------------------
- var res = conn.query(query_string);
- var query_result_rows = res.fetchResult();
+ var res = conn.querySync(query_string);
+ var query_result_rows = res.fetchResultSync();
fetchResult() method returns array of objects. For example, for table with structure
@@ -40,7 +40,7 @@ you will fetch
Utility functions
-----------------
- var info = conn.getInfo();
+ var info = conn.getInfoSync();
for( var i in info ) sys.puts("info['" + i + "'] = " + info[i]);
This function get information about client and server versions and some other info:
@@ -55,5 +55,5 @@ This function get information about client and server versions and some other in
escape() method escapes argument with mysql_real_escape_string() to make string safe for using in queries.
var str = "test\nstring";
- var str_esc = conn.escape(str); // => "test\\nstring"
+ var str_esc = conn.escapeSync(str); // => "test\\nstring"
@@ -6,10 +6,10 @@ See license text in LICENSE file
var binding = require("./mysql_bindings");
-exports.createConnection = function () {
+exports.createConnectionSync = function () {
var db = new binding.MysqlConn();
if (arguments.length > 0) {
- db.connect.apply(db, Array.prototype.slice.call(arguments, 0, 6));
+ db.connectSync.apply(db, Array.prototype.slice.call(arguments, 0, 6));
}
return db;
};
Oops, something went wrong.

0 comments on commit b26d27f

Please sign in to comment.