-
Notifications
You must be signed in to change notification settings - Fork 0
/
Query.php
56 lines (45 loc) · 1.15 KB
/
Query.php
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
48
49
50
51
52
53
54
55
56
<?php
namespace BaseXClient;
class Query {
/* Class variables.*/
var $session, $id, $open;
/* see readme.txt */
public function __construct($s, $q) {
$this->session = $s;
$this->id = $this->exec(chr(0), $q);
}
/* see readme.txt */
public function bind($name, $value, $type = "") {
$this->exec(chr(3), $this->id.chr(0).$name.chr(0).$value.chr(0).$type);
}
/* see readme.txt */
public function context($value, $type = "") {
$this->exec(chr(14), $this->id.chr(0).$value.chr(0).$type);
}
/* see readme.txt */
public function execute() {
return $this->exec(chr(5), $this->id);
}
/* see readme.txt */
public function info() {
return $this->exec(chr(6), $this->id);
}
/* see readme.txt */
public function options() {
return $this->exec(chr(7), $this->id);
}
/* see readme.txt */
public function close() {
$this->exec(chr(2), $this->id);
}
/* see readme.txt */
public function exec($cmd, $arg) {
$this->session->send($cmd.$arg);
$s = $this->session->receive();
if($this->session->ok() != True) {
throw new \Exception($this->session->readString());
}
return $s;
}
}
?>