CodeIgniter v4.5 API

ShowTableInfo extends BaseCommand
in package

Get table data if it exists in the database.

Tags
see
ShowTableInfoTest

Table of Contents

Properties

$arguments  : array<string, string>
$commands  : Commands
$description  : string
$group  : string
$logger  : LoggerInterface
$name  : string
$options  : array<string, string>
$usage  : string
$arguments  : array<string, string>
The Command's arguments
$commands  : Commands
Instance of Commands so commands can call other commands.
$description  : string
the Command's short description
$group  : string
The group the command is lumped under when listing commands.
$logger  : LoggerInterface
The Logger to use for a command
$name  : string
The Command's name
$options  : array<string, string>
The Command's options
$usage  : string
the Command's usage
$db  : BaseConnection|null
$DBPrefix  : string
$sortDesc  : bool
$tbody  : array<int, array<int, int|string>>

Methods

__construct()  : mixed
__get()  : array<string, string>|Commands|LoggerInterface|string|null
Makes it simple to access our protected properties.
__isset()  : bool
Makes it simple to check our protected properties.
getPad()  : int
Get pad for $key => $value array output
run()  : int|void
Actually execute a command.
setPad()  : string
Pads our string out so that all titles are the same length to nicely line up descriptions.
showHelp()  : void
Show Help includes (Usage, Arguments, Description, Options).
call()  : int|void
Can be used by a command to run other commands.
showError()  : void
A simple method to display an error with line/file, in child commands.
makeTableRows()  : array<int, array<int, int|string>>
Make table rows
makeTbodyForShowAllTables()  : array<int, array<int, int|string>>
Make body for table
removeDBPrefix()  : void
restoreDBPrefix()  : void
setYesOrNo()  : string
showAllTables()  : void
Show All Tables
showDataOfTable()  : void
Show Data of Table
showDBConfig()  : void
showFieldMetaData()  : void

Properties

$arguments

The Command's arguments

protected array<string, string> $arguments = ['table_name' => 'The table name to show info']

$commands

Instance of Commands so commands can call other commands.

protected Commands $commands

$description

the Command's short description

protected string $description = 'Retrieves information on the selected table.'

$group

The group the command is lumped under when listing commands.

protected string $group = 'Database'

$logger

The Logger to use for a command

protected LoggerInterface $logger

$name

The Command's name

protected string $name = 'db:table'

$options

The Command's options

protected array<string, string> $options = ['--show' => 'Lists the names of all database tables.', '--metadata' => 'Retrieves list containing field information.', '--desc' => 'Sorts the table rows in DESC order.', '--limit-rows' => 'Limits the number of rows. Default: 10.', '--limit-field-value' => 'Limits the length of field values. Default: 15.', '--dbgroup' => 'Database group to show.']

$usage

the Command's usage

protected string $usage = <<<'EOL' db:table [<table_name>] [options] Examples: db:table --show db:table --metadata db:table my_table --metadata db:table my_table db:table my_table --limit-rows 5 --limit-field-value 10 --desc EOL

$sortDesc

private bool $sortDesc = false

Sort the table rows in DESC order or not.

$tbody

private array<int, array<int, int|string>> $tbody

Table Data.

Methods

__construct()

public __construct(LoggerInterface $logger, Commands $commands) : mixed
Parameters
$logger : LoggerInterface
$commands : Commands

__get()

Makes it simple to access our protected properties.

public __get(string $key) : array<string, string>|Commands|LoggerInterface|string|null
Parameters
$key : string
Return values
array<string, string>|Commands|LoggerInterface|string|null

__isset()

Makes it simple to check our protected properties.

public __isset(string $key) : bool
Parameters
$key : string
Return values
bool

getPad()

Get pad for $key => $value array output

public getPad(array<string, string> $array, int $pad) : int

Use setPad() instead.

Parameters
$array : array<string, string>
$pad : int
Tags
codeCoverageIgnore
Return values
int

run()

Actually execute a command.

public run(array<string|int, mixed> $params) : int|void
Parameters
$params : array<string|int, mixed>
Return values
int|void

setPad()

Pads our string out so that all titles are the same length to nicely line up descriptions.

public setPad(string $item, int $max[, int $extra = 2 ][, int $indent = 0 ]) : string
Parameters
$item : string
$max : int
$extra : int = 2

How many extra spaces to add at the end

$indent : int = 0
Return values
string

showHelp()

Show Help includes (Usage, Arguments, Description, Options).

public showHelp() : void

call()

Can be used by a command to run other commands.

protected call(string $command[, array<int|string, string|null> $params = [] ]) : int|void
Parameters
$command : string
$params : array<int|string, string|null> = []
Tags
throws
ReflectionException
Return values
int|void

showError()

A simple method to display an error with line/file, in child commands.

protected showError(Throwable $e) : void
Parameters
$e : Throwable

makeTableRows()

Make table rows

private makeTableRows(string $tableName, int $limitRows, int $limitFieldValue[, string|null $sortField = null ]) : array<int, array<int, int|string>>
Parameters
$tableName : string
$limitRows : int
$limitFieldValue : int
$sortField : string|null = null
Return values
array<int, array<int, int|string>>

makeTbodyForShowAllTables()

Make body for table

private makeTbodyForShowAllTables(array<int, string> $tables) : array<int, array<int, int|string>>
Parameters
$tables : array<int, string>
Return values
array<int, array<int, int|string>>

setYesOrNo()

private setYesOrNo(bool|int|string|null $fieldValue) : string
Parameters
$fieldValue : bool|int|string|null
Return values
string

showAllTables()

Show All Tables

private showAllTables(array<int, string> $tables) : void
Parameters
$tables : array<int, string>

showDataOfTable()

Show Data of Table

private showDataOfTable(string $tableName, int $limitRows, int $limitFieldValue) : void
Parameters
$tableName : string
$limitRows : int
$limitFieldValue : int

showFieldMetaData()

private showFieldMetaData(string $tableName) : void
Parameters
$tableName : string

        
On this page

Search results