phpClick
[ class tree: phpClick ] [ index: phpClick ] [ all elements ]

Class: AppDatabase

Source Location: /includes/AppDatabase.inc.php

Class Overview


This class is used for accessing the database of an application built with phpClick


Methods



Class Details

[line 5]
This class is used for accessing the database of an application built with phpClick



[ Top ]


Class Methods


constructor __construct [line 17]

AppDatabase __construct( Application $oApp)

Constructs a new AppDatabase object



Tags:

access:  public


Parameters:

Application   $oApp   Reference to the application that the database belongs to

[ Top ]

method createNewAppTable [line 118]

void createNewAppTable( [string $sTableName = NULL])

Creates a table within the application's database.

The table will contain the predefined fields "id" (auto-increment key) and "timestamp" (last change)




Parameters:

string   $sTableName   Table name, defaults to the "default" table name

[ Top ]

method createNewDatabaseField [line 153]

void createNewDatabaseField( string $sFieldName, string $sFieldType)

Create a new field of a particular name and type within the application's database



Tags:

access:  public


Parameters:

string   $sFieldName   Field name
string   $sFieldType   MySQL field type

[ Top ]

method databaseFieldMoveLeft [line 218]

void databaseFieldMoveLeft( string $sFieldName)

Move a particular field to the left within the default's table's schema



Tags:

access:  public


Parameters:

string   $sFieldName   The field name shifted to the left

[ Top ]

method databaseFieldMoveRight [line 191]

void databaseFieldMoveRight( string $sFieldName)

Move a particular field to the right within the default's table's schema



Tags:

access:  public


Parameters:

string   $sFieldName   The field name shifted to the right

[ Top ]

method deleteDatabaseField [line 179]

void deleteDatabaseField( string $sFieldName)

Delete a field from the default table within the application's database



Tags:

access:  public


Parameters:

string   $sFieldName   The field name to be deleted

[ Top ]

method deleteDatabaseRecord [line 326]

void deleteDatabaseRecord( string $iId)

Delete a particular record within the database's default table



Tags:

access:  public


Parameters:

string   $iId   Id of the row to be deleted

[ Top ]

method getApp [line 33]

Application getApp( )

Returns a reference to the application that this database belongs to



Tags:

return:  A reference to the application that this database belongs to
access:  public


[ Top ]

method getDb [line 42]

object A getDb( )

Returns the database handle for this application's database



Tags:

return:  database handle
access:  public


[ Top ]

method getDefaultTableName [line 108]

void getDefaultTableName( )

Return the default table name for the application's database.

Currently, only this table exists but future versions of phpClick will support more than one table per database




Tags:

static:  
access:  public


[ Top ]

method getNumCustomFields [line 97]

int getNumCustomFields( [string $sTableName = ''])

Return the number of custom database fields



Tags:

return:  Number of custom fields


Parameters:

string   $sTableName   Table name

[ Top ]

method getSqlEscapeOf [line 352]

string getSqlEscapeOf( string $sValue)

Returns an escaped version of a string to be safely used within a MySQL SQL query

This function helps avoid SQL injection attacks




Tags:

return:  The escaped version of the value


Parameters:

string   $sValue   The value to be escaped

[ Top ]

method getTableInfoByTableName [line 74]

array getTableInfoByTableName( [string $sTableName = ""])

Returns field information about a particular table



Tags:

return:  Two-dimensional Array with format $aField[0]['name'], $aField[0]['type'] etc.
access:  public


Parameters:

string   $sTableName   Table name, defaults to the "default" table name of the application

[ Top ]

method getUserFriendlyDbFieldType [line 132]

void getUserFriendlyDbFieldType( string $sType)

Translates the MySQL field type into something more user-friendly



Tags:

static:  
access:  public


Parameters:

string   $sType   The MySQL field type, e.g. "int"

[ Top ]

method insertDatabaseRecordFromPostRequest [line 266]

void insertDatabaseRecordFromPostRequest( )

Insert a record within the database's default table.

The data is directly read out of POST variables with names relating to the databases field names




Tags:

access:  public


[ Top ]

method isPredefinedField [line 64]

boolean isPredefinedField( string $sFieldName)

Returns TRUE if the field name passed as a parameter is one of the predefined fields of phpClick



Tags:

return:  TRUE if it's a predefined field, FALSE otherwise
static:  
access:  public


Parameters:

string   $sFieldName   Database field name

[ Top ]

method query [line 52]

mysqli_result query( string $sQuery)

Send a SQL query to a database and return an mysqli query result object



Tags:

return:  The result of the query
access:  public


Parameters:

string   $sQuery   The SQL query

[ Top ]

method renameDatabaseField [line 244]

void renameDatabaseField( string $sOldName, string $sNewName)

Rename a particular field within default table



Tags:

access:  public


Parameters:

string   $sOldName   The current field name
string   $sNewName   The new field name

[ Top ]

method updateDatabaseRecordFromPostRequest [line 303]

void updateDatabaseRecordFromPostRequest( mixed $sId)

Update a record within the database's default table.

The data is directly read out of POST variables with names relating to the databases field names




Tags:

access:  public


[ Top ]


Documentation generated on Wed, 12 Jan 2005 17:50:25 -0500 by phpDocumentor 1.3.0RC3