Ejemplo n.º 1
0
 /**
  * Set the 'connection' property
  */
 protected function setConnection()
 {
     global $cman;
     if ($this->strTableName != NOT_TABLE_BASED_TNAME) {
         $this->connection = $cman->byTable($this->strTableName);
     } else {
         $this->connection = getDefaultConnection();
     }
 }
Ejemplo n.º 2
0
/**
 * User API function
 * It uses the default db connection 
 * @param String sql
 */
function DBLookup($sql)
{
    $connection = getDefaultConnection();
    $data = $connection->query($sql)->fetchAssoc();
    if ($data) {
        return reset($data);
    }
    return null;
}
Ejemplo n.º 3
0
function dbinfoFieldsType($table, $field)
{
    if (isset($_SESSION["WRFieldType"][$table][$field])) {
        return $_SESSION["WRFieldType"][$table][$field];
    }
    //The default connection is temporary used #9875
    $connection = getDefaultConnection();
    $arr = $connection->getFieldsList("select * from " . $connection->addTableWrappers($table) . " where 1=0");
    $res = "";
    foreach ($arr as $val) {
        if ($val["fieldname"] == $field) {
            $res = $val["type"];
        }
        $_SESSION["WRFieldType"][$table][$val["fieldname"]] = $val["type"];
    }
    return $res;
}
Ejemplo n.º 4
0
/**
 * @param Connection connection (optional)
 * @return Number
 */
function GetDatabaseType($connection = null)
{
    if (is_null($connection)) {
        $connection = getDefaultConnection();
    }
    return $connection->dbType;
}