Get the hour from a datetime
@param $field A datetime expression
@param $which_connection see method close()
@return The SQL expression
489237
public function hour($field,$which_connection='')
    {
        if ($which_connection == '') {
            $which_connection = $this->default_db;
        }
        $conn = $this->connections[$which_connection];

        return $conn->SQLDate("H",$field);
    }
1139401
public function relativeDateFilter($field, $fromUnit = self::RELATIVE_DATE_FILTER_UNIT_MINUTES, $fromInterval, $toUnit = self::RELATIVE_DATE_FILTER_UNIT_MINUTES, $toInterval = 0, $dateFormat = self::RELATIVE_DATE_FILTER_DATEFORMAT, $isNegative = false) {
		$parameters = array(
	        'fromUnit' => $fromUnit,
	        'fromInterval' => $fromInterval,
	        'toUnit' => $toUnit,
		    'toInterval' => $toInterval,
		    'dateFormat' => $dateFormat,
		    'field' => $field
	    );
	    $this->addFilter(null, self::RELATIVE_DATE_FILTER, $isNegative, $parameters);
		return $this;
	}
34325
public function getTables($which_connection='')
    {
        if ($which_connection == '') {
            $which_connection=$this->default_db;
        }
        $conn = $this->connections[$which_connection];

        return $conn->MetaTables();
    }
882241
public function whereMonth($field, $date, $format = null)
    {
        if ($format === null) {
            if ($this->_model) {
                $format = $this->_model->getDateFormat($field);
            } else {
                $format = is_int($date) ? 'U' : 'Y-m-d H:i:s';
            }
        }

        if (is_string($date)) {
            $date = str_replace('/', '-', $date);
        }
        $ts = is_int($date) ? $date : strtotime($date);

        if ($format === 'U') {
            $min = date('Y-m-01 00:00:00', $ts);
            $max = date('Y-m-t 23:59:59', $ts);
            return $this->whereBetween($field, strtotime($min), strtotime($max));
        } else {
            $min = date(strtr($format, ['H:i:s' => '00:00:00', 'd' => '01']), $ts);
            $max = date(strtr($format, ['H:i:s' => '23:59:59', 'd' => date('t', $ts)]), $ts);
            return $this->whereBetween($field, $min, $max);
        }
    }
502029
public function toMySQLDate($withTime = true)
    {
        if ($this->isHollow()) {
            return $withTime ? '0000-00-00 00:00:00' : '0000-00-00';
        }

        $format = $withTime ? 'Y-m-d H:i:s' : 'Y-m-d';

        return $this->format($format);
    }
684982
public function getField(string $field)
    {
        if (isset($this->_record[$field]))
            return $this->_record[$field];
        return null;
    }
188848
public function week($field,$which_connection='')
    {
        if ($which_connection == '') {
            $which_connection = $this->default_db;
        }
        $conn = $this->connections[$which_connection];

        return $conn->SQLDate("W",$field);
    }
148532
public function currency($which_connection='')
    {
        $which_connection = $which_connection === '' ? $this->default_db : $which_connection;
        $adapter = $this->getAdapter($this->connectionType($which_connection));
        return $adapter->currency();
    }
173761
public function curtime($which_connection='')
    {
        $which_connection = $which_connection === '' ? $this->default_db : $which_connection;
        $adapter = $this->getAdapter($this->connectionType($which_connection));
        return $adapter->curtime();
    }
722463
public function fieldName($result_object,$index,$which_connection='')
    {
        $field = $this->fetchField($result_object, $index, $which_connection);

        if (is_object($field) && property_exists($field, 'name')) {
            return $field->name;
        } else {
            return '';
        }
    }
1218375
public function get($what='') {
		$what = 'get'.ucfirst($what);
		$rs = $this->adapter->$what($this->sql,$this->params);
		$this->clear();
		return $rs;
	}
815774
public function whereBetweenTime($field, $startTime, $endTime = null)
    {
        if (is_null($endTime)) {
            $time    = is_string($startTime) ? strtotime($startTime) : $startTime;
            $endTime = strtotime('+1 day', $time);
        }

        $this->where($field, 'between time', [$startTime, $endTime]);

        return $this;
    }
661162
protected function whereDate(Builder $query, $where)
    {
        $value = $this->parameter($where['value']);

        return 'cast('.$this->wrap($where['column']).' as date) '.$where['operator'].' '.$value;
    }
380933
public function connectionType($which_connection='')
    {
        if ($which_connection == '') {
            $which_connection=$this->default_db;
        }
        if ($this->isConnected($which_connection)) {
            $reflect = new \ReflectionClass($this->connections[$which_connection]);
            if (substr($reflect->name, 0, 6) == 'ADODB_') {
                return substr($reflect->name, 6);
            }
        }

        return 'unknown';
    }
157656
def _utc(dt, source, field_name):
    
    if dt is None:
        raise dbt.exceptions.raise_database_error(
            "Expected a non-null value when querying field '{}' of table "
            " {} but received value 'null' instead".format(
                field_name,
                source))

    elif not hasattr(dt, 'tzinfo'):
        raise dbt.exceptions.raise_database_error(
            "Expected a timestamp value when querying field '{}' of table "
            "{} but received value of type '{}' instead".format(
                field_name,
                source,
                type(dt).__name__))

    elif dt.tzinfo:
        return dt.astimezone(pytz.UTC)
    else:
        return dt.replace(tzinfo=pytz.UTC)
696982
public function get($index = 0, $field = null) {
        if ($this->performed) {
            if (is_numeric($index)) {
                $index = intval($index);
            } else if (is_string($index)) {
                $field = $index;
                $index = 0;
            } else {
                return null;
            }
        } else {
            if (is_array($index)) {
                return $this->where($index);
            }

            if (is_numeric($index)) {
                $index = intval($index);
            } else if (is_string($index)) {
                $field = $index;
                $this->field($field);
                $index = 0;
                $this->limit(0, 1);
            } else {
                $index = 0;
            }
            $this->select();
        }
        if (isset ($this->resultSets [ $index ])) {
            $row = $this->resultSets [ $index ];
            if ($field != null && isset ($row [ $field ])) {
                return $row [ $field ];
            }
            if ($field == null) {
                return $row;
            }
        }

        return null;
    }
639522
public function get_or($fields)
    {
        $args = array();
        $fieldsValue = $fields;
        $fields = $this->getFields();
        $sql = '';
        foreach ($fields as $field) {
            if (isset($fieldsValue[$field])) {
                $value = $fieldsValue[$field];
                if (is_array($value)) {
                    foreach ($value as $subvalue) {
                        $sql .= '`' . $field . '` = ? OR ';
                        $args[] = $subvalue;
                    }
                } else {
                    $sql .= '`' . $field . '` = ? OR ';
                    $args[] = $value;
                }
            }
        }
        if (!empty($sql)) {
            $sql = substr($sql, 0, -4);
            return $this->build($this->db->select('SELECT * FROM `' . $this->table_name . '` WHERE ' . $sql, $args));
        }
        return $this->build(array());
    }