code
stringlengths 17
296k
| docstring
stringlengths 30
30.3k
| func_name
stringlengths 1
89
| language
stringclasses 1
value | repo
stringlengths 7
63
| path
stringlengths 7
153
| url
stringlengths 51
209
| license
stringclasses 4
values |
---|---|---|---|---|---|---|---|
public function field_data($table)
{
if (($query = $this->query('PRAGMA TABLE_INFO('.$this->protect_identifiers($table, TRUE, NULL, FALSE).')')) === FALSE)
{
return FALSE;
}
$query = $query->result_array();
if (empty($query))
{
return FALSE;
}
$retval = array();
for ($i = 0, $c = count($query); $i < $c; $i++)
{
$retval[$i] = new stdClass();
$retval[$i]->name = $query[$i]['name'];
$retval[$i]->type = $query[$i]['type'];
$retval[$i]->max_length = NULL;
$retval[$i]->default = $query[$i]['dflt_value'];
$retval[$i]->primary_key = isset($query[$i]['pk']) ? (int) $query[$i]['pk'] : 0;
}
return $retval;
} | Returns an object with field data
@param string $table
@return array | field_data | php | ronknight/InventorySystem | system/database/drivers/sqlite3/sqlite3_driver.php | https://github.com/ronknight/InventorySystem/blob/master/system/database/drivers/sqlite3/sqlite3_driver.php | MIT |
protected function _replace($table, $keys, $values)
{
return 'INSERT OR '.parent::_replace($table, $keys, $values);
} | Replace statement
Generates a platform-specific replace string from the supplied data
@param string $table Table name
@param array $keys INSERT keys
@param array $values INSERT values
@return string | _replace | php | ronknight/InventorySystem | system/database/drivers/sqlite3/sqlite3_driver.php | https://github.com/ronknight/InventorySystem/blob/master/system/database/drivers/sqlite3/sqlite3_driver.php | MIT |
protected function _truncate($table)
{
return 'DELETE FROM '.$table;
} | Truncate statement
Generates a platform-specific truncate string from the supplied data
If the database does not support the TRUNCATE statement,
then this method maps to 'DELETE FROM table'
@param string $table
@return string | _truncate | php | ronknight/InventorySystem | system/database/drivers/sqlite3/sqlite3_driver.php | https://github.com/ronknight/InventorySystem/blob/master/system/database/drivers/sqlite3/sqlite3_driver.php | MIT |
protected function _attr_type(&$attributes)
{
switch (strtoupper($attributes['TYPE']))
{
case 'ENUM':
case 'SET':
$attributes['TYPE'] = 'TEXT';
return;
default: return;
}
} | Field attribute TYPE
Performs a data type mapping between different databases.
@param array &$attributes
@return void | _attr_type | php | ronknight/InventorySystem | system/database/drivers/sqlite3/sqlite3_forge.php | https://github.com/ronknight/InventorySystem/blob/master/system/database/drivers/sqlite3/sqlite3_forge.php | MIT |
protected function _attr_auto_increment(&$attributes, &$field)
{
if ( ! empty($attributes['AUTO_INCREMENT']) && $attributes['AUTO_INCREMENT'] === TRUE && stripos($field['type'], 'int') !== FALSE)
{
$field['type'] = 'INTEGER PRIMARY KEY';
$field['default'] = '';
$field['null'] = '';
$field['unique'] = '';
$field['auto_increment'] = ' AUTOINCREMENT';
$this->primary_keys = array();
}
} | Field attribute AUTO_INCREMENT
@param array &$attributes
@param array &$field
@return void | _attr_auto_increment | php | ronknight/InventorySystem | system/database/drivers/sqlite3/sqlite3_forge.php | https://github.com/ronknight/InventorySystem/blob/master/system/database/drivers/sqlite3/sqlite3_forge.php | MIT |
public function num_fields()
{
return $this->result_id->numColumns();
} | Number of fields in the result set
@return int | num_fields | php | ronknight/InventorySystem | system/database/drivers/sqlite3/sqlite3_result.php | https://github.com/ronknight/InventorySystem/blob/master/system/database/drivers/sqlite3/sqlite3_result.php | MIT |
public function list_fields()
{
$field_names = array();
for ($i = 0, $c = $this->num_fields(); $i < $c; $i++)
{
$field_names[] = $this->result_id->columnName($i);
}
return $field_names;
} | Fetch Field Names
Generates an array of column names
@return array | list_fields | php | ronknight/InventorySystem | system/database/drivers/sqlite3/sqlite3_result.php | https://github.com/ronknight/InventorySystem/blob/master/system/database/drivers/sqlite3/sqlite3_result.php | MIT |
public function field_data()
{
static $data_types = array(
SQLITE3_INTEGER => 'integer',
SQLITE3_FLOAT => 'float',
SQLITE3_TEXT => 'text',
SQLITE3_BLOB => 'blob',
SQLITE3_NULL => 'null'
);
$retval = array();
for ($i = 0, $c = $this->num_fields(); $i < $c; $i++)
{
$retval[$i] = new stdClass();
$retval[$i]->name = $this->result_id->columnName($i);
$type = $this->result_id->columnType($i);
$retval[$i]->type = isset($data_types[$type]) ? $data_types[$type] : $type;
$retval[$i]->max_length = NULL;
}
return $retval;
} | Field data
Generates an array of objects containing field meta-data
@return array | field_data | php | ronknight/InventorySystem | system/database/drivers/sqlite3/sqlite3_result.php | https://github.com/ronknight/InventorySystem/blob/master/system/database/drivers/sqlite3/sqlite3_result.php | MIT |
protected function _fetch_assoc()
{
return $this->result_id->fetchArray(SQLITE3_ASSOC);
} | Result - associative array
Returns the result set as an array
@return array | _fetch_assoc | php | ronknight/InventorySystem | system/database/drivers/sqlite3/sqlite3_result.php | https://github.com/ronknight/InventorySystem/blob/master/system/database/drivers/sqlite3/sqlite3_result.php | MIT |
public function data_seek($n = 0)
{
// Only resetting to the start of the result set is supported
return ($n > 0) ? FALSE : $this->result_id->reset();
} | Data Seek
Moves the internal pointer to the desired offset. We call
this internally before fetching results to make sure the
result set starts at zero.
@param int $n (ignored)
@return array | data_seek | php | ronknight/InventorySystem | system/database/drivers/sqlite3/sqlite3_result.php | https://github.com/ronknight/InventorySystem/blob/master/system/database/drivers/sqlite3/sqlite3_result.php | MIT |
public function num_rows()
{
return is_int($this->num_rows)
? $this->num_rows
: $this->num_rows = mssql_num_rows($this->result_id);
} | Number of rows in the result set
@return int | num_rows | php | ronknight/InventorySystem | system/database/drivers/mssql/mssql_result.php | https://github.com/ronknight/InventorySystem/blob/master/system/database/drivers/mssql/mssql_result.php | MIT |
public function num_fields()
{
return mssql_num_fields($this->result_id);
} | Number of fields in the result set
@return int | num_fields | php | ronknight/InventorySystem | system/database/drivers/mssql/mssql_result.php | https://github.com/ronknight/InventorySystem/blob/master/system/database/drivers/mssql/mssql_result.php | MIT |
public function list_fields()
{
$field_names = array();
mssql_field_seek($this->result_id, 0);
while ($field = mssql_fetch_field($this->result_id))
{
$field_names[] = $field->name;
}
return $field_names;
} | Fetch Field Names
Generates an array of column names
@return array | list_fields | php | ronknight/InventorySystem | system/database/drivers/mssql/mssql_result.php | https://github.com/ronknight/InventorySystem/blob/master/system/database/drivers/mssql/mssql_result.php | MIT |
public function field_data()
{
$retval = array();
for ($i = 0, $c = $this->num_fields(); $i < $c; $i++)
{
$field = mssql_fetch_field($this->result_id, $i);
$retval[$i] = new stdClass();
$retval[$i]->name = $field->name;
$retval[$i]->type = $field->type;
$retval[$i]->max_length = $field->max_length;
}
return $retval;
} | Field data
Generates an array of objects containing field meta-data
@return array | field_data | php | ronknight/InventorySystem | system/database/drivers/mssql/mssql_result.php | https://github.com/ronknight/InventorySystem/blob/master/system/database/drivers/mssql/mssql_result.php | MIT |
public function data_seek($n = 0)
{
return mssql_data_seek($this->result_id, $n);
} | Data Seek
Moves the internal pointer to the desired offset. We call
this internally before fetching results to make sure the
result set starts at zero.
@param int $n
@return bool | data_seek | php | ronknight/InventorySystem | system/database/drivers/mssql/mssql_result.php | https://github.com/ronknight/InventorySystem/blob/master/system/database/drivers/mssql/mssql_result.php | MIT |
protected function _fetch_assoc()
{
return mssql_fetch_assoc($this->result_id);
} | Result - associative array
Returns the result set as an array
@return array | _fetch_assoc | php | ronknight/InventorySystem | system/database/drivers/mssql/mssql_result.php | https://github.com/ronknight/InventorySystem/blob/master/system/database/drivers/mssql/mssql_result.php | MIT |
protected function _fetch_object($class_name = 'stdClass')
{
$row = mssql_fetch_object($this->result_id);
if ($class_name === 'stdClass' OR ! $row)
{
return $row;
}
$class_name = new $class_name();
foreach ($row as $key => $value)
{
$class_name->$key = $value;
}
return $class_name;
} | Result - object
Returns the result set as an object
@param string $class_name
@return object | _fetch_object | php | ronknight/InventorySystem | system/database/drivers/mssql/mssql_result.php | https://github.com/ronknight/InventorySystem/blob/master/system/database/drivers/mssql/mssql_result.php | MIT |
protected function _attr_type(&$attributes)
{
if (isset($attributes['CONSTRAINT']) && strpos($attributes['TYPE'], 'INT') !== FALSE)
{
unset($attributes['CONSTRAINT']);
}
switch (strtoupper($attributes['TYPE']))
{
case 'MEDIUMINT':
$attributes['TYPE'] = 'INTEGER';
$attributes['UNSIGNED'] = FALSE;
return;
case 'INTEGER':
$attributes['TYPE'] = 'INT';
return;
default: return;
}
} | Field attribute TYPE
Performs a data type mapping between different databases.
@param array &$attributes
@return void | _attr_type | php | ronknight/InventorySystem | system/database/drivers/mssql/mssql_forge.php | https://github.com/ronknight/InventorySystem/blob/master/system/database/drivers/mssql/mssql_forge.php | MIT |
protected function _attr_auto_increment(&$attributes, &$field)
{
if ( ! empty($attributes['AUTO_INCREMENT']) && $attributes['AUTO_INCREMENT'] === TRUE && stripos($field['type'], 'int') !== FALSE)
{
$field['auto_increment'] = ' IDENTITY(1,1)';
}
} | Field attribute AUTO_INCREMENT
@param array &$attributes
@param array &$field
@return void | _attr_auto_increment | php | ronknight/InventorySystem | system/database/drivers/mssql/mssql_forge.php | https://github.com/ronknight/InventorySystem/blob/master/system/database/drivers/mssql/mssql_forge.php | MIT |
public function __construct($params)
{
parent::__construct($params);
if ( ! empty($this->port))
{
$this->hostname .= (DIRECTORY_SEPARATOR === '\\' ? ',' : ':').$this->port;
}
} | Class constructor
Appends the port number to the hostname, if needed.
@param array $params
@return void | __construct | php | ronknight/InventorySystem | system/database/drivers/mssql/mssql_driver.php | https://github.com/ronknight/InventorySystem/blob/master/system/database/drivers/mssql/mssql_driver.php | MIT |
public function db_connect($persistent = FALSE)
{
$this->conn_id = ($persistent)
? mssql_pconnect($this->hostname, $this->username, $this->password)
: mssql_connect($this->hostname, $this->username, $this->password);
if ( ! $this->conn_id)
{
return FALSE;
}
// ----------------------------------------------------------------
// Select the DB... assuming a database name is specified in the config file
if ($this->database !== '' && ! $this->db_select())
{
log_message('error', 'Unable to select database: '.$this->database);
return ($this->db_debug === TRUE)
? $this->display_error('db_unable_to_select', $this->database)
: FALSE;
}
// Determine how identifiers are escaped
$query = $this->query('SELECT CASE WHEN (@@OPTIONS | 256) = @@OPTIONS THEN 1 ELSE 0 END AS qi');
$query = $query->row_array();
$this->_quoted_identifier = empty($query) ? FALSE : (bool) $query['qi'];
$this->_escape_char = ($this->_quoted_identifier) ? '"' : array('[', ']');
return $this->conn_id;
} | Non-persistent database connection
@param bool $persistent
@return resource | db_connect | php | ronknight/InventorySystem | system/database/drivers/mssql/mssql_driver.php | https://github.com/ronknight/InventorySystem/blob/master/system/database/drivers/mssql/mssql_driver.php | MIT |
public function insert_id()
{
$query = version_compare($this->version(), '8', '>=')
? 'SELECT SCOPE_IDENTITY() AS last_id'
: 'SELECT @@IDENTITY AS last_id';
$query = $this->query($query);
$query = $query->row();
return $query->last_id;
} | Insert ID
Returns the last id created in the Identity column.
@return string | insert_id | php | ronknight/InventorySystem | system/database/drivers/mssql/mssql_driver.php | https://github.com/ronknight/InventorySystem/blob/master/system/database/drivers/mssql/mssql_driver.php | MIT |
protected function _list_tables($prefix_limit = FALSE)
{
$sql = 'SELECT '.$this->escape_identifiers('name')
.' FROM '.$this->escape_identifiers('sysobjects')
.' WHERE '.$this->escape_identifiers('type')." = 'U'";
if ($prefix_limit !== FALSE && $this->dbprefix !== '')
{
$sql .= ' AND '.$this->escape_identifiers('name')." LIKE '".$this->escape_like_str($this->dbprefix)."%' "
.sprintf($this->_like_escape_str, $this->_like_escape_chr);
}
return $sql.' ORDER BY '.$this->escape_identifiers('name');
} | List table query
Generates a platform-specific query string so that the table names can be fetched
@param bool $prefix_limit
@return string | _list_tables | php | ronknight/InventorySystem | system/database/drivers/mssql/mssql_driver.php | https://github.com/ronknight/InventorySystem/blob/master/system/database/drivers/mssql/mssql_driver.php | MIT |
protected function _list_columns($table = '')
{
return 'SELECT COLUMN_NAME
FROM INFORMATION_SCHEMA.Columns
WHERE UPPER(TABLE_NAME) = '.$this->escape(strtoupper($table));
} | List column query
Generates a platform-specific query string so that the column names can be fetched
@param string $table
@return string | _list_columns | php | ronknight/InventorySystem | system/database/drivers/mssql/mssql_driver.php | https://github.com/ronknight/InventorySystem/blob/master/system/database/drivers/mssql/mssql_driver.php | MIT |
public function field_data($table)
{
$sql = 'SELECT COLUMN_NAME, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH, NUMERIC_PRECISION, COLUMN_DEFAULT
FROM INFORMATION_SCHEMA.Columns
WHERE UPPER(TABLE_NAME) = '.$this->escape(strtoupper($table));
if (($query = $this->query($sql)) === FALSE)
{
return FALSE;
}
$query = $query->result_object();
$retval = array();
for ($i = 0, $c = count($query); $i < $c; $i++)
{
$retval[$i] = new stdClass();
$retval[$i]->name = $query[$i]->COLUMN_NAME;
$retval[$i]->type = $query[$i]->DATA_TYPE;
$retval[$i]->max_length = ($query[$i]->CHARACTER_MAXIMUM_LENGTH > 0) ? $query[$i]->CHARACTER_MAXIMUM_LENGTH : $query[$i]->NUMERIC_PRECISION;
$retval[$i]->default = $query[$i]->COLUMN_DEFAULT;
}
return $retval;
} | Returns an object with field data
@param string $table
@return array | field_data | php | ronknight/InventorySystem | system/database/drivers/mssql/mssql_driver.php | https://github.com/ronknight/InventorySystem/blob/master/system/database/drivers/mssql/mssql_driver.php | MIT |
protected function _update($table, $values)
{
$this->qb_limit = FALSE;
$this->qb_orderby = array();
return parent::_update($table, $values);
} | Update statement
Generates a platform-specific update string from the supplied data
@param string $table
@param array $values
@return string | _update | php | ronknight/InventorySystem | system/database/drivers/mssql/mssql_driver.php | https://github.com/ronknight/InventorySystem/blob/master/system/database/drivers/mssql/mssql_driver.php | MIT |
protected function _truncate($table)
{
return 'TRUNCATE TABLE '.$table;
} | Truncate statement
Generates a platform-specific truncate string from the supplied data
If the database does not support the TRUNCATE statement,
then this method maps to 'DELETE FROM table'
@param string $table
@return string | _truncate | php | ronknight/InventorySystem | system/database/drivers/mssql/mssql_driver.php | https://github.com/ronknight/InventorySystem/blob/master/system/database/drivers/mssql/mssql_driver.php | MIT |
protected function _delete($table)
{
if ($this->qb_limit)
{
return 'WITH ci_delete AS (SELECT TOP '.$this->qb_limit.' * FROM '.$table.$this->_compile_wh('qb_where').') DELETE FROM ci_delete';
}
return parent::_delete($table);
} | Delete statement
Generates a platform-specific delete string from the supplied data
@param string $table
@return string | _delete | php | ronknight/InventorySystem | system/database/drivers/mssql/mssql_driver.php | https://github.com/ronknight/InventorySystem/blob/master/system/database/drivers/mssql/mssql_driver.php | MIT |
protected function _limit($sql)
{
$limit = $this->qb_offset + $this->qb_limit;
// As of SQL Server 2005 (9.0.*) ROW_NUMBER() is supported,
// however an ORDER BY clause is required for it to work
if (version_compare($this->version(), '9', '>=') && $this->qb_offset && ! empty($this->qb_orderby))
{
$orderby = $this->_compile_order_by();
// We have to strip the ORDER BY clause
$sql = trim(substr($sql, 0, strrpos($sql, $orderby)));
// Get the fields to select from our subquery, so that we can avoid CI_rownum appearing in the actual results
if (count($this->qb_select) === 0 OR strpos(implode(',', $this->qb_select), '*') !== FALSE)
{
$select = '*'; // Inevitable
}
else
{
// Use only field names and their aliases, everything else is out of our scope.
$select = array();
$field_regexp = ($this->_quoted_identifier)
? '("[^\"]+")' : '(\[[^\]]+\])';
for ($i = 0, $c = count($this->qb_select); $i < $c; $i++)
{
$select[] = preg_match('/(?:\s|\.)'.$field_regexp.'$/i', $this->qb_select[$i], $m)
? $m[1] : $this->qb_select[$i];
}
$select = implode(', ', $select);
}
return 'SELECT '.$select." FROM (\n\n"
.preg_replace('/^(SELECT( DISTINCT)?)/i', '\\1 ROW_NUMBER() OVER('.trim($orderby).') AS '.$this->escape_identifiers('CI_rownum').', ', $sql)
."\n\n) ".$this->escape_identifiers('CI_subquery')
."\nWHERE ".$this->escape_identifiers('CI_rownum').' BETWEEN '.($this->qb_offset + 1).' AND '.$limit;
} | LIMIT
Generates a platform-specific LIMIT clause
@param string $sql SQL Query
@return string | _limit | php | ronknight/InventorySystem | system/database/drivers/mssql/mssql_driver.php | https://github.com/ronknight/InventorySystem/blob/master/system/database/drivers/mssql/mssql_driver.php | MIT |
protected function _insert_batch($table, $keys, $values)
{
// Multiple-value inserts are only supported as of SQL Server 2008
if (version_compare($this->version(), '10', '>='))
{
return parent::_insert_batch($table, $keys, $values);
}
return ($this->db_debug) ? $this->display_error('db_unsupported_feature') : FALSE;
} | Insert batch statement
Generates a platform-specific insert string from the supplied data.
@param string $table Table name
@param array $keys INSERT keys
@param array $values INSERT values
@return string|bool | _insert_batch | php | ronknight/InventorySystem | system/database/drivers/mssql/mssql_driver.php | https://github.com/ronknight/InventorySystem/blob/master/system/database/drivers/mssql/mssql_driver.php | MIT |
protected function _attr_auto_increment(&$attributes, &$field)
{
// Not supported - sequences and triggers must be used instead
} | Field attribute AUTO_INCREMENT
@param array &$attributes
@param array &$field
@return void | _attr_auto_increment | php | ronknight/InventorySystem | system/database/drivers/oci8/oci8_forge.php | https://github.com/ronknight/InventorySystem/blob/master/system/database/drivers/oci8/oci8_forge.php | MIT |
protected function _attr_type(&$attributes)
{
switch (strtoupper($attributes['TYPE']))
{
case 'TINYINT':
$attributes['TYPE'] = 'NUMBER';
return;
case 'MEDIUMINT':
$attributes['TYPE'] = 'NUMBER';
return;
case 'INT':
$attributes['TYPE'] = 'NUMBER';
return;
case 'BIGINT':
$attributes['TYPE'] = 'NUMBER';
return;
default: return;
}
} | Field attribute TYPE
Performs a data type mapping between different databases.
@param array &$attributes
@return void | _attr_type | php | ronknight/InventorySystem | system/database/drivers/oci8/oci8_forge.php | https://github.com/ronknight/InventorySystem/blob/master/system/database/drivers/oci8/oci8_forge.php | MIT |
public function db_connect($persistent = FALSE)
{
$func = ($persistent === TRUE) ? 'oci_pconnect' : 'oci_connect';
return empty($this->char_set)
? $func($this->username, $this->password, $this->dsn)
: $func($this->username, $this->password, $this->dsn, $this->char_set);
} | Non-persistent database connection
@param bool $persistent
@return resource | db_connect | php | ronknight/InventorySystem | system/database/drivers/oci8/oci8_driver.php | https://github.com/ronknight/InventorySystem/blob/master/system/database/drivers/oci8/oci8_driver.php | MIT |
public function get_cursor()
{
return $this->curs_id = oci_new_cursor($this->conn_id);
} | Get cursor. Returns a cursor from the database
@return resource | get_cursor | php | ronknight/InventorySystem | system/database/drivers/oci8/oci8_driver.php | https://github.com/ronknight/InventorySystem/blob/master/system/database/drivers/oci8/oci8_driver.php | MIT |
public function stored_procedure($package, $procedure, array $params)
{
if ($package === '' OR $procedure === '')
{
log_message('error', 'Invalid query: '.$package.'.'.$procedure);
return ($this->db_debug) ? $this->display_error('db_invalid_query') : FALSE;
}
// Build the query string
$sql = 'BEGIN '.$package.'.'.$procedure.'(';
$have_cursor = FALSE;
foreach ($params as $param)
{
$sql .= $param['name'].',';
if (isset($param['type']) && $param['type'] === OCI_B_CURSOR)
{
$have_cursor = TRUE;
}
}
$sql = trim($sql, ',').'); END;';
$this->_reset_stmt_id = FALSE;
$this->stmt_id = oci_parse($this->conn_id, $sql);
$this->_bind_params($params);
$result = $this->query($sql, FALSE, $have_cursor);
$this->_reset_stmt_id = TRUE;
return $result;
} | Stored Procedure. Executes a stored procedure
@param string package name in which the stored procedure is in
@param string stored procedure name to execute
@param array parameters
@return mixed
params array keys
KEY OPTIONAL NOTES
name no the name of the parameter should be in :<param_name> format
value no the value of the parameter. If this is an OUT or IN OUT parameter,
this should be a reference to a variable
type yes the type of the parameter
length yes the max size of the parameter | stored_procedure | php | ronknight/InventorySystem | system/database/drivers/oci8/oci8_driver.php | https://github.com/ronknight/InventorySystem/blob/master/system/database/drivers/oci8/oci8_driver.php | MIT |
protected function _list_tables($prefix_limit = FALSE)
{
$sql = 'SELECT "TABLE_NAME" FROM "ALL_TABLES"';
if ($prefix_limit !== FALSE && $this->dbprefix !== '')
{
return $sql.' WHERE "TABLE_NAME" LIKE \''.$this->escape_like_str($this->dbprefix)."%' "
.sprintf($this->_like_escape_str, $this->_like_escape_chr);
}
return $sql;
} | Show table query
Generates a platform-specific query string so that the table names can be fetched
@param bool $prefix_limit
@return string | _list_tables | php | ronknight/InventorySystem | system/database/drivers/oci8/oci8_driver.php | https://github.com/ronknight/InventorySystem/blob/master/system/database/drivers/oci8/oci8_driver.php | MIT |
protected function _list_columns($table = '')
{
if (strpos($table, '.') !== FALSE)
{
sscanf($table, '%[^.].%s', $owner, $table);
}
else
{
$owner = $this->username;
}
return 'SELECT COLUMN_NAME FROM ALL_TAB_COLUMNS
WHERE UPPER(OWNER) = '.$this->escape(strtoupper($owner)).'
AND UPPER(TABLE_NAME) = '.$this->escape(strtoupper($table));
} | Show column query
Generates a platform-specific query string so that the column names can be fetched
@param string $table
@return string | _list_columns | php | ronknight/InventorySystem | system/database/drivers/oci8/oci8_driver.php | https://github.com/ronknight/InventorySystem/blob/master/system/database/drivers/oci8/oci8_driver.php | MIT |
public function field_data($table)
{
if (strpos($table, '.') !== FALSE)
{
sscanf($table, '%[^.].%s', $owner, $table);
}
else
{
$owner = $this->username;
}
$sql = 'SELECT COLUMN_NAME, DATA_TYPE, CHAR_LENGTH, DATA_PRECISION, DATA_LENGTH, DATA_DEFAULT, NULLABLE
FROM ALL_TAB_COLUMNS
WHERE UPPER(OWNER) = '.$this->escape(strtoupper($owner)).'
AND UPPER(TABLE_NAME) = '.$this->escape(strtoupper($table));
if (($query = $this->query($sql)) === FALSE)
{
return FALSE;
}
$query = $query->result_object();
$retval = array();
for ($i = 0, $c = count($query); $i < $c; $i++)
{
$retval[$i] = new stdClass();
$retval[$i]->name = $query[$i]->COLUMN_NAME;
$retval[$i]->type = $query[$i]->DATA_TYPE;
$length = ($query[$i]->CHAR_LENGTH > 0)
? $query[$i]->CHAR_LENGTH : $query[$i]->DATA_PRECISION;
if ($length === NULL)
{
$length = $query[$i]->DATA_LENGTH;
}
$retval[$i]->max_length = $length;
$default = $query[$i]->DATA_DEFAULT;
if ($default === NULL && $query[$i]->NULLABLE === 'N')
{
$default = '';
}
$retval[$i]->default = $default;
}
return $retval;
} | Returns an object with field data
@param string $table
@return array | field_data | php | ronknight/InventorySystem | system/database/drivers/oci8/oci8_driver.php | https://github.com/ronknight/InventorySystem/blob/master/system/database/drivers/oci8/oci8_driver.php | MIT |
protected function _insert_batch($table, $keys, $values)
{
$keys = implode(', ', $keys);
$sql = "INSERT ALL\n";
for ($i = 0, $c = count($values); $i < $c; $i++)
{
$sql .= ' INTO '.$table.' ('.$keys.') VALUES '.$values[$i]."\n";
}
return $sql.'SELECT * FROM dual';
} | Insert batch statement
Generates a platform-specific insert string from the supplied data
@param string $table Table name
@param array $keys INSERT keys
@param array $values INSERT values
@return string | _insert_batch | php | ronknight/InventorySystem | system/database/drivers/oci8/oci8_driver.php | https://github.com/ronknight/InventorySystem/blob/master/system/database/drivers/oci8/oci8_driver.php | MIT |
protected function _truncate($table)
{
return 'TRUNCATE TABLE '.$table;
} | Truncate statement
Generates a platform-specific truncate string from the supplied data
If the database does not support the TRUNCATE statement,
then this method maps to 'DELETE FROM table'
@param string $table
@return string | _truncate | php | ronknight/InventorySystem | system/database/drivers/oci8/oci8_driver.php | https://github.com/ronknight/InventorySystem/blob/master/system/database/drivers/oci8/oci8_driver.php | MIT |
protected function _delete($table)
{
if ($this->qb_limit)
{
$this->where('rownum <= ',$this->qb_limit, FALSE);
$this->qb_limit = FALSE;
}
return parent::_delete($table);
} | Delete statement
Generates a platform-specific delete string from the supplied data
@param string $table
@return string | _delete | php | ronknight/InventorySystem | system/database/drivers/oci8/oci8_driver.php | https://github.com/ronknight/InventorySystem/blob/master/system/database/drivers/oci8/oci8_driver.php | MIT |
protected function _limit($sql)
{
if (version_compare($this->version(), '12.1', '>='))
{
// OFFSET-FETCH can be used only with the ORDER BY clause
empty($this->qb_orderby) && $sql .= ' ORDER BY 1';
return $sql.' OFFSET '.(int) $this->qb_offset.' ROWS FETCH NEXT '.$this->qb_limit.' ROWS ONLY';
} | LIMIT
Generates a platform-specific LIMIT clause
@param string $sql SQL Query
@return string | _limit | php | ronknight/InventorySystem | system/database/drivers/oci8/oci8_driver.php | https://github.com/ronknight/InventorySystem/blob/master/system/database/drivers/oci8/oci8_driver.php | MIT |
public function num_fields()
{
$count = oci_num_fields($this->stmt_id);
// if we used a limit we subtract it
return ($this->limit_used) ? $count - 1 : $count;
} | Number of fields in the result set
@return int | num_fields | php | ronknight/InventorySystem | system/database/drivers/oci8/oci8_result.php | https://github.com/ronknight/InventorySystem/blob/master/system/database/drivers/oci8/oci8_result.php | MIT |
public function list_fields()
{
$field_names = array();
for ($c = 1, $fieldCount = $this->num_fields(); $c <= $fieldCount; $c++)
{
$field_names[] = oci_field_name($this->stmt_id, $c);
}
return $field_names;
} | Fetch Field Names
Generates an array of column names
@return array | list_fields | php | ronknight/InventorySystem | system/database/drivers/oci8/oci8_result.php | https://github.com/ronknight/InventorySystem/blob/master/system/database/drivers/oci8/oci8_result.php | MIT |
public function field_data()
{
$retval = array();
for ($c = 1, $fieldCount = $this->num_fields(); $c <= $fieldCount; $c++)
{
$F = new stdClass();
$F->name = oci_field_name($this->stmt_id, $c);
$F->type = oci_field_type($this->stmt_id, $c);
$F->max_length = oci_field_size($this->stmt_id, $c);
$retval[] = $F;
}
return $retval;
} | Field data
Generates an array of objects containing field meta-data
@return array | field_data | php | ronknight/InventorySystem | system/database/drivers/oci8/oci8_result.php | https://github.com/ronknight/InventorySystem/blob/master/system/database/drivers/oci8/oci8_result.php | MIT |
protected function _fetch_assoc()
{
$id = ($this->curs_id) ? $this->curs_id : $this->stmt_id;
return oci_fetch_assoc($id);
} | Result - associative array
Returns the result set as an array
@return array | _fetch_assoc | php | ronknight/InventorySystem | system/database/drivers/oci8/oci8_result.php | https://github.com/ronknight/InventorySystem/blob/master/system/database/drivers/oci8/oci8_result.php | MIT |
protected function _fetch_object($class_name = 'stdClass')
{
$row = ($this->curs_id)
? oci_fetch_object($this->curs_id)
: oci_fetch_object($this->stmt_id);
if ($class_name === 'stdClass' OR ! $row)
{
return $row;
}
$class_name = new $class_name();
foreach ($row as $key => $value)
{
$class_name->$key = $value;
}
return $class_name;
} | Result - object
Returns the result set as an object
@param string $class_name
@return object | _fetch_object | php | ronknight/InventorySystem | system/database/drivers/oci8/oci8_result.php | https://github.com/ronknight/InventorySystem/blob/master/system/database/drivers/oci8/oci8_result.php | MIT |
function directory_map($source_dir, $directory_depth = 0, $hidden = FALSE)
{
if ($fp = @opendir($source_dir))
{
$filedata = array();
$new_depth = $directory_depth - 1;
$source_dir = rtrim($source_dir, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR;
while (FALSE !== ($file = readdir($fp)))
{
// Remove '.', '..', and hidden files [optional]
if ($file === '.' OR $file === '..' OR ($hidden === FALSE && $file[0] === '.'))
{
continue;
}
is_dir($source_dir.$file) && $file .= DIRECTORY_SEPARATOR;
if (($directory_depth < 1 OR $new_depth > 0) && is_dir($source_dir.$file))
{
$filedata[$file] = directory_map($source_dir.$file, $new_depth, $hidden);
}
else
{
$filedata[] = $file;
}
}
closedir($fp);
return $filedata;
}
return FALSE;
} | Create a Directory Map
Reads the specified directory and builds an array
representation of it. Sub-folders contained with the
directory will be mapped as well.
@param string $source_dir Path to source
@param int $directory_depth Depth of directories to traverse
(0 = fully recursive, 1 = current dir, etc)
@param bool $hidden Whether to show hidden files
@return array | directory_map | php | ronknight/InventorySystem | system/helpers/directory_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/directory_helper.php | MIT |
function set_cookie($name, $value = '', $expire = '', $domain = '', $path = '/', $prefix = '', $secure = NULL, $httponly = NULL)
{
// Set the config file options
get_instance()->input->set_cookie($name, $value, $expire, $domain, $path, $prefix, $secure, $httponly);
} | Set cookie
Accepts seven parameters, or you can submit an associative
array in the first parameter containing all the values.
@param mixed
@param string the value of the cookie
@param string the number of seconds until expiration
@param string the cookie domain. Usually: .yourdomain.com
@param string the cookie path
@param string the cookie prefix
@param bool true makes the cookie secure
@param bool true makes the cookie accessible via http(s) only (no javascript)
@return void | set_cookie | php | ronknight/InventorySystem | system/helpers/cookie_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/cookie_helper.php | MIT |
function get_cookie($index, $xss_clean = NULL)
{
is_bool($xss_clean) OR $xss_clean = (config_item('global_xss_filtering') === TRUE);
$prefix = isset($_COOKIE[$index]) ? '' : config_item('cookie_prefix');
return get_instance()->input->cookie($prefix.$index, $xss_clean);
} | Fetch an item from the COOKIE array
@param string
@param bool
@return mixed | get_cookie | php | ronknight/InventorySystem | system/helpers/cookie_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/cookie_helper.php | MIT |
function now($timezone = NULL)
{
if (empty($timezone))
{
$timezone = config_item('time_reference');
}
if ($timezone === 'local' OR $timezone === date_default_timezone_get())
{
return time();
}
$datetime = new DateTime('now', new DateTimeZone($timezone));
sscanf($datetime->format('j-n-Y G:i:s'), '%d-%d-%d %d:%d:%d', $day, $month, $year, $hour, $minute, $second);
return mktime($hour, $minute, $second, $month, $day, $year);
} | Get "now" time
Returns time() based on the timezone parameter or on the
"time_reference" setting
@param string
@return int | now | php | ronknight/InventorySystem | system/helpers/date_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/date_helper.php | MIT |
function standard_date($fmt = 'DATE_RFC822', $time = NULL)
{
if (empty($time))
{
$time = now();
}
// Procedural style pre-defined constants from the DateTime extension
if (strpos($fmt, 'DATE_') !== 0 OR defined($fmt) === FALSE)
{
return FALSE;
}
return date(constant($fmt), $time);
} | Standard Date
Returns a date formatted according to the submitted standard.
As of PHP 5.2, the DateTime extension provides constants that
serve for the exact same purpose and are used with date().
@todo Remove in version 3.1+.
@deprecated 3.0.0 Use PHP's native date() instead.
@link http://www.php.net/manual/en/class.datetime.php#datetime.constants.types
@example date(DATE_RFC822, now()); // default
@example date(DATE_W3C, $time); // a different format and time
@param string $fmt = 'DATE_RFC822' the chosen format
@param int $time = NULL Unix timestamp
@return string | standard_date | php | ronknight/InventorySystem | system/helpers/date_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/date_helper.php | MIT |
function timespan($seconds = 1, $time = '', $units = 7)
{
$CI =& get_instance();
$CI->lang->load('date');
is_numeric($seconds) OR $seconds = 1;
is_numeric($time) OR $time = time();
is_numeric($units) OR $units = 7;
$seconds = ($time <= $seconds) ? 1 : $time - $seconds;
$str = array();
$years = floor($seconds / 31557600);
if ($years > 0)
{
$str[] = $years.' '.$CI->lang->line($years > 1 ? 'date_years' : 'date_year');
}
$seconds -= $years * 31557600;
$months = floor($seconds / 2629743);
if (count($str) < $units && ($years > 0 OR $months > 0))
{
if ($months > 0)
{
$str[] = $months.' '.$CI->lang->line($months > 1 ? 'date_months' : 'date_month');
}
$seconds -= $months * 2629743;
}
$weeks = floor($seconds / 604800);
if (count($str) < $units && ($years > 0 OR $months > 0 OR $weeks > 0))
{
if ($weeks > 0)
{
$str[] = $weeks.' '.$CI->lang->line($weeks > 1 ? 'date_weeks' : 'date_week');
}
$seconds -= $weeks * 604800;
}
$days = floor($seconds / 86400);
if (count($str) < $units && ($months > 0 OR $weeks > 0 OR $days > 0))
{
if ($days > 0)
{
$str[] = $days.' '.$CI->lang->line($days > 1 ? 'date_days' : 'date_day');
}
$seconds -= $days * 86400;
}
$hours = floor($seconds / 3600);
if (count($str) < $units && ($days > 0 OR $hours > 0))
{
if ($hours > 0)
{
$str[] = $hours.' '.$CI->lang->line($hours > 1 ? 'date_hours' : 'date_hour');
}
$seconds -= $hours * 3600;
}
$minutes = floor($seconds / 60);
if (count($str) < $units && ($days > 0 OR $hours > 0 OR $minutes > 0))
{
if ($minutes > 0)
{
$str[] = $minutes.' '.$CI->lang->line($minutes > 1 ? 'date_minutes' : 'date_minute');
}
$seconds -= $minutes * 60;
}
if (count($str) === 0)
{
$str[] = $seconds.' '.$CI->lang->line($seconds > 1 ? 'date_seconds' : 'date_second');
}
return implode(', ', $str);
} | Timespan
Returns a span of seconds in this format:
10 days 14 hours 36 minutes 47 seconds
@param int a number of seconds
@param int Unix timestamp
@param int a number of display units
@return string | timespan | php | ronknight/InventorySystem | system/helpers/date_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/date_helper.php | MIT |
function local_to_gmt($time = '')
{
if ($time === '')
{
$time = time();
}
return mktime(
gmdate('G', $time),
gmdate('i', $time),
gmdate('s', $time),
gmdate('n', $time),
gmdate('j', $time),
gmdate('Y', $time)
);
} | Converts a local Unix timestamp to GMT
@param int Unix timestamp
@return int | local_to_gmt | php | ronknight/InventorySystem | system/helpers/date_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/date_helper.php | MIT |
function gmt_to_local($time = '', $timezone = 'UTC', $dst = FALSE)
{
if ($time === '')
{
return now();
}
$time += timezones($timezone) * 3600;
return ($dst === TRUE) ? $time + 3600 : $time;
} | Converts GMT time to a localized value
Takes a Unix timestamp (in GMT) as input, and returns
at the local value based on the timezone and DST setting
submitted
@param int Unix timestamp
@param string timezone
@param bool whether DST is active
@return int | gmt_to_local | php | ronknight/InventorySystem | system/helpers/date_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/date_helper.php | MIT |
function mysql_to_unix($time = '')
{
// We'll remove certain characters for backward compatibility
// since the formatting changed with MySQL 4.1
// YYYY-MM-DD HH:MM:SS
$time = str_replace(array('-', ':', ' '), '', $time);
// YYYYMMDDHHMMSS
return mktime(
substr($time, 8, 2),
substr($time, 10, 2),
substr($time, 12, 2),
substr($time, 4, 2),
substr($time, 6, 2),
substr($time, 0, 4)
);
} | Converts a MySQL Timestamp to Unix
@param int MySQL timestamp YYYY-MM-DD HH:MM:SS
@return int Unix timstamp | mysql_to_unix | php | ronknight/InventorySystem | system/helpers/date_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/date_helper.php | MIT |
function unix_to_human($time = '', $seconds = FALSE, $fmt = 'us')
{
$r = date('Y', $time).'-'.date('m', $time).'-'.date('d', $time).' ';
if ($fmt === 'us')
{
$r .= date('h', $time).':'.date('i', $time);
}
else
{
$r .= date('H', $time).':'.date('i', $time);
}
if ($seconds)
{
$r .= ':'.date('s', $time);
}
if ($fmt === 'us')
{
return $r.' '.date('A', $time);
}
return $r;
} | Unix to "Human"
Formats Unix timestamp to the following prototype: 2006-08-21 11:35 PM
@param int Unix timestamp
@param bool whether to show seconds
@param string format: us or euro
@return string | unix_to_human | php | ronknight/InventorySystem | system/helpers/date_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/date_helper.php | MIT |
function human_to_unix($datestr = '')
{
if ($datestr === '')
{
return FALSE;
}
$datestr = preg_replace('/\040+/', ' ', trim($datestr));
if ( ! preg_match('/^(\d{2}|\d{4})\-[0-9]{1,2}\-[0-9]{1,2}\s[0-9]{1,2}:[0-9]{1,2}(?::[0-9]{1,2})?(?:\s[AP]M)?$/i', $datestr))
{
return FALSE;
}
sscanf($datestr, '%d-%d-%d %s %s', $year, $month, $day, $time, $ampm);
sscanf($time, '%d:%d:%d', $hour, $min, $sec);
isset($sec) OR $sec = 0;
if (isset($ampm))
{
$ampm = strtolower($ampm);
if ($ampm[0] === 'p' && $hour < 12)
{
$hour += 12;
}
elseif ($ampm[0] === 'a' && $hour === 12)
{
$hour = 0;
}
}
return mktime($hour, $min, $sec, $month, $day, $year);
} | Convert "human" date to GMT
Reverses the above process
@param string format: us or euro
@return int | human_to_unix | php | ronknight/InventorySystem | system/helpers/date_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/date_helper.php | MIT |
function timezones($tz = '')
{
// Note: Don't change the order of these even though
// some items appear to be in the wrong order
$zones = array(
'UM12' => -12,
'UM11' => -11,
'UM10' => -10,
'UM95' => -9.5,
'UM9' => -9,
'UM8' => -8,
'UM7' => -7,
'UM6' => -6,
'UM5' => -5,
'UM45' => -4.5,
'UM4' => -4,
'UM35' => -3.5,
'UM3' => -3,
'UM2' => -2,
'UM1' => -1,
'UTC' => 0,
'UP1' => +1,
'UP2' => +2,
'UP3' => +3,
'UP35' => +3.5,
'UP4' => +4,
'UP45' => +4.5,
'UP5' => +5,
'UP55' => +5.5,
'UP575' => +5.75,
'UP6' => +6,
'UP65' => +6.5,
'UP7' => +7,
'UP8' => +8,
'UP875' => +8.75,
'UP9' => +9,
'UP95' => +9.5,
'UP10' => +10,
'UP105' => +10.5,
'UP11' => +11,
'UP115' => +11.5,
'UP12' => +12,
'UP1275' => +12.75,
'UP13' => +13,
'UP14' => +14
);
if ($tz === '')
{
return $zones;
}
return isset($zones[$tz]) ? $zones[$tz] : 0;
} | Timezones
Returns an array of timezones. This is a helper function
for various other ones in this library
@param string timezone
@return string | timezones | php | ronknight/InventorySystem | system/helpers/date_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/date_helper.php | MIT |
function heading($data = '', $h = '1', $attributes = '')
{
return '<h'.$h._stringify_attributes($attributes).'>'.$data.'</h'.$h.'>';
} | Heading
Generates an HTML heading tag.
@param string content
@param int heading level
@param string
@return string | heading | php | ronknight/InventorySystem | system/helpers/html_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/html_helper.php | MIT |
function ul($list, $attributes = '')
{
return _list('ul', $list, $attributes);
} | Unordered List
Generates an HTML unordered list from an single or multi-dimensional array.
@param array
@param mixed
@return string | ul | php | ronknight/InventorySystem | system/helpers/html_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/html_helper.php | MIT |
function ol($list, $attributes = '')
{
return _list('ol', $list, $attributes);
} | Ordered List
Generates an HTML ordered list from an single or multi-dimensional array.
@param array
@param mixed
@return string | ol | php | ronknight/InventorySystem | system/helpers/html_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/html_helper.php | MIT |
function img($src = '', $index_page = FALSE, $attributes = '')
{
if ( ! is_array($src) )
{
$src = array('src' => $src);
}
// If there is no alt attribute defined, set it to an empty string
if ( ! isset($src['alt']))
{
$src['alt'] = '';
}
$img = '<img';
foreach ($src as $k => $v)
{
if ($k === 'src' && ! preg_match('#^(data:[a-z,;])|(([a-z]+:)?(?<!data:)//)#i', $v))
{
if ($index_page === TRUE)
{
$img .= ' src="'.get_instance()->config->site_url($v).'"';
}
else
{
$img .= ' src="'.get_instance()->config->slash_item('base_url').$v.'"';
}
}
else
{
$img .= ' '.$k.'="'.$v.'"';
}
}
return $img._stringify_attributes($attributes).' />';
} | Image
Generates an <img /> element
@param mixed
@param bool
@param mixed
@return string | img | php | ronknight/InventorySystem | system/helpers/html_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/html_helper.php | MIT |
function doctype($type = 'xhtml1-strict')
{
static $doctypes;
if ( ! is_array($doctypes))
{
if (file_exists(APPPATH.'config/doctypes.php'))
{
include(APPPATH.'config/doctypes.php');
}
if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/doctypes.php'))
{
include(APPPATH.'config/'.ENVIRONMENT.'/doctypes.php');
}
if (empty($_doctypes) OR ! is_array($_doctypes))
{
$doctypes = array();
return FALSE;
}
$doctypes = $_doctypes;
}
return isset($doctypes[$type]) ? $doctypes[$type] : FALSE;
} | Doctype
Generates a page document type declaration
Examples of valid options: html5, xhtml-11, xhtml-strict, xhtml-trans,
xhtml-frame, html4-strict, html4-trans, and html4-frame.
All values are saved in the doctypes config file.
@param string type The doctype to be generated
@return string | doctype | php | ronknight/InventorySystem | system/helpers/html_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/html_helper.php | MIT |
function br($count = 1)
{
return str_repeat('<br />', $count);
} | Generates HTML BR tags based on number supplied
@deprecated 3.0.0 Use str_repeat() instead
@param int $count Number of times to repeat the tag
@return string | br | php | ronknight/InventorySystem | system/helpers/html_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/html_helper.php | MIT |
function nbs($num = 1)
{
return str_repeat(' ', $num);
} | Generates non-breaking space entities based on number supplied
@deprecated 3.0.0 Use str_repeat() instead
@param int
@return string | nbs | php | ronknight/InventorySystem | system/helpers/html_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/html_helper.php | MIT |
function character_limiter($str, $n = 500, $end_char = '…')
{
if (mb_strlen($str) < $n)
{
return $str;
}
// a bit complicated, but faster than preg_replace with \s+
$str = preg_replace('/ {2,}/', ' ', str_replace(array("\r", "\n", "\t", "\v", "\f"), ' ', $str));
if (mb_strlen($str) <= $n)
{
return $str;
}
$out = '';
foreach (explode(' ', trim($str)) as $val)
{
$out .= $val.' ';
if (mb_strlen($out) >= $n)
{
$out = trim($out);
return (mb_strlen($out) === mb_strlen($str)) ? $out : $out.$end_char;
}
}
} | Character Limiter
Limits the string based on the character count. Preserves complete words
so the character count may not be exactly as specified.
@param string
@param int
@param string the end character. Usually an ellipsis
@return string | character_limiter | php | ronknight/InventorySystem | system/helpers/text_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/text_helper.php | MIT |
function smiley_js($alias = '', $field_id = '', $inline = TRUE)
{
static $do_setup = TRUE;
$r = '';
if ($alias !== '' && ! is_array($alias))
{
$alias = array($alias => $field_id);
}
if ($do_setup === TRUE)
{
$do_setup = FALSE;
$m = array();
if (is_array($alias))
{
foreach ($alias as $name => $id)
{
$m[] = '"'.$name.'" : "'.$id.'"';
}
}
$m = '{'.implode(',', $m).'}';
$r .= <<<EOF
var smiley_map = {$m};
function insert_smiley(smiley, field_id) {
var el = document.getElementById(field_id), newStart;
if ( ! el && smiley_map[field_id]) {
el = document.getElementById(smiley_map[field_id]);
if ( ! el)
return false;
}
el.focus();
smiley = " " + smiley;
if ('selectionStart' in el) {
newStart = el.selectionStart + smiley.length;
el.value = el.value.substr(0, el.selectionStart) +
smiley +
el.value.substr(el.selectionEnd, el.value.length);
el.setSelectionRange(newStart, newStart);
}
else if (document.selection) {
document.selection.createRange().text = smiley;
}
}
EOF;
}
elseif (is_array($alias))
{
foreach ($alias as $name => $id)
{
$r .= 'smiley_map["'.$name.'"] = "'.$id."\";\n";
}
}
return ($inline)
? '<script type="text/javascript" charset="utf-8">/*<![CDATA[ */'.$r.'// ]]></script>'
: $r;
} | Smiley Javascript
Returns the javascript required for the smiley insertion. Optionally takes
an array of aliases to loosely couple the smiley array to the view.
@param mixed alias name or array of alias->field_id pairs
@param string field_id if alias name was passed in
@param bool
@return array | smiley_js | php | ronknight/InventorySystem | system/helpers/smiley_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/smiley_helper.php | MIT |
function get_clickable_smileys($image_url, $alias = '')
{
// For backward compatibility with js_insert_smiley
if (is_array($alias))
{
$smileys = $alias;
}
elseif (FALSE === ($smileys = _get_smiley_array()))
{
return FALSE;
}
// Add a trailing slash to the file path if needed
$image_url = rtrim($image_url, '/').'/';
$used = array();
foreach ($smileys as $key => $val)
{
// Keep duplicates from being used, which can happen if the
// mapping array contains multiple identical replacements. For example:
// :-) and :) might be replaced with the same image so both smileys
// will be in the array.
if (isset($used[$smileys[$key][0]]))
{
continue;
}
$link[] = '<a href="javascript:void(0);" onclick="insert_smiley(\''.$key.'\', \''.$alias.'\')"><img src="'.$image_url.$smileys[$key][0].'" alt="'.$smileys[$key][3].'" style="width: '.$smileys[$key][1].'; height: '.$smileys[$key][2].'; border: 0;" /></a>';
$used[$smileys[$key][0]] = TRUE;
}
return $link;
} | Get Clickable Smileys
Returns an array of image tag links that can be clicked to be inserted
into a form field.
@param string the URL to the folder containing the smiley images
@param array
@return array | get_clickable_smileys | php | ronknight/InventorySystem | system/helpers/smiley_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/smiley_helper.php | MIT |
function _get_smiley_array()
{
static $_smileys;
if ( ! is_array($_smileys))
{
if (file_exists(APPPATH.'config/smileys.php'))
{
include(APPPATH.'config/smileys.php');
}
if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/smileys.php'))
{
include(APPPATH.'config/'.ENVIRONMENT.'/smileys.php');
}
if (empty($smileys) OR ! is_array($smileys))
{
$_smileys = array();
return FALSE;
}
$_smileys = $smileys;
}
return $_smileys;
} | Get Smiley Array
Fetches the config/smiley.php file
@return mixed | _get_smiley_array | php | ronknight/InventorySystem | system/helpers/smiley_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/smiley_helper.php | MIT |
function singular($str)
{
$result = strval($str);
if ( ! is_countable($result))
{
return $result;
}
$singular_rules = array(
'/(matr)ices$/' => '\1ix',
'/(vert|ind)ices$/' => '\1ex',
'/^(ox)en/' => '\1',
'/(alias)es$/' => '\1',
'/([octop|vir])i$/' => '\1us',
'/(cris|ax|test)es$/' => '\1is',
'/(shoe)s$/' => '\1',
'/(o)es$/' => '\1',
'/(bus|campus)es$/' => '\1',
'/([m|l])ice$/' => '\1ouse',
'/(x|ch|ss|sh)es$/' => '\1',
'/(m)ovies$/' => '\1\2ovie',
'/(s)eries$/' => '\1\2eries',
'/([^aeiouy]|qu)ies$/' => '\1y',
'/([lr])ves$/' => '\1f',
'/(tive)s$/' => '\1',
'/(hive)s$/' => '\1',
'/([^f])ves$/' => '\1fe',
'/(^analy)ses$/' => '\1sis',
'/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/' => '\1\2sis',
'/([ti])a$/' => '\1um',
'/(p)eople$/' => '\1\2erson',
'/(m)en$/' => '\1an',
'/(s)tatuses$/' => '\1\2tatus',
'/(c)hildren$/' => '\1\2hild',
'/(n)ews$/' => '\1\2ews',
'/(quiz)zes$/' => '\1',
'/([^us])s$/' => '\1'
);
foreach ($singular_rules as $rule => $replacement)
{
if (preg_match($rule, $result))
{
$result = preg_replace($rule, $replacement, $result);
break;
}
}
return $result;
} | Singular
Takes a plural word and makes it singular
@param string $str Input string
@return string | singular | php | ronknight/InventorySystem | system/helpers/inflector_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/inflector_helper.php | MIT |
function plural($str)
{
$result = strval($str);
if ( ! is_countable($result))
{
return $result;
}
$plural_rules = array(
'/(quiz)$/' => '\1zes', // quizzes
'/^(ox)$/' => '\1\2en', // ox
'/([m|l])ouse$/' => '\1ice', // mouse, louse
'/(matr|vert|ind)ix|ex$/' => '\1ices', // matrix, vertex, index
'/(x|ch|ss|sh)$/' => '\1es', // search, switch, fix, box, process, address
'/([^aeiouy]|qu)y$/' => '\1ies', // query, ability, agency
'/(hive)$/' => '\1s', // archive, hive
'/(?:([^f])fe|([lr])f)$/' => '\1\2ves', // half, safe, wife
'/sis$/' => 'ses', // basis, diagnosis
'/([ti])um$/' => '\1a', // datum, medium
'/(p)erson$/' => '\1eople', // person, salesperson
'/(m)an$/' => '\1en', // man, woman, spokesman
'/(c)hild$/' => '\1hildren', // child
'/(buffal|tomat)o$/' => '\1\2oes', // buffalo, tomato
'/(bu|campu)s$/' => '\1\2ses', // bus, campus
'/(alias|status|virus)$/' => '\1es', // alias
'/(octop)us$/' => '\1i', // octopus
'/(ax|cris|test)is$/' => '\1es', // axis, crisis
'/s$/' => 's', // no change (compatibility)
'/$/' => 's',
);
foreach ($plural_rules as $rule => $replacement)
{
if (preg_match($rule, $result))
{
$result = preg_replace($rule, $replacement, $result);
break;
}
}
return $result;
} | Plural
Takes a singular word and makes it plural
@param string $str Input string
@return string | plural | php | ronknight/InventorySystem | system/helpers/inflector_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/inflector_helper.php | MIT |
function camelize($str)
{
return strtolower($str[0]).substr(str_replace(' ', '', ucwords(preg_replace('/[\s_]+/', ' ', $str))), 1);
} | Camelize
Takes multiple words separated by spaces or underscores and camelizes them
@param string $str Input string
@return string | camelize | php | ronknight/InventorySystem | system/helpers/inflector_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/inflector_helper.php | MIT |
function underscore($str)
{
return preg_replace('/[\s]+/', '_', trim(MB_ENABLED ? mb_strtolower($str) : strtolower($str)));
} | Underscore
Takes multiple words separated by spaces and underscores them
@param string $str Input string
@return string | underscore | php | ronknight/InventorySystem | system/helpers/inflector_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/inflector_helper.php | MIT |
function humanize($str, $separator = '_')
{
return ucwords(preg_replace('/['.preg_quote($separator).']+/', ' ', trim(MB_ENABLED ? mb_strtolower($str) : strtolower($str))));
} | Humanize
Takes multiple words separated by the separator and changes them to spaces
@param string $str Input string
@param string $separator Input separator
@return string | humanize | php | ronknight/InventorySystem | system/helpers/inflector_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/inflector_helper.php | MIT |
function is_countable($word)
{
return ! in_array(
strtolower($word),
array(
'audio',
'bison',
'chassis',
'compensation',
'coreopsis',
'data',
'deer',
'education',
'emoji',
'equipment',
'fish',
'furniture',
'gold',
'information',
'knowledge',
'love',
'rain',
'money',
'moose',
'nutrition',
'offspring',
'plankton',
'pokemon',
'police',
'rice',
'series',
'sheep',
'species',
'swine',
'traffic',
'wheat'
)
);
} | Checks if the given word has a plural version.
@param string $word Word to check
@return bool | is_countable | php | ronknight/InventorySystem | system/helpers/inflector_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/inflector_helper.php | MIT |
function form_password($data = '', $value = '', $extra = '')
{
is_array($data) OR $data = array('name' => $data);
$data['type'] = 'password';
return form_input($data, $value, $extra);
} | Password Field
Identical to the input function but adds the "password" type
@param mixed
@param string
@param mixed
@return string | form_password | php | ronknight/InventorySystem | system/helpers/form_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/form_helper.php | MIT |
function form_prep($str)
{
return html_escape($str, TRUE);
} | Form Prep
Formats text so that it can be safely placed in a form field in the event it has HTML tags.
@deprecated 3.0.0 An alias for html_escape()
@param string|string[] $str Value to escape
@return string|string[] Escaped values | form_prep | php | ronknight/InventorySystem | system/helpers/form_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/form_helper.php | MIT |
function set_value($field, $default = '', $html_escape = TRUE)
{
$CI =& get_instance();
$value = (isset($CI->form_validation) && is_object($CI->form_validation) && $CI->form_validation->has_rule($field))
? $CI->form_validation->set_value($field, $default)
: $CI->input->post($field, FALSE);
isset($value) OR $value = $default;
return ($html_escape) ? html_escape($value) : $value;
} | Form Value
Grabs a value from the POST array for the specified field so you can
re-populate an input field or textarea. If Form Validation
is active it retrieves the info from the validation class
@param string $field Field name
@param string $default Default value
@param bool $html_escape Whether to escape HTML special characters or not
@return string | set_value | php | ronknight/InventorySystem | system/helpers/form_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/form_helper.php | MIT |
function set_checkbox($field, $value = '', $default = FALSE)
{
$CI =& get_instance();
if (isset($CI->form_validation) && is_object($CI->form_validation) && $CI->form_validation->has_rule($field))
{
return $CI->form_validation->set_checkbox($field, $value, $default);
}
// Form inputs are always strings ...
$value = (string) $value;
$input = $CI->input->post($field, FALSE);
if (is_array($input))
{
// Note: in_array('', array(0)) returns TRUE, do not use it
foreach ($input as &$v)
{
if ($value === $v)
{
return ' checked="checked"';
}
}
return '';
}
// Unchecked checkbox and radio inputs are not even submitted by browsers ...
if ($CI->input->method() === 'post')
{
return ($input === $value) ? ' checked="checked"' : '';
}
return ($default === TRUE) ? ' checked="checked"' : '';
} | Set Checkbox
Let's you set the selected value of a checkbox via the value in the POST array.
If Form Validation is active it retrieves the info from the validation class
@param string
@param string
@param bool
@return string | set_checkbox | php | ronknight/InventorySystem | system/helpers/form_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/form_helper.php | MIT |
function set_radio($field, $value = '', $default = FALSE)
{
$CI =& get_instance();
if (isset($CI->form_validation) && is_object($CI->form_validation) && $CI->form_validation->has_rule($field))
{
return $CI->form_validation->set_radio($field, $value, $default);
}
// Form inputs are always strings ...
$value = (string) $value;
$input = $CI->input->post($field, FALSE);
if (is_array($input))
{
// Note: in_array('', array(0)) returns TRUE, do not use it
foreach ($input as &$v)
{
if ($value === $v)
{
return ' checked="checked"';
}
}
return '';
}
// Unchecked checkbox and radio inputs are not even submitted by browsers ...
if ($CI->input->method() === 'post')
{
return ($input === $value) ? ' checked="checked"' : '';
}
return ($default === TRUE) ? ' checked="checked"' : '';
} | Set Radio
Let's you set the selected value of a radio field via info in the POST array.
If Form Validation is active it retrieves the info from the validation class
@param string $field
@param string $value
@param bool $default
@return string | set_radio | php | ronknight/InventorySystem | system/helpers/form_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/form_helper.php | MIT |
function form_error($field = '', $prefix = '', $suffix = '')
{
if (FALSE === ($OBJ =& _get_validation_object()))
{
return '';
}
return $OBJ->error($field, $prefix, $suffix);
} | Form Error
Returns the error for a specific form field. This is a helper for the
form validation class.
@param string
@param string
@param string
@return string | form_error | php | ronknight/InventorySystem | system/helpers/form_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/form_helper.php | MIT |
function validation_errors($prefix = '', $suffix = '')
{
if (FALSE === ($OBJ =& _get_validation_object()))
{
return '';
}
return $OBJ->error_string($prefix, $suffix);
} | Validation Error String
Returns all the errors associated with a form submission. This is a helper
function for the form validation class.
@param string
@param string
@return string | validation_errors | php | ronknight/InventorySystem | system/helpers/form_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/form_helper.php | MIT |
function _attributes_to_string($attributes)
{
if (empty($attributes))
{
return '';
}
if (is_object($attributes))
{
$attributes = (array) $attributes;
}
if (is_array($attributes))
{
$atts = '';
foreach ($attributes as $key => $val)
{
$atts .= ' '.$key.'="'.$val.'"';
}
return $atts;
}
if (is_string($attributes))
{
return ' '.$attributes;
}
return FALSE;
} | Attributes To String
Helper function used by some of the form helpers
@param mixed
@return string | _attributes_to_string | php | ronknight/InventorySystem | system/helpers/form_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/form_helper.php | MIT |
function &_get_validation_object()
{
$CI =& get_instance();
// We set this as a variable since we're returning by reference.
$return = FALSE;
if (FALSE !== ($object = $CI->load->is_loaded('Form_validation')))
{
if ( ! isset($CI->$object) OR ! is_object($CI->$object))
{
return $return;
}
return $CI->$object;
}
return $return;
} | Validation Object
Determines what the form validation class was instantiated as, fetches
the object and returns it.
@return mixed | _get_validation_object | php | ronknight/InventorySystem | system/helpers/form_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/form_helper.php | MIT |
function xml_convert($str, $protect_all = FALSE)
{
$temp = '__TEMP_AMPERSANDS__';
// Replace entities to temporary markers so that
// ampersands won't get messed up
$str = preg_replace('/&#(\d+);/', $temp.'\\1;', $str);
if ($protect_all === TRUE)
{
$str = preg_replace('/&(\w+);/', $temp.'\\1;', $str);
}
$str = str_replace(
array('&', '<', '>', '"', "'", '-'),
array('&', '<', '>', '"', ''', '-'),
$str
);
// Decode the temp markers back to entities
$str = preg_replace('/'.$temp.'(\d+);/', '&#\\1;', $str);
if ($protect_all === TRUE)
{
return preg_replace('/'.$temp.'(\w+);/', '&\\1;', $str);
}
return $str;
} | Convert Reserved XML characters to Entities
@param string
@param bool
@return string | xml_convert | php | ronknight/InventorySystem | system/helpers/xml_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/xml_helper.php | MIT |
function element($item, array $array, $default = NULL)
{
return array_key_exists($item, $array) ? $array[$item] : $default;
} | Element
Lets you determine whether an array index is set and whether it has a value.
If the element is empty it returns NULL (or whatever you specify as the default value.)
@param string
@param array
@param mixed
@return mixed depends on what the array contains | element | php | ronknight/InventorySystem | system/helpers/array_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/array_helper.php | MIT |
function random_element($array)
{
return is_array($array) ? $array[array_rand($array)] : $array;
} | Random Element - Takes an array as input and returns a random element
@param array
@return mixed depends on what the array contains | random_element | php | ronknight/InventorySystem | system/helpers/array_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/array_helper.php | MIT |
function trim_slashes($str)
{
return trim($str, '/');
} | Trim Slashes
Removes any leading/trailing slashes from a string:
/this/that/theother/
becomes:
this/that/theother
@todo Remove in version 3.1+.
@deprecated 3.0.0 This is just an alias for PHP's native trim()
@param string
@return string | trim_slashes | php | ronknight/InventorySystem | system/helpers/string_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/string_helper.php | MIT |
function strip_quotes($str)
{
return str_replace(array('"', "'"), '', $str);
} | Strip Quotes
Removes single and double quotes from a string
@param string
@return string | strip_quotes | php | ronknight/InventorySystem | system/helpers/string_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/string_helper.php | MIT |
function quotes_to_entities($str)
{
return str_replace(array("\'","\"","'",'"'), array("'",""","'","""), $str);
} | Quotes to Entities
Converts single and double quotes to entities
@param string
@return string | quotes_to_entities | php | ronknight/InventorySystem | system/helpers/string_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/string_helper.php | MIT |
function reduce_double_slashes($str)
{
return preg_replace('#(^|[^:])//+#', '\\1/', $str);
} | Reduce Double Slashes
Converts double slashes in a string to a single slash,
except those found in http://
http://www.some-site.com//index.php
becomes:
http://www.some-site.com/index.php
@param string
@return string | reduce_double_slashes | php | ronknight/InventorySystem | system/helpers/string_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/string_helper.php | MIT |
function reduce_multiples($str, $character = ',', $trim = FALSE)
{
$str = preg_replace('#'.preg_quote($character, '#').'{2,}#', $character, $str);
return ($trim === TRUE) ? trim($str, $character) : $str;
} | Reduce Multiples
Reduces multiple instances of a particular character. Example:
Fred, Bill,, Joe, Jimmy
becomes:
Fred, Bill, Joe, Jimmy
@param string
@param string the character you wish to reduce
@param bool TRUE/FALSE - whether to trim the character from the beginning/end
@return string | reduce_multiples | php | ronknight/InventorySystem | system/helpers/string_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/string_helper.php | MIT |
function alternator()
{
static $i;
if (func_num_args() === 0)
{
$i = 0;
return '';
}
$args = func_get_args();
return $args[($i++ % count($args))];
} | Alternator
Allows strings to be alternated. See docs...
@param string (as many parameters as needed)
@return string | alternator | php | ronknight/InventorySystem | system/helpers/string_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/string_helper.php | MIT |
function read_file($file)
{
return @file_get_contents($file);
} | Read File
Opens the file specified in the path and returns it as a string.
@todo Remove in version 3.1+.
@deprecated 3.0.0 It is now just an alias for PHP's native file_get_contents().
@param string $file Path to file
@return string File contents | read_file | php | ronknight/InventorySystem | system/helpers/file_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/file_helper.php | MIT |
function write_file($path, $data, $mode = 'wb')
{
if ( ! $fp = @fopen($path, $mode))
{
return FALSE;
}
flock($fp, LOCK_EX);
for ($result = $written = 0, $length = strlen($data); $written < $length; $written += $result)
{
if (($result = fwrite($fp, substr($data, $written))) === FALSE)
{
break;
}
}
flock($fp, LOCK_UN);
fclose($fp);
return is_int($result);
} | Write File
Writes data to the file specified in the path.
Creates a new file if non-existent.
@param string $path File path
@param string $data Data to write
@param string $mode fopen() mode (default: 'wb')
@return bool | write_file | php | ronknight/InventorySystem | system/helpers/file_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/file_helper.php | MIT |
function get_mime_by_extension($filename)
{
static $mimes;
if ( ! is_array($mimes))
{
$mimes = get_mimes();
if (empty($mimes))
{
return FALSE;
}
}
$extension = strtolower(substr(strrchr($filename, '.'), 1));
if (isset($mimes[$extension]))
{
return is_array($mimes[$extension])
? current($mimes[$extension]) // Multiple mime types, just give the first one
: $mimes[$extension];
}
return FALSE;
} | Get Mime by Extension
Translates a file extension into a mime type based on config/mimes.php.
Returns FALSE if it can't determine the type, or open the mime config file
Note: this is NOT an accurate way of determining file mime types, and is here strictly as a convenience
It should NOT be trusted, and should certainly NOT be used for security
@param string $filename File name
@return string | get_mime_by_extension | php | ronknight/InventorySystem | system/helpers/file_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/file_helper.php | MIT |
function octal_permissions($perms)
{
return substr(sprintf('%o', $perms), -3);
} | Octal Permissions
Takes a numeric value representing a file's permissions and returns
a three character string representing the file's octal permissions
@param int $perms Permissions
@return string | octal_permissions | php | ronknight/InventorySystem | system/helpers/file_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/file_helper.php | MIT |
function site_url($uri = '', $protocol = NULL)
{
return get_instance()->config->site_url($uri, $protocol);
} | Site URL
Create a local URL based on your basepath. Segments can be passed via the
first parameter either as a string or an array.
@param string $uri
@param string $protocol
@return string | site_url | php | ronknight/InventorySystem | system/helpers/url_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/url_helper.php | MIT |
function base_url($uri = '', $protocol = NULL)
{
return get_instance()->config->base_url($uri, $protocol);
} | Base URL
Create a local URL based on your basepath.
Segments can be passed in as a string or an array, same as site_url
or a URL to a file can be passed in, e.g. to an image file.
@param string $uri
@param string $protocol
@return string | base_url | php | ronknight/InventorySystem | system/helpers/url_helper.php | https://github.com/ronknight/InventorySystem/blob/master/system/helpers/url_helper.php | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.