summaryrefslogtreecommitdiff
path: root/framework/Data/SqlMap/Statements/IMappedStatement.php
blob: 15f61fadfc5302bc0506970336b574aa372fdb94 (plain)
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
/**
 * IMappedStatement interface file.
 *
 * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
 * @version $Id$
 * @package System.Data.SqlMap.Statements
 */

/**
 * Interface for all mapping statements.
 *
 * @author Wei Zhuo <weizho[at]gmail[dot]com>
 * @version $Id$
 * @package System.Data.SqlMap.Statements
 * @since 3.1
 */
interface IMappedStatement
{
	/**
	 * @return string Name used to identify the MappedStatement amongst the others.
	 */
	public function getID();

	/**
	 * @return TSqlMapStatement The SQL statment used by this TMappedStatement.
	 */
	public function getStatement();

	/**
	 * @return TSqlMap The TSqlMap used by this TMappedStatement
	 */
	public function getManager();

	/**
	 * Executes the SQL and retuns all rows selected in a map that is keyed on
	 * the property named in the <tt>$keyProperty</tt> parameter.  The value at
	 * each key will be the value of the property specified  in the
	 * <tt>$valueProperty</tt> parameter.  If <tt>$valueProperty</tt> is
	 * <tt>null</tt>, the entire result object will be entered.
	 * @param IDbConnection database connection to execute the query
	 * @param mixed The object used to set the parameters in the SQL.
	 * @param string The property of the result object to be used as the key.
	 * @param string The property of the result object to be used as the value (or null)
	 * @return TMap A map of object containing the rows keyed by <tt>$keyProperty</tt>.
	 */
	public function executeQueryForMap($connection, $parameter, $keyProperty, $valueProperty=null);


	/**
	 * Execute an update statement. Also used for delete statement. Return the
	 * number of row effected.
	 * @param IDbConnection database connection to execute the query
	 * @param mixed The object used to set the parameters in the SQL.
	 * @return integer The number of row effected.
	 */
	public function executeUpdate($connection, $parameter);


	/**
	 * Executes the SQL and retuns a subset of the rows selected.
	 * @param IDbConnection database connection to execute the query
	 * @param mixed The object used to set the parameters in the SQL.
	 * @param TList A list to populate the result with.
	 * @param integer The number of rows to skip over.
	 * @param integer The maximum number of rows to return.
	 * @return TList A TList of result objects.
	 */
	public function executeQueryForList($connection, $parameter, $result=null, $skip=-1, $max=-1);


	/**
	 * Executes an SQL statement that returns a single row as an object
	 * of the type of the <tt>$result</tt> passed in as a parameter.
	 * @param IDbConnection database connection to execute the query
	 * @param mixed The object used to set the parameters in the SQL.
	 * @param object The result object.
	 * @return object result.
	 */
	public function executeQueryForObject($connection,$parameter, $result=null);
}