@param Object $db_row
@param Pager  $pager
@param int    $navID

@return bool|string
17768
public function row(& $db_row, Pager & $pager = null, $navID = 0)
    {
        if (!empty($db_row->onetoone['_structure'])) {
            m()->cmsnav($db_row->onetoone['_structure']);
        }
        // Render field row
        return m()
            ->view('table/row/index')
            ->set($db_row, 'field')
            ->set($pager)
            ->navID($navID)
        ->output();
    }
307787
final public function queryPager(
        string $querySelect,
        string $queryCount = '',
        int $page = 1,
        int $recordsPerPage = 20
    ) {
        try {
            return $this->createPager($querySelect, $queryCount, $page, $recordsPerPage);
        } catch (\Throwable $exception) {
            $this->logger->error("DBAL::queryPager failure running $querySelect");
            return false;
        }
    }
225157
function _query($sql,$inputarr=false)
  {
  GLOBAL $php_errormsg;
    if (isset($php_errormsg)) $php_errormsg = '';
    $this->_error = '';

                if ($inputarr) {
      if (is_array($sql)) {
        $stmtid = $sql[1];
      } else {
        $stmtid = ads_prepare($this->_connectionID,$sql);

        if ($stmtid == false) {
          $this->_errorMsg = isset($php_errormsg) ? $php_errormsg : '';
          return false;
        }
      }

      if (! ads_execute($stmtid,$inputarr)) {
        //@ads_free_result($stmtid);
        if ($this->_haserrorfunctions) {
          $this->_errorMsg = ads_errormsg();
          $this->_errorCode = ads_error();
        }
        return false;
      }

    } else if (is_array($sql)) {
      $stmtid = $sql[1];
      if (!ads_execute($stmtid)) {
        //@ads_free_result($stmtid);
        if ($this->_haserrorfunctions) {
          $this->_errorMsg = ads_errormsg();
          $this->_errorCode = ads_error();
        }
        return false;
      }
    } else
                        {

      $stmtid = ads_exec($this->_connectionID,$sql);

                        }

                $this->_lastAffectedRows = 0;

    if ($stmtid)
                {

      if (@ads_num_fields($stmtid) == 0) {
        $this->_lastAffectedRows = ads_num_rows($stmtid);
        $stmtid = true;

      } else {

        $this->_lastAffectedRows = 0;
        ads_binmode($stmtid,$this->binmode);
        ads_longreadlen($stmtid,$this->maxblobsize);

      }

      if ($this->_haserrorfunctions)
                        {

        $this->_errorMsg = '';
        $this->_errorCode = 0;
      }
                        else
        $this->_errorMsg = isset($php_errormsg) ? $php_errormsg : '';
    }
                else
                {
      if ($this->_haserrorfunctions) {
        $this->_errorMsg = ads_errormsg();
        $this->_errorCode = ads_error();
      } else
        $this->_errorMsg = isset($php_errormsg) ? $php_errormsg : '';
    }

    return $stmtid;

  }
1222413
private function page_edit( $table_name, $row_id = null ){
		$page_edit = new endpoint_form_edit($this->exdb, $this, $table_name, $row_id);
		return $page_edit->execute();
	}
516954
public function getView(int $row, array $row_data, Linker $linker): string
    {
        $value = $this->getCellData($row_data);
        $cell_data = '<form action="'. $this->getParsedHref($row_data, $linker) .'" method="post"><input onclick="'. ($this->onclick ?: 'this.form.submit();') .'" type="radio"'. ($value ? ' checked="checked"' : '') .' name="input" class="noBorder" value="'. htmlspecialchars($value, ENT_QUOTES) .'"></form>';

        return $this->getCellView($cell_data, $row_data);
    }
