Skip to content

Commit a1425c5

Browse files
committed
first commit v0.15
0 parents  commit a1425c5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+7388
-0
lines changed

PMO_core/PMO_Config.php

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
<?php
2+
/**
3+
* This file contains the PMO_Config interface.
4+
*
5+
* This file is part of the PhpMyObject project,
6+
* an Object-Relational Mapping (ORM) system.
7+
*
8+
* For questions, help, comments, discussion, etc., please join our
9+
* forum at {@link http://www.developpez.net/forums/forumdisplay.php?f=770}
10+
* or our mailing list at {@link http://groups.google.com/group/pmo-dev}.
11+
*
12+
* PhpMyObject is free software: you can redistribute it and/or modify
13+
* it under the terms of the GNU General Public License as published by
14+
* the Free Software Foundation, either version 3 of the License, or
15+
* (at your option) any later version.
16+
*
17+
* This program is distributed in the hope that it will be useful,
18+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+
* GNU General Public License for more details.
21+
*
22+
* You should have received a copy of the GNU General Public License
23+
* along with this program. If not, see {@link http://www.gnu.org/licenses/}.
24+
*
25+
* @package PhpMyObject
26+
* @subpackage PMO_Core
27+
* @author Nicolas Boiteux <[email protected]>
28+
* @link http://pmo.developpez.com/
29+
* @since PhpMyObject v0.14
30+
* @version $Revision: $
31+
* @copyright Copyright (C) 2007-2008 Nicolas Boiteux
32+
* @license GPLv3 {@link http://www.gnu.org/licenses/gpl}
33+
* @filesource
34+
*
35+
*/
36+
37+
/**
38+
* This interface defines the methods a class must implement
39+
* to provide a working configuration class to the PMO objects.
40+
*
41+
* @package PhpMyObject
42+
* @subpackage PMO_Core
43+
* @see PMO_MyConfig
44+
*/
45+
interface PMO_Config {
46+
47+
/**
48+
* the implementation must return an instance. It it does not exists
49+
* it must be created.
50+
*
51+
* @return object an object derived from a class implementing this interface.
52+
*/
53+
static function factory();
54+
55+
/**
56+
* the implementation must set the passed variable name
57+
* with the passed value.
58+
*
59+
* @param string $varname the variable name to set
60+
* @param mixed $value the value to set the variable with
61+
* @return void
62+
*/
63+
public function set($varname, $value=null);
64+
65+
/**
66+
* the implementation must return the value of the passed variable name
67+
* or throw an exception if the variable does not exist.
68+
*
69+
* @param string $varname the variable name
70+
* @return mixed the variable value
71+
* @throws Exception if $varname does not exist
72+
*/
73+
public function get($varname);
74+
75+
/**
76+
* the implementation must return true if the passed variable exists, false otherwise.
77+
*
78+
* @param string $varname name of the variable to check for
79+
* @return true|false true if the variable exists, false otherwise
80+
*/
81+
//public function exists($varname);
82+
83+
}
84+
?>

PMO_core/PMO_Controller.php

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
<?php
2+
/**
3+
* This file contains the PMO_Controller interface.
4+
*
5+
* This file is part of the PhpMyObject project,
6+
* an Object-Relational Mapping (ORM) system.
7+
*
8+
* For questions, help, comments, discussion, etc., please join our
9+
* forum at {@link http://www.developpez.net/forums/forumdisplay.php?f=770}
10+
* or our mailing list at {@link http://groups.google.com/group/pmo-dev}.
11+
*
12+
* PhpMyObject is free software: you can redistribute it and/or modify
13+
* it under the terms of the GNU General Public License as published by
14+
* the Free Software Foundation, either version 3 of the License, or
15+
* (at your option) any later version.
16+
*
17+
* This program is distributed in the hope that it will be useful,
18+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+
* GNU General Public License for more details.
21+
*
22+
* You should have received a copy of the GNU General Public License
23+
* along with this program. If not, see {@link http://www.gnu.org/licenses/}.
24+
*
25+
* @package PhpMyObject
26+
* @subpackage PMO_Core
27+
* @author Nicolas Boiteux <[email protected]>
28+
* @link http://pmo.developpez.com/
29+
* @since PhpMyObject v0.1
30+
* @version $Revision: $
31+
* @copyright Copyright (C) 2007-2008 Nicolas Boiteux
32+
* @license GPLv3 {@link http://www.gnu.org/licenses/gpl}
33+
* @filesource
34+
*
35+
*/
36+
37+
38+
/**
39+
* This interface defines the methods a class must implement
40+
* to provide a working controller class that will be able
41+
* to query the data and return a {@link PMO_MyMap} map
42+
* of objects.
43+
*
44+
* @package PhpMyObject
45+
* @subpackage PMO_Core
46+
* @see PMO_MyController
47+
*/
48+
interface PMO_Controller {
49+
50+
/**
51+
* Return map of objects already loaded through {@link query()}
52+
*
53+
* @return PMO_Map
54+
* @throws Exception
55+
*/
56+
public function getMapObjects();
57+
58+
/**
59+
* Execute an sql query without treatment
60+
*
61+
* @param string $query the query to execute
62+
* @return object|resource the method must return either a PDO object
63+
* or a DBMS resource link, depending on the
64+
* selected driver
65+
*/
66+
public function rawquery($query);
67+
68+
/**
69+
* Execute a PMO_Request query
70+
*
71+
* @param object $request a {@link PMO_Request} object
72+
*/
73+
public function objectquery(PMO_Request $request);
74+
75+
/**
76+
* Execute an sql query and
77+
* return the corresponding PMO_Map fill with PMO_Object
78+
*
79+
* @param string $query the query to execute
80+
* @return PMO_Map
81+
* @throws Exception
82+
*/
83+
public function query($query);
84+
85+
/**
86+
* Should not be use
87+
* return all tuples of one table
88+
* equivalent : SELECT * table;
89+
*
90+
* @param object $table a {@link PMO_Table} object
91+
* @return PMO_Map
92+
* @throws Exception
93+
*/
94+
public function queryAll(PMO_Table $table);
95+
96+
}
97+
?>

