ocelot-inc / ocelotgui Goto Github PK
View Code? Open in Web Editor NEWGUI client for MySQL or MariaDB, including debugger
License: GNU General Public License v2.0
GUI client for MySQL or MariaDB, including debugger
License: GNU General Public License v2.0
Hello @pgulutzan ,
I'm trying (first time user! :) ) to debug a stored procedure, but I'm getting the following error:
mysql>$setup fix_username_duplicates;
Error 1064 (42000) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '% PROCEDURE `test_th_roberto3`.`xxxmdbug002Pfix_username_duplicates`() NOT DETER' at line 1
Desktop info:
(I am then clicking on File->Connect and providing the password)
Database server info:
The stored procedure is as follows:
DELIMITER //
CREATE PROCEDURE
`fix_username_duplicates`()
BEGIN
DECLARE p_bDoChanges BOOLEAN DEFAULT FALSE;
DECLARE bDone BOOLEAN DEFAULT FALSE;
DECLARE strUsername VARCHAR(50);
DECLARE iCount INT;
DECLARE cCursor CURSOR FOR
SELECT
count(temp_users.uUsername) as iCount,
temp_users.uUsername
FROM
users AS temp_users
WHERE
temp_users.uUsername != ""
GROUP BY
temp_users.uUserName
HAVING
iCount > 1
;
DECLARE CONTINUE HANDLER FOR NOT FOUND
SET bDone = TRUE;
CREATE TEMPORARY TABLE
`temp_result_set`
(
`result_line` VARCHAR(250) NOT NULL DEFAULT ''
);
OPEN cCursor;
rReadLoop: LOOP
FETCH cCursor INTO iCount, strUsername;
IF bDone THEN
LEAVE rReadLoop;
END IF;
BEGIN
DECLARE bDone2 BOOLEAN DEFAULT FALSE;
DECLARE iUserID INT;
DECLARE bInactive BOOLEAN;
DECLARE strLastSeenDate DATETIME;
DECLARE cCursor2 CURSOR FOR
SELECT
users.uId AS iUserID,
users.uis_deleted AS bInactive,
users.uLastSeen AS strLastSeenDate
FROM
users
WHERE
users.uUsername = strUsername
;
OPEN cCursor2;
rReadLoop2: LOOP
FETCH cCursor2 INTO iUserID, bInactive, strLastSeenDate;
IF bDone2 THEN
LEAVE rReadLoop;
END IF;
IF bInactive THEN
IF p_bDoChanges THEN
UPDATE
users
SET
users.uUsername = ""
WHERE
users.uId = iUserID;
ELSE
SELECT CONCAT("User #",iUserID,", username ", strUsername, ": inactive");
INSERT INTO
`temp_result_set`
SET
result_line = CONCAT("User #",iUserID,", username ", strUsername, ": inactive");
END IF;
LEAVE rReadLoop;
END IF;
IF strLastSeenDate = "0000-00-00 00:00:00" THEN
IF p_bDoChanges THEN
UPDATE
users
SET
users.uUsername = ""
WHERE
users.uId = iUserID;
ELSE
SELECT CONCAT("User #",iUserID,", username ", strUsername, ": never logged in");
INSERT INTO
`temp_result_set`
SET
result_line = CONCAT("User #",iUserID,", username ", strUsername, ": never logged in");
END IF;
LEAVE rReadLoop;
END IF;
IF strLastSeenDate < NOW() - INTERVAL 6 MONTH THEN
IF p_bDoChanges THEN
UPDATE
users
SET
users.uUsername = ""
WHERE
users.uId = iUserID;
ELSE
SELECT CONCAT("User #",iUserID,", username ", strUsername, ": no activities for the last 6 months");
INSERT INTO
`temp_result_set`
SET
result_line = CONCAT("User #",iUserID,", username ", strUsername, ": no activities for the last 6 months");
END IF;
LEAVE rReadLoop;
END IF;
END LOOP rReadLoop2;
CLOSE cCursor2;
END;
END LOOP rReadLoop;
CLOSE cCursor;
SELECT
*
FROM
`temp_result_set`;
DROP TEMPORARY TABLE `temp_result_set`;
END//
DELIMITER ;
(p_bDoChanges was originally a parameter, but I couldn't figure out on your examples how to feed it ocelotgui, so I just converted it to a normal variable)
The $install; command runs fine (I can see the xxxmdbug database was created).
I am attaching the users table (used by the procedure).
Thanks for your help!
users.sql.zip
With the folowing procedure :
DELIMITER //
CREATE PROCEDURE `test_procedure2`() NOT DETERMINISTIC NO SQL SQL SECURITY DEFINER BEGIN
DECLARE test_TINYINT TINYINT;
SET test_TINYINT = 1;
SET test_TINYINT = 2;
SET test_TINYINT = 3;
END//
DELIMITER ;
when executing :
DELIMITER //
$install
$setup test_procedure2
$debug test_procedure2();
$NEXT
$refresh variables
SELECT * FROM xxxmdbug.variables;
$NEXT
$refresh variables
SELECT * FROM xxxmdbug.variables;
$NEXT
$refresh variables
SELECT * FROM xxxmdbug.variables;
$NEXT
$refresh variables
SELECT * FROM xxxmdbug.variables;
you will have the folowing output value :
test_TINYINT = null
test_TINYINT = 1
test_TINYINT = 2 (old_value =1)
test_TINYINT = 2 (old_value =1)
instead of
test_TINYINT = null
test_TINYINT = 1
test_TINYINT = 2 (old_value =1)
test_TINYINT = 3 (old_value =2)
Edited to replace boolean by tinyint as value 2 and 3 could be confusing for a boolean value.... (even if boolean doesn't exist in SQL)
Hello, and thanks for ocelotgui.
Trying debug for the first time, after connecting, I obtain:
mariadb>$INSTALL
Error 1064 (42000) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'offset INT, line_number INT, valu...' at line 1
$ mysqld -V
mysqld Ver 10.7.3-MariaDB for Linux on x86_64 (Arch Linux)
$ uname -a
Linux tower 5.10.109-1-MANJARO #1 SMP PREEMPT Mon Mar 28 09:16:20 UTC 2022 x86_64 GNU/Linux
I like this tools and hope it will increase new features
Here is an example of stored procedure that fail:
You can execute this code in phpmyadmin
DELIMITER //
CREATE PROCEDURE `test_procedure`(OUT `o_result` ENUM('ok','ko')) NOT DETERMINISTIC NO SQL SQL SECURITY DEFINER BEGIN
SET o_result = "ok";
END//
DELIMITER ;
in ocelot gui :
DELIMITER //
$install
$setup test_procedure
Error 1064 (42000) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ko'`*);');
IF xxxmdbug.is_debuggee_and_is_attached()=1 THEN CALL xxxmdbug.xxxmdb' at line 7
if you execute the same procedure from phpMyAdmin, you will have the o_result value set to 'ok'
Other stored procedure that do not use ENUM type in parameter seems to work fine (tested only with BIGINT and BOOLEAN).
ocelot version : latest release (1.0.4) x64
mariaDB version : 10.1.22
host : Ubuntu 17.04 x64
Hello,
Thank you for ocelotgui.
I attach the details and the core dump cd.txt below.
Regards
$ ./ocelotgui-qt5
Segmentation fault (core dumped)
$ uname -a
Linux tower 5.10.109-1-MANJARO #1 SMP PREEMPT Mon Mar 28 09:16:20 UTC 2022 x86_64 GNU/Linux
$ find /usr/ -name "libQtGui.so" 2>/dev/null
/usr/lib/libQt5Gui.so.5.15.3
/usr/lib/libQt6Gui.so
/usr/lib/libQt6Gui.so.6.2.4
/usr/lib/libQt5Gui.so.5
/usr/lib/libQt5Gui.so
/usr/lib/libQt5Gui.so.5.15
/usr/lib/libQt6Gui.so.6
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.