Db client

From Yate Documentation
(Difference between revisions)
Jump to: navigation, search
(Created page with "init.js #require "db_client.class.js" var db = new db_client('yate', 'pgsql');")
 
Line 1: Line 1:
 +
javascript.conf
 +
 +
[general]
 +
scripts_dir=/your/dir/where/js/files/
 +
....
 +
[scripts]
 +
init=init.js
 +
 +
If you use MySql edit mysqldb.conf
 +
 +
[general]
 +
priority=100
 +
 +
[yate_my]
 +
host=localhost
 +
port=3306
 +
database=database_name
 +
user=database_user
 +
password=yourpass123
 +
 +
If you use PostgreSql edit pgsqldb.conf
 +
 +
[general]
 +
priority=100
 +
 +
[yate_pg]
 +
host=localhost
 +
port=5432
 +
database=database_name
 +
user=database_user
 +
password=yourpass123
 +
 +
 
init.js
 
init.js
  
 
  #require "[[Db_client.class.js|db_client.class.js]]"
 
  #require "[[Db_client.class.js|db_client.class.js]]"
  var db = new db_client('yate', 'pgsql');
+
 
 +
// db_client('use account name', 'database module, default pgsql');
 +
  var db = new db_client('yate_my', 'mysql');
 +
or
 +
var db = new db_client('yate_pg', 'pgsql');
 +
 
 +
db.query('INSERT INTO extension (extension,password) VALUES ($,$)', ['100','100']);

Revision as of 17:19, 25 February 2014

javascript.conf

[general]
scripts_dir=/your/dir/where/js/files/
....
[scripts]
init=init.js

If you use MySql edit mysqldb.conf

[general]
priority=100

[yate_my]
host=localhost
port=3306
database=database_name
user=database_user
password=yourpass123

If you use PostgreSql edit pgsqldb.conf

[general]
priority=100

[yate_pg]
host=localhost
port=5432
database=database_name
user=database_user
password=yourpass123


init.js

#require "db_client.class.js"
// db_client('use account name', 'database module, default pgsql');
var db = new db_client('yate_my', 'mysql');
or 
var db = new db_client('yate_pg', 'pgsql');
db.query('INSERT INTO extension (extension,password) VALUES ($,$)', ['100','100']);
Personal tools
Namespaces

Variants
Actions
Preface
Configuration
Administrators
Developers