PMO_core/PMO_Dbms.php

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
<?php
2+
/**
3+
* This file contains the PMO_Dbms interface.
4+
*
5+
* This file is part of the PhpMyObject project,
6+
* an Object-Relational Mapping (ORM) system.
7+
*
8+
* For questions, help, comments, discussion, etc., please join our
9+
* forum at {@link http://www.developpez.net/forums/forumdisplay.php?f=770}
10+
* or our mailing list at {@link http://groups.google.com/group/pmo-dev}.
11+
*
12+
* PhpMyObject is free software: you can redistribute it and/or modify
13+
* it under the terms of the GNU General Public License as published by
14+
* the Free Software Foundation, either version 3 of the License, or
15+
* (at your option) any later version.
16+
*
17+
* This program is distributed in the hope that it will be useful,
18+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+
* GNU General Public License for more details.
21+
*
22+
* You should have received a copy of the GNU General Public License
23+
* along with this program. If not, see {@link http://www.gnu.org/licenses/}.
24+
*
25+
* @package PhpMyObject
26+
* @subpackage PMO_Core
27+
* @author Nicolas Boiteux <[email protected]>
28+
* @link http://pmo.developpez.com/
29+
* @since PhpMyObject v0.1x
30+
* @version $Revision: $
31+
* @copyright Copyright (C) 2007-2008 Nicolas Boiteux
32+
* @license GPLv3 {@link http://www.gnu.org/licenses/gpl}
33+
* @filesource
34+
*
35+
*/
36+
37+
/**
38+
* This interface defines the methods a class must implement
39+
* to provide a working Dbms driver class.
40+
*
41+
* @package PhpMyObject
42+
* @subpackage PMO_Core
43+
* @see PMO_MyDbms
44+
*/
45+
interface PMO_Dbms {
46+
47+
/**
48+
* The implementatio must create a PMO_MyDbms object or if it already
49+
* exists, return a reference of this object instance
50+
*
51+
* @param object $object a optional PDO object to use.
52+
* @return PMO_Dbms
53+
* @static
54+
*/
55+
static function factory(PDO $object = null);
56+
57+
/**
58+
* The implementation must create a data link with the database
59+
*
60+
* @param array $authdb an array containing the needed connection info
61+
* @see PMO_MyConfig
62+
*/
63+
public function connect(array $authdb);
64+
65+
/**
66+
* The implementation must return the DB link or DB object
67+
*
68+
* @return object|resource either a Dbms object or a resource link
69+
*/
70+
public function getDB();
71+
72+
/**
73+
* The implementation must set a DB link or DD object
74+
*
75+
* @param object|resource $object
76+
*/
77+
public function setDB($object);
78+
79+
/**
80+
* The implementation must implement a method that will
81+
* execute an SQL query and return true if everything is ok
82+
* or thow an eception if no result is found
83+
*
84+
* @param string $query the SQL query to execute
85+
* @return bool true if results are found
86+
* @throws Exception if no result is found
87+
*/
88+
public function query($query);
89+
90+
/**
91+
* the implemetation must returns the query results
92+
*
93+
* @return array
94+
*/
95+
public function fetchArray();
96+
97+
/**
98+
* the implementation must an array containing the table properties
99+
*
100+
* query database for a description of the $table schems
101+
*
102+
* like a :
103+
* DESC $table;
104+
* DESCRIBE $table;
105+
* SHOW $table;
106+
*
107+
* @param sint $table the table name to work on
108+
* @return array
109+
*/
110+
public function getTableDesc($table);
111+
112+
/**
113+
* the implementation must return the last inserted primary key value
114+
*
115+
* @return int
116+
*/
117+
public function getLastId();
118+
119+
/**
120+
* the implementation must load data from the database
121+
* and fill the passed in PMO_Object with it
122+
*
123+
* @return void
124+
* @throws Exception
125+
*/
126+
public function load(PMO_Object $object);
127+
128+
/**
129+
* the implementation must update the data corresponding to the
130+
* PMO_Object in database All primary keys must be fill.
131+
*
132+
* @return TRUE
133+
* @throws Exception
134+
*/
135+
public function update(PMO_Object $object);
136+
137+
/**
138+
* the implementation must delete data corresponding to the PMO_Object
139+
* in database All primary key must be fill.
140+
*
141+
* @return TRUE
142+
* @throws Exception
143+
*/
144+
public function delete(PMO_Object $object);
145+
146+
/**
147+
* the implementation must insert new data in database
148+
* corresponding to the PMO_Object
149+
* all primary keys must be fill.
150+
*
151+
* @return TRUE
152+
* @throws Exception
153+
*/
154+
public function insert(PMO_Object $object);
155+
156+
/**
157+
* the implementation must start a transaction
158+
*/
159+
public function beginTransaction();
160+
161+
/**
162+
* the implementation must rollback an already stated transaction
163+
*/
164+
public function rollback();
165+
166+
/**
167+
* the implemetation ust commit the started transaction
168+
*/
169+
public function commit();
170+
}
171+
?>

0 commit comments

Comments
 (0)