GithubHelp home page GithubHelp logo

ocelot-inc / ocelotgui Goto Github PK

View Code? Open in Web Editor NEW
61.0 61.0 15.0 13.62 MB

GUI client for MySQL or MariaDB, including debugger

License: GNU General Public License v2.0

HTML 0.03% C++ 45.82% QMake 0.13% C 52.85% CMake 0.69% Shell 0.46% Roff 0.02%

ocelotgui's People

Contributors

akopytov avatar kurairaito avatar pgulutzan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

ocelotgui's Issues

Error message

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:

  • Ocelotgui version: 1.0.0-1_i386 (deb package)
  • Operating system: GNU/Linux (Linux Mint 17.3)
  • Ocelotgui command line: ocelotgui --host=<my internal IP for the server> --user=&lh;my mysql user>

(I am then clicking on File->Connect and providing the password)

Database server info:

  • ODBS: MySQL 5.5.33
  • Operating system: FreeBSD9.0 (amd64)

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

Last affectation (right before the END) can't be visualized in debugger

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)

DEBUG: Error 1064

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

debug stored procedure fail if enum in parameter

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

Segmentation Fault Core Dump Manjaro Linux

Hello,
Thank you for ocelotgui.
I attach the details and the core dump cd.txt below.
Regards

cd.txt

$ ./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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.