2024.8.23
Loading...
Searching...
No Matches
ActionDebugMysql Class Reference

Public Member Functions

 __construct ($args)
 

Detailed Description

Class ActionDebugMysql

This class handles the debugging actions for MySQL within the Bearsampp application. It executes specific MySQL commands and displays the output in a message box or editor.

Definition at line 16 of file class.action.debugMysql.php.

Constructor & Destructor Documentation

◆ __construct()

ActionDebugMysql::__construct ( $args)

Constructor for ActionDebugMysql.

Parameters
array$argsAn array of arguments specifying the MySQL command to execute.

This constructor initializes the debugging process for MySQL based on the provided arguments. It supports commands for retrieving the MySQL version, variables, and performing a syntax check. The output is displayed in a message box or editor based on the command.

Definition at line 27 of file class.action.debugMysql.php.

28 {
29 global $bearsamppLang, $bearsamppBins, $bearsamppTools, $bearsamppWinbinder;
30
31 if (isset($args[0]) && !empty($args[0])) {
32 $editor = false;
33 $msgBoxError = false;
34 $caption = $bearsamppLang->getValue(Lang::DEBUG) . ' ' . $bearsamppLang->getValue(Lang::MYSQL) . ' - ';
35
36 // Determine the command and set the caption accordingly
37 if ($args[0] == BinMysql::CMD_VERSION) {
38 $caption .= $bearsamppLang->getValue(Lang::DEBUG_MYSQL_VERSION);
39 } elseif ($args[0] == BinMysql::CMD_VARIABLES) {
40 $editor = true;
41 $caption .= $bearsamppLang->getValue(Lang::DEBUG_MYSQL_VARIABLES);
42 } elseif ($args[0] == BinMysql::CMD_SYNTAX_CHECK) {
44 }
45 $caption .= ' (' . $args[0] . ')';
46
47 // Execute the MySQL command and get the output
48 $debugOutput = $bearsamppBins->getMysql()->getCmdLineOutput($args[0]);
49
50 // Handle syntax check results
51 if ($args[0] == BinMysql::CMD_SYNTAX_CHECK) {
52 $msgBoxError = !$debugOutput['syntaxOk'];
53 $debugOutput['content'] = $debugOutput['syntaxOk'] ? 'Syntax OK !' : $debugOutput['content'];
54 }
55
56 // Display the output in an editor or message box
57 if ($editor) {
58 Util::openFileContent($caption, $debugOutput['content']);
59 } else {
60 if ($msgBoxError) {
61 $bearsamppWinbinder->messageBoxError(
62 $debugOutput['content'],
63 $caption
64 );
65 } else {
66 $bearsamppWinbinder->messageBoxInfo(
67 $debugOutput['content'],
68 $caption
69 );
70 }
71 }
72 }
73 }
global $bearsamppBins
global $bearsamppLang
const CMD_VARIABLES
const CMD_VERSION
const CMD_SYNTAX_CHECK
const DEBUG_MYSQL_VERSION
const MYSQL
const DEBUG_MYSQL_VARIABLES
const DEBUG_MYSQL_SYNTAX_CHECK
const DEBUG
static openFileContent($caption, $content)

References $bearsamppBins, $bearsamppLang, BinMysql\CMD_SYNTAX_CHECK, BinMysql\CMD_VARIABLES, BinMysql\CMD_VERSION, Lang\DEBUG, Lang\DEBUG_MYSQL_SYNTAX_CHECK, Lang\DEBUG_MYSQL_VARIABLES, Lang\DEBUG_MYSQL_VERSION, Lang\MYSQL, and Util\openFileContent().


The documentation for this class was generated from the following file: