-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathHello-KySQL.krl
47 lines (40 loc) · 1.23 KB
/
Hello-KySQL.krl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
ruleset a169x380 {
meta {
name "Hello-KySQL"
description <<
Hello World for KySQL Module
>>
author "Ed Orcutt, LOBOSLLC"
logging on
use module a169x379 alias KySQL
with apikey = "YOUR-KEY-HERE"
and callback = "http://example.org/KySQL.php"
and username = "database-username"
and password = "database-password"
and database = "database-name"
}
dispatch { }
global { }
// ------------------------------------------------------------------------
rule hello_KySQL {
select when pageview ".*"
pre {
KyObject = KySQL:KyQuery("SELECT * FROM addressbook");
KyJSON = KySQL:KyResult(KyObject);
status = KySQL:KyStatus(KyObject);
errorMsg = KySQL:KyError(KyObject);
myHash = {
"name" : "Ed Orcutt",
"email" : "[email protected]",
"phone" : "(801) 555-1234"
};
kyInsert = KySQL:KyInsertString("addressbook", myHash);
}
{
notify("KyStatus: " + status, errorMsg) with sticky = true;
}
}
// ------------------------------------------------------------------------
// Beyond here there be dragons :)
// ------------------------------------------------------------------------
}