databases
[
class tree: databases
] [
index: databases
] [
all elements
]
changelog
install
readme
Todo List
Packages:
core
communication
databases
data_structures
filesystem
forms
GilliGan
html
Services_JSON
Source for file ABSTView.class.php
Documentation is available at
ABSTView.class.php
<?php
/**
* For including this file you have to define the constant "CLASSPATH".
* Because every include in the framework depends on the CLASSPATH definition.
* The CLASSPATH means the relative path to the folder that contains the
* framework GilliGan.
*
*
@package
databases
*/
/**
*
*/
include_once
(
CLASSPATH
.
"core/PlainTextFormatter.class.php"
)
;
/**
*
@package
databases
*
@version
0.1.53
*
@author
Daniel Plücken <daniel@debakel.net>
*
@license
http://www.gnu.org/copyleft/lesser.html
* GNU Lesser General Public License
*
@copyright
Copyright (C) 2004 Daniel Plücken <daniel@debakel.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General
* Public License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA
*/
class
ABSTView
{
/**
* The name of this view.
*
*
@var
string
$name
*
@access
private
*/
var
$name
;
/**
* Array for carrying the joins included in this view.
*
*
@var
array
$join
*
@access
private
*/
var
$join
;
/**
* The last stored databasequery.
*
*
@var
string
$last_query
*
@access
public
*/
var
$last_query
=
"<empty>"
;
/**
* This stores the additionally fields for the result list of the query.
*
*
@var
string
$custom_field_arr
*
@access
public
*/
var
$custom_field_arr
=
array
(
)
;
/**
* Carries the name of a function which has to be invoked on a connection
* error.
*
*
@access
public
*
@var
function
$error_callback
*/
var
$error_callback
=
null
;
/**
* Fake-Constructor
*
*
@version
1.0
*
@since
0.1.3
*
@author
Daniel Plücken <daniel@debakel.net>
*
@access
public
*/
function
ABSTView
(
)
{
echo
"<h3>This is an abstract class. "
.
"You cannot get an instance of it!</h3>"
;
exit
(
)
;
}
/**
* Sets the name of the function that should be invoked on a connection error.
* The function to call back has to have two parameter. The first parameter is
* for the error code. The second one contains the errordescription.
*
*
@version
1.0
*
@since
0.1.52
*
@author
Daniel Plücken <daniel@debakel.net>
*
@access
public
*
@param
string
$function_name_str
*
@return
void
*/
function
setErrorCallback
(
$function_name_str
)
{
$this
->
error_callback
=
$function_name_str
;
}
/**
* Constructor
*
*
@version
1.0
*
@since
0.1.0
*
@author
Daniel Plücken <daniel@debakel.net>
*
@access
public
*
@param
string
$name
*
@return
ABSTView
*/
function
__constructor
(
$name
)
{
if
(
!
empty
(
$name
) )
$this
->
name
;
else
die
(
"<h3>You have to give a name to this database view!</h3>"
.
"<b>Use following Syntax:<b><br><br>\r\n"
.
"<pre>\r\n"
.
" \x24db_view = new View( \x24name );\r\n"
.
"</pre>\r\n"
)
;
}
/**
* Returns the name of this view.
*
*
@version
1.0
*
@since
0.1.0
*
@author
Daniel Plücken <daniel@debakel.net>
*
@access
public
*
@return
string
*/
function
getName
(
)
{
return
$this
->
name
;
}
/**
* Returns the last stored database query.
*
*
@version
1.0
*
@since
0.1.2
*
@author
Daniel Plücken <daniel@debakel.net>
*
@access
public
*
@return
string
*/
function
getLastQuery
(
)
{
return
PlainTextFormatter
::
formatSQL
(
$this
->
last_query
)
;
}
/**
* Sets additionally fields to the definition of the result list of the query.
*
*
@version
1.0
*
@since
0.1.5
*
@author
Daniel Plücken <daniel@debakel.net>
*
@access
public
*
@param
array
$array
*
@return
void
*/
function
setCustomFields
(
$array
)
{
if
(
!
is_array
(
$array
) )
$this
->
addCustomField
(
$array
)
;
$this
->
custom_field_arr
=
$array
;
}
/**
* This can be use to add a field to the definition of the result list of the
* query.
*
*
@version
1.0
*
@since
0.1.5
*
@author
Daniel Plücken <daniel@debakel.net>
*
@access
public
*
@param
string
$string
*
@return
void
*/
function
addCustomField
(
$string
)
{
$this
->
custom_field_arr
[
]
=
$string
;
}
/**
* Adds a join's reference to this view's object.
*
*
@version
1.0
*
@since
0.1.2
*
@author
Daniel Plücken <daniel@debakel.net>
*
@access
public
*
@param
Join
$obj_ref
* return void
*/
function
addJoin
(
&
$obj_ref
)
{
if
(
is_a
(
$obj_ref
,
"Join"
)
||
is_subclass_of
(
$obj_ref
,
"Join"
)
)
$this
->
join
[
]
=
$obj_ref
;
else
die
(
"<h3>The given parameter refers not to a valid object of a "
.
"join.</h3>"
)
;
}
/**
* Returns the datasets as an two dimensional array if the query could be
* execute. The first dimension carries the datasets. The second dimension
* carries the fields's values of the result list.
*
* Usage:
* getDatasetsWithFields( $fieldnamesArr, $where );
*
*
@version
1.0
*
@since
0.1.4
*
@author
Daniel Plücken <daniel@debakel.net>
*
@access
public
*
@param
array
$fields
Is a blind parameter whithout any funktion.
*
@param
string
$where
The where clause of the query.
*
@return
array
*/
function
getDatasetsWithFields
(
$fields
=
""
,
$where
=
""
)
{
return
$this
->
getDatasets
(
$where
)
;
}
/**
* Returns the id of the connection resource to the database host.
*
*
@access
public
*
@version
1.0
*
@since
0.1.53
*
*
@return
object
*/
function
&
getResourceID
(
)
{
return
$this
->
join
[
0
]
->
dbt_left
->
getResourceID
(
)
;
}
}
// End of class ABSTView
?>
Documentation generated on Thu, 05 Jun 2008 19:10:03 +0200 by
phpDocumentor 1.4.1