1 |
<?php |
2 |
/* |
3 |
OpenIsis - an open implementation of the CDS/ISIS database |
4 |
Version 0.8.x (patchlevel see file Version) |
5 |
Copyright (C) 2001-2003 by Erik Grziwotz, erik@openisis.org |
6 |
|
7 |
This library is free software; you can redistribute it and/or |
8 |
modify it under the terms of the GNU Lesser General Public |
9 |
License as published by the Free Software Foundation; either |
10 |
version 2.1 of the License, or (at your option) any later version. |
11 |
|
12 |
This library is distributed in the hope that it will be useful, |
13 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 |
Lesser General Public License for more details. |
16 |
|
17 |
You should have received a copy of the GNU Lesser General Public |
18 |
License along with this library; if not, write to the Free Software |
19 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
20 |
|
21 |
see README for more information |
22 |
EOH */ |
23 |
|
24 |
// $Id: Db.php,v 1.2 2003/05/23 17:18:49 kripke Exp $ |
25 |
|
26 |
|
27 |
/** |
28 |
This class represents a "database". |
29 |
|
30 |
@version $Revision: 1.2 $ |
31 |
@license LGPL |
32 |
@package Isis |
33 |
*/ |
34 |
class Isis_Db { |
35 |
/** "field definiton table" |
36 |
simple name -> number hash (where name should be an "identifier") |
37 |
may contain some additional entries using non-identifier chars ... |
38 |
*/ |
39 |
var $fdt; |
40 |
var $name; |
41 |
var $srv; |
42 |
|
43 |
function Isis_Db ( $fdt, $name = null, $server = null ) |
44 |
{ |
45 |
$this->fdt = $fdt; |
46 |
$this->name = $name; |
47 |
$this->srv = $server; |
48 |
} |
49 |
|
50 |
|
51 |
function req ( $type, $req ) |
52 |
{ |
53 |
$req->append( 920, $type ); |
54 |
$req->append( 903, 0 ); |
55 |
$req->append( 902, $this->name ); |
56 |
return $this->srv->request( $req ); |
57 |
} |
58 |
|
59 |
|
60 |
function query ( $expr ) |
61 |
{ |
62 |
$ret = $this->req( 11, new Isis_Rec( 922, 128, 925, $expr ) ); |
63 |
return $ret->get(904);; |
64 |
} |
65 |
|
66 |
function read ( $mfn ) |
67 |
{ |
68 |
$ret = $this->req( 12, new Isis_Rec( 904, $mfn ) ); |
69 |
return $ret->v( 908, 0 ); |
70 |
} |
71 |
|
72 |
} // class Isis_Db |
73 |
?> |