Describe a table and return SQL query result array

db:describe_table(STRING $table) : ARRAY

db:describe_table('users')
#=> [
#=>     "row_count" => 3,
#=>     "column_count" => 6,
#=>     "columns" => [
#=>         "Field",
#=>         "Type",
#=>         "Null",
#=>         "Key",
#=>         "Default",
#=>         "Extra"
#=>     ],
#=>     "rows" => [
#=>         [
#=>             "Field" => "id",
#=>             "Type" => "int(11)",
#=>             "Null" => "YES",
#=>             "Key" => "",
#=>             "Default" => NULL,
#=>             "Extra" => ""
#=>         ],
#=>         [
#=>             "Field" => "name",
#=>             "Type" => "varchar(255)",
#=>             "Null" => "YES",
#=>             "Key" => "",
#=>             "Default" => NULL,
#=>             "Extra" => ""
#=>         ],
#=>         [
#=>             "Field" => "account_type",
#=>             "Type" => "tinyint(1)",
#=>             "Null" => "YES",
#=>             "Key" => "",
#=>             "Default" => NULL,
#=>             "Extra" => ""
#=>         ]
#=>     ],
#=>     "sql_state" => "00000",
#=>     "sql_query" => "describe `users`",
#=>     "ok?" => TRUE,
#=>     "execution_time" => 0.000934,
#=>     "last_insert_id" => "0"
#=> ]

Copyright ©2013-2022 SunSed®. All rights reserved.