Mammut Framework

Developer handbook :: DAL :: Classes

DAL: Classes

Mammut\DB\MFDB

Represents a database connection

static void setLogger(MFLogger $logger)
      Sets the logger of the database system
static MFLogger getLogger()
      Returns the logger used by the database system
static MFDB newInstance(string $dsn, string $user, string $password[, array $options])
      Create a new database connection with the setup given.
  • $dsn
    The database identification string. See Connection-Strings for details.
  • $user
    The database user name, if needed/used
  • $password
    The password for $user (if needed)
  • $options
    Optional addidional options
  void close()
      Closes the connection to the database.
  void setDatabase(string $name)
      On systems with multiple databases, set the active database to the one given.
  string getDatabase()
      Returns the type of the database given.
  MFDBResult query(string $query[, $limit[, $skip]])
       
  mixed[] mulitquery(string[] $query)
       
public   MFDBStatement createStatement(string $query[, $limit[, $skip]])
       
public   MFDBView createViewInstance(string $name, string $query)
       
public   object getObject(string $sql[,string $class[, array $param]])
       
public   mixed[] getArray(string $sql)
       
public   mixed[] getRow(string $sql)
       
public   object[] getObjectList(string $sql[,string $class[, array $param]])
       
public   array[] getArrayList($sql)
       
public   array[] getRowList($sql)
       
public   long getInsertId()
       
public   long getAffectedRowCount()
       
public   string condition2sql(MFDBCondition $con)
       
public   MFDBTable table(string $name[, boolean $addPrefix])
      Creates a table object represeting the table $name.
public   string[] tableList([boolean $removePrefix])
       
public   void createTable(MFDBTableInfo $info[, boolean $addPrefix])
       
public   void dropTable(string $table[, boolean $addPrefix])
       
public   long dateCol2uts($date)
       
public   string uts2dateCol(long $uts)
       
public   long datetimeCol2uts($datetime)
       
public   string uts2datetimeCol(long $uts)
       
public   string escapeString(string $text)
       
public   string escapeTableName(string $name[, boolean $addPrefix])
       
public   string escapeColumnName(string $name)
       
public   string escapeValue(mixed $value)
       
protected   void setPrefix(string $prefix)
      Sets the database table prefix.
public   string getPrefix()
      Returns the database table prefix.

Mammut\DB\MFDBResult

  string[] getColumns()
      Returns a array with the names of all avaible columns.
  MFDBColumnInfo getColumnInfo(mixed $column)
      Fetches a column info object which represents the column given by name or index.
  void getColumnCount()
      Returns the number of columns avaible.
  long getRowNumber()
      Returns the number of the current row..
  long getRowCount()
      Returns the number of avaible rows.
  mixed[] fetchRow()
      Fetches the next row as a numbered array.
  mixed[] fetchArray()
      Fetches the next row as a assocative array.
  object fetchObject()
      Fetches the next row as an object.
  array[] fetchRowList()
      Fetches the all rows as a list of numbered arrays.
  array[] fetchArrayList()
      Fetches the all rows as a list of assocative arrays.
  object[] fetchObjectList()
      Fetches the all rows as a list of objects
  array[] close()
      Closes the result set and freeing all resources.