52562
public function getView(int $row, array $row_data, Linker $linker): string
    {
        // Auto set _href for update links
        if (!$this->getHref()) {
            $tmp = $_GET;
            $tmp['do'] = str_replace('_default', '', $tmp['do']);
            $tmp['do'] = ($tmp['do'] ? '_' : '') . $tmp['do'] . '_delete';
            $tmp['id'] = '{%id%}';
            $this->setHref(urldecode('?' . http_build_query($tmp)));
        }

        $value = $this->getCellData($row_data);

        if (!$value) {
            $value = '<i class="fa fa-trash-o"></i>';
        }

        $cell_view = $this->getHrefView($value, $this->getParsedHref($row_data, $linker, ['do' => '_delete', 'id' => $row_data['id']]));

        return $this->getCellView($cell_view, $row_data);
    }
93766
public final function queryLine($sql, $_)
    {
        $params = func_get_args();
        if ($this->debug)
        {
            var_dump($params);
        }
        array_shift($params);
        $stm = $this->prepare($sql);
        if ($stm->execute($params))
        {
            $ret = $stm->fetch();
            $stm->closeCursor();
            return $ret;
        }
        else
        {
            \Swoole\Error::info("SQL Error", implode(", ", $this->errorInfo()) . "<hr />$sql");
            return false;
        }
    }
661407
public function getView(int $row, array $row_data, Linker $linker): string
    {
        $images = isset($this->images[$row_data['id']]) ? $this->images[$row_data['id']] : [];

        $value = $this->getCellData($row_data);

        $images_html = [];

        // Value is set?
        if (!$value) {
            // Draw images
            if ($images) {
                foreach ($images as $k => $image) {
                    if ($k < 3) {
                        // Draw miniature
                        $images_html[] = '<img src="' . $image . '&resizefit=30x30&key=' . Configuration::getInstance()->get('cms')['unique_key'] . '" style="display: inline-block; vertical-align: top; margin: 0 .25rem .25rem 0; border-radius: 3px;">';
                    } else {
                        // Draw last step
                        $images_html[] = '<div style="display: inline-block; vertical-align: top; text-align: center; height: 30px; min-width: 30px; padding: 0 .75rem; background: #EBEDF4; border-radius: 3px;"><span style="line-height: 30px; font-weight: 600">+' . (count($images) - $k) . '</span></div>';
                        break;
                    }
                }
            } else {
                $images_html[] = '<div style="display: inline-block; vertical-align: top; text-align: center; height: 30px; width: 30px; background: #EBEDF4; border-radius: 3px;"><span style="line-height: 30px;"><i class="fa fa-upload"></i></span></div>';
            }

            $value = implode('', $images_html);
        }

        $linker_array = ['do' => 'images', 'id' => $row_data['id']];
        $href = $this->getParsedHref($row_data, $linker, $linker_array);

        $cell_view = $this->getHrefView($value, $href);

        return $this->getCellView($cell_view, $row_data);
    }
326738
public static function view_database($databaseid) {

        $params = self::validate_parameters(self::view_database_parameters(), array('databaseid' => $databaseid));
        $warnings = array();

        list($database, $course, $cm, $context) = self::validate_database($params['databaseid']);

        // Call the data/lib API.
        data_view($database, $course, $cm, $context);

        $result = array();
        $result['status'] = true;
        $result['warnings'] = $warnings;
        return $result;
    }
1272066
public static function get_fields($databaseid) {
        global $PAGE;

        $params = array('databaseid' => $databaseid);
        $params = self::validate_parameters(self::get_fields_parameters(), $params);
        $fields = $warnings = array();

        list($database, $course, $cm, $context) = self::validate_database($params['databaseid']);

        // Check database is open in time.
        $canmanageentries = has_capability('mod/data:manageentries', $context);
        data_require_time_available($database, $canmanageentries);

        $fieldinstances = data_get_field_instances($database);

        foreach ($fieldinstances as $fieldinstance) {
            $record = $fieldinstance->field;
            // Now get the configs the user can see with his current permissions.
            $configs = $fieldinstance->get_config_for_external();
            foreach ($configs as $name => $value) {
                // Overwrite.
                $record->{$name} = $value;
            }

            $exporter = new field_exporter($record, array('context' => $context));
            $fields[] = $exporter->export($PAGE->get_renderer('core'));
        }

        $result = array(
            'fields' => $fields,
            'warnings' => $warnings
        );
        return $result;
    }
