Example #1
0
        /// <summary>
        /// Checks if the length of the SQL statement would exceed the MySQL Server's MAX_ALLOWED_PACKET variable value.
        /// </summary>
        /// <param name="sqlStatement">The string representing the SQL statement to be sent to the MySQL server.</param>
        /// <param name="wbConnection">MySQL Workbench connection to a MySQL server instance selected by users.</param>
        /// <param name="safetyBytes">A safety value before reaching the MAX_ALLOWED_PACKET variable value.</param>
        /// <returns><c>true</c> if the length of the statement exceeds the vlaue of the server's MAX_ALLOWED_PACKET variable, <c>false</c> otherwise.</returns>
        public static bool ExceedsMySqlMaxAllowedPacketValue(this string sqlStatement, MySqlWorkbenchConnection wbConnection, int safetyBytes = 0)
        {
            var maxAllowedPacketValue = wbConnection.GetMySqlServerMaxAllowedPacket();

            return(ExceedsMySqlMaxAllowedPacketValue(sqlStatement, maxAllowedPacketValue, safetyBytes));
        }