本文整理汇总了PHP中_WT函数的典型用法代码示例。如果您正苦于以下问题:PHP _WT函数的具体用法?PHP _WT怎么用?PHP _WT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_WT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: table
/**
Returns a table of a given name in the schema.
@param $sName The name of the table.
@return weePgSQLDbMetaTable The table.
@throw UnexpectedValueException The table does not exist in the schema.
*/
public function table($sName)
{
$oQuery = $this->meta()->db()->query("\n\t\t\tSELECT\t\tn.nspname AS schema, c.relname AS name, r.rolname AS owner,\n\t\t\t\t\t\tpg_catalog.obj_description(c.oid, 'pg_class') AS comment,\n\t\t\t\t\t\tpg_catalog.pg_has_role(r.rolname, 'USAGE') AS alterable\n\t\t\t FROM\tpg_catalog.pg_class c\n\t\t\t\t\t\tJOIN pg_catalog.pg_namespace\tn ON n.oid = c.relnamespace\n\t\t\t\t\t\tJOIN pg_catalog.pg_roles\t\tr ON r.oid = c.relowner\n\t\t\t\tWHERE\t\tc.relname = :table\n\t\t\t\t\t\tAND\tc.relkind = 'r'\n\t\t\t\t\t\tAND\tn.nspname = :name\n\t\t\t\tLIMIT\t1\n\t\t", array('table' => $sName) + $this->aData);
count($oQuery) == 1 or burn('UnexpectedValueException', sprintf(_WT('Table "%s" does not exist in the schema.'), $sName));
$sClass = $this->meta()->getTableClass();
return new $sClass($this->meta(), $oQuery->fetch());
}
示例2: defaultValue
/**
Return the default value of the column.
@return string The default value of the column.
@throw IllegalStateException The column does not have a default value.
*/
public function defaultValue()
{
$this->hasDefault() or burn('IllegalStateException', _WT('The column does not have a default value.'));
// Strip wrapping parenthesis.
$i = strspn($this->aData['default'], '(');
return substr($this->aData['default'], $i, -$i);
}
示例3: setFormData
/**
Sets the widget and complete data passed to the weeForm object.
Usually either $_POST or $_GET.
@param $oWidget The widget to validate.
@param $aData The data to check, if applicable.
@throw IllegalStateException The validator has already been attached to a form widget.
*/
public function setFormData(SimpleXMLElement $oWidget, array $aData)
{
$this->oWidget === null or burn('IllegalStateException', _WT('The validator has already been attached to a form widget.'));
$oWidget->getName() === 'widget' or burn('InvalidArgumentException', _WT('The $oWidget argument must be a widget element.'));
$this->aData = $aData;
$this->oWidget = $oWidget;
}
示例4: table
/**
Returns a table of a given name in the database.
@param $sName The name of the table.
@return weeMySQLDbMetaTable The table.
@throw UnexpectedValueException The tables does not exist.
*/
public function table($sName)
{
$oQuery = $this->db()->query("\n\t\t\tSELECT TABLE_NAME AS name, TABLE_COMMENT AS comment\n\t\t\t\tFROM\tinformation_schema.tables\n\t\t\t\tWHERE\tTABLE_NAME\t\t= ?\n\t\t\t\t\tAND\tTABLE_SCHEMA\t= DATABASE()\n\t\t\t\t\tAND\tTABLE_TYPE\t\t= 'BASE TABLE'\n\t\t\t\tLIMIT\t1\n\t\t", $sName);
count($oQuery) == 1 or burn('UnexpectedValueException', sprintf(_WT('Table "%s" does not exist.'), $sName));
$sClass = $this->getTableClass();
return new $sClass($this, $oQuery->fetch());
}
示例5: __construct
/**
Configure the filename and the data for this template.
@param $sTemplate The template name.
@param $aData Data to be used in the template.
*/
public function __construct($sTemplate, array $aData = array())
{
$this->sFilename = TPL_PATH . $sTemplate . TPL_EXT;
file_exists($this->sFilename) or burn('FileNotFoundException', sprintf(_WT('The file "%s" does not exist.'), $this->sFilename));
parent::__construct($aData);
$this->setMIMEType('text/html');
}
示例6: header
/**
Define an additional header for this email.
This method can be called directly from the template itself.
@param $sName The header name.
@param $sValue New value for that header.
*/
public function header($sName, $sValue)
{
empty($sName) and burn('UnexpectedValueException', _WT('The argument $sName must not be empty.'));
empty($sValue) and burn('UnexpectedValueException', _WT('The argument $sValue must not be empty.'));
strpos($sName, "\r") !== false || strpos($sName, "\n") !== false || strpos($sValue, "\r") !== false || strpos($sValue, "\n") !== false and burn('UnexpectedValueException', _WT('Line breaks are not allowed in headers to prevent HTTP Response Splitting.'));
strpos($sName, "") !== false || strpos($sValue, "") !== false and burn('UnexpectedValueException', _WT('NUL characters are not allowed in headers.'));
$this->aHeaders[$sName] = $sValue;
}
示例7: execute
/**
Executes the prepared statement.
@return mixed An instance of weeDatabaseDummyResult if the query returned rows or null.
*/
public function execute()
{
$this->oStatement->execute();
$a = $this->oStatement->errorInfo();
$a[0] == '0000' or burn('DatabaseException', sprintf(_WT("Failed to execute the query with the following error:\n%s"), $a[2]));
$this->iNumAffectedRows = $this->oDb->doRowCount($this->oStatement, true);
if ($this->oStatement->columnCount()) {
return new weeDatabaseDummyResult($this->oStatement->fetchAll(PDO::FETCH_ASSOC));
}
}
示例8: defaultValue
/**
Returns the default value of the column.
@return string The default value of the column.
@throw IllegalStateException The column does not have a default value.
*/
public function defaultValue()
{
$this->hasDefault() or burn('IllegalStateException', _WT('The column does not have a default value.'));
return $this->db()->queryValue('
SELECT pg_catalog.pg_get_expr(adbin, adrelid)
FROM pg_catalog.pg_attrdef
WHERE adrelid = ?::regclass
AND adnum = ?
', $this->oTable->quotedName(), $this->num());
}
示例9: bind
/**
Binds parameters to the statement.
If the query is not using interrogation marks placeholders,
you can call this method with a parameter name and its value.
@overload bind($sName, $mValue) Example of query call with one argument instead of an array.
@param $aParameters The parameters to bind to the statement.
@return $this Used to chain methods.
@throw InvalidArgumentException The bind method has been called with one argument but it's not an array.
@throw InvalidArgumentException The bind method has been called with two arguments but its first is not a string.
@throw BadMethodCallException The bind method has been called with more than 2 arguments.
*/
public function bind($aParameters)
{
if (func_num_args() > 1) {
is_string($aParameters) or burn('InvalidArgumentException', _WT('The first argument of the bind method should be a string when called with two parameters.'));
$aParameters = array($aParameters => func_get_arg(1));
} else {
is_array($aParameters) or burn('InvalidArgumentException', _WT('The given argument of the bind method is not an array.'));
}
$this->doBind($aParameters);
return $this;
}
示例10: __construct
/**
Initialize a new BadXMLException instance.
@param $sMessage The message of the exception.
@param $oError The libxml error associated to the exception.
*/
public function __construct($sMessage, LibXmlError $oError = null)
{
$iCode = 0;
if ($oError) {
$sMessage .= "\n";
$sMessage .= sprintf(_WT('libxml returned the following error (line %d, column %d):'), $oError->line, $oError->column);
$sMessage .= "\n" . $oError->message;
$iCode = $oError->code;
}
parent::__construct($sMessage, $iCode);
}
示例11: execute
/**
Executes the prepared statement.
@return mixed An instance of weeDatabaseDummyResult if the query returned rows or null.
*/
public function execute()
{
// oci_execute triggers a warning when the statement could not be executed.
@oci_execute($this->rStatement, OCI_DEFAULT) or burn('DatabaseException', sprintf(_WT("Failed to execute the query with the following error:\n%s"), array_value(oci_error($this->rStatement), 'message')));
$this->iNumAffectedRows = oci_num_rows($this->rStatement);
if (oci_num_fields($this->rStatement) > 0) {
// TODO: Check whether the silence operator is really required here.
@oci_fetch_all($this->rStatement, $aRows, 0, -1, OCI_ASSOC | OCI_FETCHSTATEMENT_BY_ROW);
return new weeDatabaseDummyResult($aRows);
}
}
示例12: doQuery
/**
Does the mssql-dependent work of the execute method.
@param $sQuery The query to execute.
@return weeSQLiteResult A result set for SELECT queries.
*/
protected function doQuery($sQuery)
{
// mssql_query triggers a warning when the query could not be executed.
$m = @mssql_query($sQuery, $this->rLink);
$m === false and burn('DatabaseException', sprintf(_WT("Failed to execute the query with the following error:\n%s"), mssql_get_last_message()));
// Get it now since it can be wrong if numAffectedRows is called after getPKId
$this->iNumAffectedRows = mssql_rows_affected($this->rLink);
if ($m !== true) {
return new weeMSSQLResult($m);
}
}
示例13: setValue
/**
Attachs a value to the validator.
$mValue must be either a string, an integer, a float, an instance of Printable or an object castable to string.
@param $mValue The value to attach.
@return $this Used to chain methods.
@throw DomainException $mValue is not of a correct type.
*/
public function setValue($mValue)
{
if (is_object($mValue)) {
if ($mValue instanceof Printable) {
$mValue = $mValue->toString();
} elseif (method_exists($mValue, '__toString')) {
$mValue = (string) $mValue;
}
}
is_null($mValue) || is_string($mValue) || is_int($mValue) || is_float($mValue) or burn('DomainException', _WT('$mValue is not of a correct type.'));
return parent::setValue($mValue);
}
示例14: table
/**
Return a table of a given name in the schema.
@param $sName The name of the table.
@return weeOracleDbMetaTable The table.
@throw UnexpectedValueException The table does not exist in the schema.
*/
public function table($sName)
{
$oQuery = $this->meta()->db()->query('
SELECT OWNER AS "schema", TABLE_NAME AS "name", t.NUM_ROWS, c.COMMENTS AS "comment"
FROM SYS.ALL_TABLES t LEFT JOIN SYS.ALL_TAB_COMMENTS c USING (OWNER, TABLE_NAME)
WHERE TABLE_NAME = :table
AND OWNER = :name
AND t.DURATION IS NULL
', array('table' => $sName) + $this->aData);
count($oQuery) == 1 or burn('UnexpectedValueException', sprintf(_WT('Table "%s" does not exist in the schema.'), $sName));
$sClass = $this->meta()->getTableClass();
return new $sClass($this->meta(), $oQuery->fetch());
}
示例15: doQuery
/**
Does the sqlite-dependent work of the execute method.
@param $sQuery The query to execute.
@return weeSQLiteResult A result set for SELECT queries.
*/
protected function doQuery($sQuery)
{
// SQLiteDatabase::query triggers a warning when the query could not be executed.
$m = @$this->oSQLiteDb->query($sQuery, SQLITE_ASSOC, $sLastError);
if ($m === false) {
if ($sLastError === null) {
$sLastError = sqlite_error_string($this->oSQLiteDb->lastError());
}
burn('DatabaseException', sprintf(_WT("Failed to execute the query with the following error:\n%s"), $sLastError));
}
$this->iNumAffectedRows = $this->oSQLiteDb->changes();
if ($m->numFields()) {
return new weeSQLiteResult($m);
}
}