Advertisement
Guest User

Untitled

a guest
Jun 13th, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. Ape.addEvent("init", function() {
  2. var config = {host: '127.0.0.1', user: 'root', password: 'pass123', database: 'concept'};
  3. var alist = new $H;
  4.  
  5. alist.set('hello','world');
  6.  
  7. var sql = new Ape.MySQL(config.host + ":3306", config.user, config.password, config.database);
  8.  
  9. sql.onConnect = function() {
  10. Ape.log('You are now connected to MySQL server');
  11. }
  12.  
  13. sql.onError = function(errorNo) {
  14. Ape.log('Connection error ' + errorNo +' '+ this.errorString());
  15. }
  16.  
  17. sql.query("SELECT account_id, account_key FROM account", function(res, errorNo) {
  18. if (errorNo) Ape.log('Request error : ' + errorNo + ' : '+ this.errorString());
  19. else {
  20. result.set('data', res);
  21. }
  22. });
  23.  
  24. Ape.log('hello :' + alist.get('hello'));
  25. Ape.log('data :' + alist.get('data'));
  26. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement