Get the SQLite type that most closely matches this column type
@return string
178123
function GetSqliteType()
	{
		$rt = $this->Type;
		switch ($this->Type)
		{
			case "int":
				$rt = "integer";
				break;
			case "smallint":
				$rt = "integer";
				break;
			case "tinyint":
				$rt = "integer";
				break;
			case "varchar":
				$rt = "text";
				break;
			case "text":
				$rt = "text";
				break;
			case "tinytext":
				$rt = "text";
				break;
			case "date":
				$rt = "datetime";
				break;
			case "datetime":
				$rt = "datetime";
				break;
			case "mediumint":
				$rt = "integer";
				break;
			case "bigint":
				$rt = "integer";
				break;
			case "decimal":
				$rt = "real";
				break;
			case "float":
				$rt = "real";
				break;
			default;
				break;
		}

		return $rt;
	}
1039607
public function columnSearch()
    {
        $columns = $this->request->get('columns', []);
        for ($i = 0, $c = count($columns); $i < $c; $i++) {
            if ($this->request->isColumnSearchable($i)) {
                $this->isFilterApplied = true;

                $regex   = $this->request->isRegex($i);
                $column  = $this->getColumnName($i);
                $keyword = $this->request->columnKeyword($i);

                $this->collection = $this->collection->filter(
                    function ($row) use ($column, $keyword, $regex) {
                        $data = $this->serialize($row);

                        $value = Arr::get($data, $column);

                        if ($this->config->isCaseInsensitive()) {
                            if ($regex) {
                                return preg_match('/' . $keyword . '/i', $value) == 1;
                            }

                            return strpos(Str::lower($value), Str::lower($keyword)) !== false;
                        }

                        if ($regex) {
                            return preg_match('/' . $keyword . '/', $value) == 1;
                        }

                        return strpos($value, $keyword) !== false;
                    }
                );
            }
        }
    }
541603
public function getDatabaseName()
    {
        if ($this->isSlave() && ! $this->database_name) {
            return $this->_master->getDatabaseName();
        }

        // sqlite data file
        if ($this->driver instanceof SqliteDriver) {
            if ($this->isUseMemory()) {
                return ':memory:';
            }
            if ($this->database_dir && $this->database_name[0] !== '/') {
                return $this->database_dir . '/' . $this->database_name;
            }
        }
        
        return $this->database_name;
    }
508379
private function getPHPDocType($db_type, $relation = null)
    {
        switch ($db_type) {
            case 'datetime':
                return 'string|\Carbon\Carbon';
            case '1t1':
                return '\\'.$this->commandData->config->nsModel.'\\'.$relation->inputs[0].' '.camel_case($relation->inputs[0]);
            case 'mt1':
                if (isset($relation->inputs[1])) {
                    $relationName = str_replace('_id', '', strtolower($relation->inputs[1]));
                } else {
                    $relationName = $relation->inputs[0];
                }

                return '\\'.$this->commandData->config->nsModel.'\\'.$relation->inputs[0].' '.camel_case($relationName);
            case '1tm':
            case 'mtm':
            case 'hmt':
                return '\Illuminate\Database\Eloquent\Collection'.' '.camel_case(str_plural($relation->inputs[0]));
            default:
                $fieldData = SwaggerGenerator::getFieldType($db_type);
                if (!empty($fieldData['fieldType'])) {
                    return $fieldData['fieldType'];
                }

                return $db_type;
        }
    }
783564
final private static function getColumnType($fieldName) {
		
		$db = Database::getInstance();
		$column = $db->describeColumn(static::TABLE_NAME, $fieldName);
		
		if (is_null($column)) {
			return NULL;
		}
		
		// split the column Type to recognize field type and length
		preg_match('#^([\w]+)(\([^\)]+\))? ?(unsigned)?#i', $column->Type, $matches);
		
		$field = new \stdClass();
		
		$field->name	= $fieldName;
		$field->type	= $matches[1];
		$field->unsigned= (isset($matches[3]));
		$field->nullable= 'YES' == $column->Null ? TRUE : FALSE;
		$field->key		= $column->Key;
		$field->default	= $column->Default;
		$field->extra	= $column->Extra;

		if (isset($matches[2])) {
			if (in_array($field->type, ['enum','set'])) {
				$field->length = explode("','", substr($matches[2], 2, -2));
			} else {
				$field->length = explode(",", substr($matches[2], 1, -1));
			}
		} else {
			$field->length = NULL;
		}
		
		return $field;
		
	}
656586
public function getQualifiedForeignKey()
    {
        if (is_array($this->foreignKey)) { //Check for multi-columns relationship
            return array_map(function ($k) {
                return $this->child->getTable().'.'.$k;
            }, $this->foreignKey);
        } else {
            return $this->child->getTable().'.'.$this->foreignKey;
        }
    }
435684
public function getColumnQuery() {
        // prepare column types
        $type_val = $this->getTypeVal();
        // build query
        $query = $this->db->quotekey($this->name).' '.$type_val.' '.
            $this->getNullable();
        // unify default for booleans
        if (preg_match('/bool/i', $type_val) && $this->default!==null)
            $this->default = (int) $this->default;
        // default value
        if ($this->default !== false) {
            $def_cmds = array(
                'sqlite2?|mysql|pgsql' => 'DEFAULT',
                'mssql|sybase|dblib|odbc|sqlsrv' => 'constraint DF_'.$this->table->name.'_'.$this->name.' DEFAULT',
                'ibm' => 'WITH DEFAULT',
            );
            $def_cmd = $this->findQuery($def_cmds).' '.$this->getDefault();
            $query .= ' '.$def_cmd;
        }
        if (!empty($this->after) && $this->table instanceof TableModifier) {
            // `after` feature only works for mysql
            if (preg_match('/mysql/', $this->db->driver())) {
                $after_cmd = 'AFTER '.$this->db->quotekey($this->after);
                $query .= ' '.$after_cmd;
            }
        }
        return $query;
    }
944325
public function getSQL()
    {
        if ($this->sql !== null && $this->state === self::STATE_CLEAN) {
            return $this->sql;
        }

        switch ($this->type) {
            case self::INSERT:
                $sql = $this->getSQLForInsert();
                break;
            case self::DELETE:
                $sql = $this->getSQLForDelete();
                break;

            case self::UPDATE:
                $sql = $this->getSQLForUpdate();
                break;

            case self::SELECT:
            default:
                $sql = $this->getSQLForSelect();
                break;
        }

        $this->state = self::STATE_CLEAN;
        $this->sql   = $sql;

        return $sql;
    }
238892
public function getInstance()
    {
        if (!$this->instance && $this->getType() && $this->getLocation()) {
            switch ($this->getType()) {
                case static::TYPE_SQLITE:
                    $instance = $this->createPDOSQLite(
                        $this->getLocation(),
                        $this->getErrorMode()
                    );
                    $this->setInstance($instance);
                    break;
                case static::TYPE_MYSQL:
                    if (!$this->getUsername() || !$this->getPassword() || !$this->getDatabase()) {
                        return null;
                    }
                    $instance = $this->createPDOMySQL(
                        $this->getLocation(),
                        $this->getDatabase(),
                        $this->getUsername(),
                        $this->getPassword(),
                        $this->getErrorMode(),
                        $this->getCharSet()
                    );
                    $this->setInstance($instance);
                    break;
                default:
                    throw new \Parable\ORM\Exception("Database type was invalid: {$this->getType()}");
            }
        }
        return $this->instance;
    }
221285
public function getValueType()
	{
		$xmlType =SchemaTypes::getInstance()->getTypeForDOMNode( $this->domNode );
		// $xmlType = $this->types->getType( $this->domNode->localName, $this->domNode->prefix );
		if ( $xmlType )
		{
			$type = Type::XmlTypeToPHPType( $xmlType );
			if ( $type ) return $type;
		}
		return Type::string;
	}
75886
public function getType()
    {
        $sql = $this->getSql();

        $type = strtok(strtolower(trim($sql)), ' ');
        $type = preg_replace ('/[^a-z]/i', '', $type);

        $allowedTypes = [
            self::QUERY_TYPE_SELECT,
            self::QUERY_TYPE_INSERT,
            self::QUERY_TYPE_UPDATE,
            self::QUERY_TYPE_DELETE,
            self::QUERY_TYPE_TRUNCATE,
        ];

        if (!in_array($type, $allowedTypes)) {
            throw new RuntimeException('Invalid query type');
        }

        return $type;
    }
465958
public function getResultingType() : \Dms\Core\Persistence\Db\Schema\Type\Type
    {
        $selectedExpressions = $this->select->getAliasColumnMap();
        /** @var Expr $selectExpression */
        $selectExpression    = reset($selectedExpressions);

        return $selectExpression->getResultingType();
    }
408857
public static function getSolrType() {
        $relationships = PlatformAppConfig::get('relationships');
        if (!isset($relationships['solr'])) {
            return FALSE;
        }
        list($solr_key, ) = explode(':', $relationships['solr']);
        $solr_config = self::get($solr_key);
        if (!isset($solr_config['type'])) {
            return FALSE;
        }
        return $solr_config['type'];
    }
483918
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;
	}
316728
public function getServerType()
	{
		if (empty($this->serverType))
		{
			$name = $this->getName();

			if (stristr($name, 'mysql') !== false)
			{
				$this->serverType = 'mysql';
			}
			elseif (stristr($name, 'postgre') !== false)
			{
				$this->serverType = 'postgresql';
			}
			elseif (stristr($name, 'pgsql') !== false)
			{
				$this->serverType = 'postgresql';
			}
			elseif (stristr($name, 'oracle') !== false)
			{
				$this->serverType = 'oracle';
			}
			elseif (stristr($name, 'sqlite') !== false)
			{
				$this->serverType = 'sqlite';
			}
			elseif (stristr($name, 'sqlsrv') !== false)
			{
				$this->serverType = 'mssql';
			}
			elseif (stristr($name, 'sqlazure') !== false)
			{
				$this->serverType = 'mssql';
			}
			elseif (stristr($name, 'mssql') !== false)
			{
				$this->serverType = 'mssql';
			}
			else
			{
				$this->serverType = $name;
			}
		}

		return $this->serverType;
	}
973225
public function getDatabaseType($default = 'MySQL')
    {
        $connection = $this->getDbalConnection();
        if (!$connection) {
            return $default;
        }

        $version = $this->getDatabaseVersion();
        if (preg_match('/mariadb/i', $version)) {
            return 'MariaDB';
        }

        return $default;
    }
141230
public function getBestType(): string
    {
        // Get the type from PhpStan database first, then from the php doc.
        if ($this->phpStanFunction !== null) {
            $phpStanParameter = $this->phpStanFunction->getParameter($this->getParameter());
            if ($phpStanParameter) {
                try {
                    return $phpStanParameter->getType();
                } catch (EmptyTypeException $e) {
                    // If the type is empty in PHPStan, let's fallback to documentation.
                    return $this->getType();
                }
            }
        }
        return $this->getType();
    }