461312
public static function filterStripDbRowData(array $rowData, $dbTableAlias, $skipStrip = false)
    {
        $columnPrefix = $dbTableAlias . '_';

        $filteredAndStrippedRowData = [];
        foreach ($rowData as $key => $val) {
            if (strpos($key, $columnPrefix) === 0) {
                $strippedKey = $skipStrip ? $key : Str::stripLeft($key, $columnPrefix);
                $filteredAndStrippedRowData[$strippedKey] = $val;
            }
        }

        return $filteredAndStrippedRowData;
    }
603283
function _query($sql,$iarr=false)
	{

		if (!$this->autoCommit && $this->_transactionID) {
			$conn = $this->_transactionID;
			$docommit = false;
		} else {
			$conn = $this->_connectionID;
			$docommit = true;
		}
		if (is_array($sql)) {
			$fn = 'ibase_execute';
			$sql = $sql[1];
			if (is_array($iarr)) {
				if  (ADODB_PHPVER >= 0x4050) { // actually 4.0.4
					if ( !isset($iarr[0]) ) $iarr[0] = ''; // PHP5 compat hack
					$fnarr = array_merge( array($sql) , $iarr);
					$ret = call_user_func_array($fn,$fnarr);
				} else {
					switch(sizeof($iarr)) {
					case 1: $ret = $fn($sql,$iarr[0]); break;
					case 2: $ret = $fn($sql,$iarr[0],$iarr[1]); break;
					case 3: $ret = $fn($sql,$iarr[0],$iarr[1],$iarr[2]); break;
					case 4: $ret = $fn($sql,$iarr[0],$iarr[1],$iarr[2],$iarr[3]); break;
					case 5: $ret = $fn($sql,$iarr[0],$iarr[1],$iarr[2],$iarr[3],$iarr[4]); break;
					case 6: $ret = $fn($sql,$iarr[0],$iarr[1],$iarr[2],$iarr[3],$iarr[4],$iarr[5]); break;
					case 7: $ret = $fn($sql,$iarr[0],$iarr[1],$iarr[2],$iarr[3],$iarr[4],$iarr[5],$iarr[6]); break;
					default: ADOConnection::outp( "Too many parameters to ibase query $sql");
					case 8: $ret = $fn($sql,$iarr[0],$iarr[1],$iarr[2],$iarr[3],$iarr[4],$iarr[5],$iarr[6],$iarr[7]); break;
					}
				}
			} else $ret = $fn($sql);
		} else {
			$fn = 'ibase_query';

			if (is_array($iarr)) {
				if (ADODB_PHPVER >= 0x4050) { // actually 4.0.4
					if (sizeof($iarr) == 0) $iarr[0] = ''; // PHP5 compat hack
					$fnarr = array_merge( array($conn,$sql) , $iarr);
					$ret = call_user_func_array($fn,$fnarr);
				} else {
					switch(sizeof($iarr)) {
					case 1: $ret = $fn($conn,$sql,$iarr[0]); break;
					case 2: $ret = $fn($conn,$sql,$iarr[0],$iarr[1]); break;
					case 3: $ret = $fn($conn,$sql,$iarr[0],$iarr[1],$iarr[2]); break;
					case 4: $ret = $fn($conn,$sql,$iarr[0],$iarr[1],$iarr[2],$iarr[3]); break;
					case 5: $ret = $fn($conn,$sql,$iarr[0],$iarr[1],$iarr[2],$iarr[3],$iarr[4]); break;
					case 6: $ret = $fn($conn,$sql,$iarr[0],$iarr[1],$iarr[2],$iarr[3],$iarr[4],$iarr[5]); break;
					case 7: $ret = $fn($conn,$sql,$iarr[0],$iarr[1],$iarr[2],$iarr[3],$iarr[4],$iarr[5],$iarr[6]); break;
					default: ADOConnection::outp( "Too many parameters to ibase query $sql");
					case 8: $ret = $fn($conn,$sql,$iarr[0],$iarr[1],$iarr[2],$iarr[3],$iarr[4],$iarr[5],$iarr[6],$iarr[7]); break;
					}
				}
			} else $ret = $fn($conn,$sql);
		}
		if ($docommit && $ret === true) {
			ibase_commit($this->_connectionID);
		}

		$this->_handleerror();
		return $ret;
	}
