testOujMySql.js 935 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /**
  2. * Created by benzhan on 15/8/10.
  3. */
  4. oujMySql = require('../framework/lib/oujMySql.js');
  5. objMysql = new oujMySql('Web');
  6. var sql = "SELECT * FROM `cUser`";
  7. var allDeferred = objMysql.getAll(sql, 5);
  8. allDeferred.then(function(rows) {
  9. console.log('getAll');
  10. console.log(rows);
  11. });
  12. var oneDeferred = objMysql.getOne(sql);
  13. oneDeferred.then(function(one) {
  14. console.log('getOne');
  15. console.log(one);
  16. });
  17. var colDeferred = objMysql.getCol(sql, 3);
  18. colDeferred.then(function(col) {
  19. console.log('getCol');
  20. console.log(col);
  21. });
  22. var colDeferred = objMysql.getRow(sql);
  23. colDeferred.then(function(row) {
  24. console.log('getRow');
  25. console.log(row);
  26. });
  27. //
  28. //var updateSql = "";
  29. //
  30. //objMysql.update(sql, function(err, rows) {
  31. // console.log('getAll');
  32. // console.log(rows);
  33. //}, 5);
  34. //setTimeout(function() {
  35. // objMysql.close(function() {
  36. // console.log('close');
  37. // });
  38. //}, 1000);