1043580
public function query_db($pagesize, $useinitialsbar = true) {
        global $DB;

        list($countsql, $countparams) = $this->get_sql_and_params(true);
        list($sql, $params) = $this->get_sql_and_params();
        $total = $DB->count_records_sql($countsql, $countparams);
        $this->pagesize($pagesize, $total);
        $this->rawdata = $DB->get_records_sql($sql, $params, $this->get_page_start(), $this->get_page_size());

        // Set initial bars.
        if ($useinitialsbar) {
            $this->initialbars($total > $pagesize);
        }
    }
698843
function _query($sql,$inputarr=false)
	{
		$rez = sqlite_query($sql,$this->_connectionID);
		if (!$rez) {
			$this->_errorNo = sqlite_last_error($this->_connectionID);
		}
		// If no data was returned, we don't need to create a real recordset
		// Note: this code is untested, as I don't have a sqlite2 setup available
		elseif (sqlite_num_fields($rez) == 0) {
			$rez = true;
		}

		return $rez;
	}
233263
public function createPager($componentId = null, array $pager = [], $persistent = false)
    {
        return $this->pagerFactory->createPager(
            $this->displayCriteriaReader->readAttribute(
                DisplayCriteriaReader::PAGE,
                isset($pager[DisplayCriteriaReader::PAGE])
                    ? $pager[DisplayCriteriaReader::PAGE]
                    : null,
                $componentId,
                $persistent
            ),
            $this->displayCriteriaReader->readAttribute(
                DisplayCriteriaReader::LIMIT,
                isset($pager[DisplayCriteriaReader::LIMIT])
                    ? $pager[DisplayCriteriaReader::LIMIT]
                    : null,
                $componentId,
                $persistent
            )
        );
    }
49570
public function read($session_id)
	{
		// Get the database connection object and verify its connected.
		if (!$this->connection->connected())
		{
			return false;
		}

		try
		{
			// Get the session data from the database table.
			$query = $this->connection->getQuery()
				->select('data')
				->from('#__session')
				->whereEquals('session_id', $session_id);

			$this->connection->setQuery($query->toString());

			return (string) $this->connection->loadResult();
		}
		catch (Exception $e)
		{
			return false;
		}
	}
1260986
private function page_detail( $table_name, $row_id ){
		// var_dump($table_name);
		$list = $this->exdb->select($table_name, array($this->table_definition->key_column=>$row_id), $this->query_options);

		// var_dump($this->table_definition->system_columns);
		if( count($this->table_definition->system_columns->password) ){
			foreach( $list as $key=>$val ){
				foreach($this->table_definition->system_columns->password as $column_name){
					unset($list[$key][$column_name]);
				}
			}
		}
		$rtn = '';
		foreach( $this->table_definition->columns as $column_definition ){
			// var_dump($column_definition);
			$type_info = $this->exdb->form_elements()->get_type_info($column_definition->type);
			$form_elm = $this->render(
				$type_info['templates']['preview'],
				array(
					'value'=>@$list[0][$column_definition->name],
					'name'=>@$column_definition->name,
					'def'=>@$column_definition,
				)
			);
			$rtn .= $this->render(
				'form_elms_unit.html',
				array(
					'label'=>@$column_definition->label,
					'content'=>$form_elm,
					'error'=>null,
				)
			);
		}

		$rtn = $this->render(
			'form_detail.html',
			array(
				'href_edit'=>$this->generate_url($table_name, $row_id, 'edit'),
				'href_delete'=>$this->generate_url($table_name, $row_id, 'delete'),
				'href_list'=>$this->generate_url($table_name),
				'content'=>@$rtn,
			)
		);

		// $rtn = '<form>'.$rtn.'</form>';
		$rtn = $this->wrap_theme($rtn);
		return $rtn;
	}