Forums » General Discussion

Thread: Debugger not working (was: No char() type?)

This question is not answered. Helpful answers available: 2. Answered answers available: 1.


Permlink Replies: 4 - Pages: 1 - Last Post: Nov 2, 2011 11:42 AM by: McScreech
McScreech

Posts: 13
Registered: 9/30/11
Debugger not working (was: No char() type?)
Posted: Oct 6, 2011 12:57 PM
 
  Click to reply to this thread Reply

Can anyone explain why there seems to be no mechanism to accept char() data types of specified width but only varchar()? It does have both string and varstring.

A few examples:

1) In the editor the char term is highlighted as a function (as defined in Tools | Options | Editor | Highlighting Styles). Also, so are the terms INSERT and DEFAULT (perhaps others?) which I thought were reserved words and therefore should be the same as CREATE TABLE.

CREATE TABLE edges(
     childID CHAR(1) NOT NULL,
     parentID CHAR(1) NOT NULL,
     PRIMARY KEY (childID, parentID)
);

If I change char() to varchar() it changes to black-bold as defined in the styles.

2) When setting Debugger Start Parameters there is no char option in the type drop down list only varchar().

I'm about to experiment with this idea to see if stored procedures I am unable to step through in a debug trace will work with all instances of char() changed to varchar(). I may post a question related this after I dig deeper.

Thanx, McS



McScreech

Posts: 13
Registered: 9/30/11
Re: No char() type?
Posted: Oct 7, 2011 9:22 AM   in response to: McScreech
 
  Click to reply to this thread Reply

Windoze XP Pro SP3
MySQL 5.1.51-community
Toad for MySQL 6.0.1.1723
(code used at end of post)

OK, so when I attempt to debug my procedure I observe the following sequence:

1) set debugger start parameters:
select type = VarChar, enter value = A, check Collect debug trace

I notice that it changes all instances of char(1) in my procedure code with varchar(1) in the new editor window.

2) click run debugger, get error:
System.ArgumentOutOfRangeException
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
Stack Trace:
   at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
   at System.ThrowHelper.ThrowArgumentOutOfRangeException()
   at System.Collections.Generic.List`1.get_Item(Int32 index)
   at Quest.Toad.MySQL.Debugger.MySQLDebugProvider.GetAllWatchesImplementation(ContextType contextType, Int32 contextLevel)
   at Quest.Toad.Debugger.DebugProviderBase.GetAllWatches(ContextType contextType, Int32 contextLevel)
   at Quest.Toad.Debugger.Trace.DebugTrace.AddTraceLine(IDebugProvider provider, DebugExecutionArgs args)
   at Quest.Toad.Debugger.DebugClient.AddTrace(IDebugProvider provider, DebugExecutionArgs args)
   at Quest.Toad.Debugger.DebugClient.ExecutionFinished(IDebugProvider provider, DebugExecutionArgs args)
   at Quest.Toad.Debugger.DebugProviderBase.ExecutionFinished(Object sender, DebugExecutionArgs args)

3) halt debugger, get error:
System.ArgumentNullException
Value cannot be null.
Parameter name: key
Stack Trace:
   at System.Windows.Forms.Control.MarshaledInvoke(Control caller, Delegate method, Object[] args, Boolean synchronous)
   at System.Windows.Forms.Control.Invoke(Delegate method, Object[] args)
   at Quest.Toad.Util.Global.Invoke(Delegate handler, Object[] args)
   at Quest.Toad.Db.ToadDataAdapter.RaiseDone(Object sender, EventArgs args)
   at Quest.Toad.Db.ToadDataAdapter.InternalFillBackground()

4) does create a trace but, if I try to replay get error:
System.NullReferenceException
Object reference not set to an instance of an object.
Stack Trace:
   at Quest.Toad.Debugger.DebugMediator.FocusCodeLocation(CodeLocation location)
   at Quest.Toad.Debugger.DebugClient.ExecutionFinished(IDebugProvider provider, DebugExecutionArgs args)
   at Quest.Toad.Debugger.Trace.DebugTraceProvider.FinishedExecuting()

5) now debugger is hung, halt button does not stop it, shift+f11 does not stop it. I bring up View | Background Processes dialog (which does not show any running) and clicking on Stop all running processes button which does not stop it. I have to close the current editor tab to get a Halt Debug Session dialog that stops it.

Now, looking at my code below I am wondering if the change from char to varchar may create a conflict. I ask this because I have created and populated the tables earlier and only paste the procedure code into a fresh editor tab to debug.

My next attempt will be to change all instances of char to varchar in all required tables.

Many Thanx, McS
PS for anyone interested this is listing 1 and 2 from:
http://www.artfulsoftware.com/mysqlbook/sampler/mysqled1ch20.html

CREATE TABLE nodes(
    nodeID CHAR(1) PRIMARY KEY
);

CREATE TABLE edges(
    childID CHAR(1) NOT NULL,
    parentID CHAR(1) NOT NULL,
    PRIMARY KEY(childID,parentID)
);

INSERT INTO nodes VALUES('A'), ('B'), ('C'), ('D'), ('E'), ('F');
INSERT INTO edges VALUES ('A','C'), ('C','D'), ('C','F'), ('B','E');

DROP PROCEDURE IF EXISTS ListReached;
DELIMITER go

CREATE PROCEDURE ListReached( IN root CHAR(1) )
BEGIN
    DECLARE rows SMALLINT DEFAULT 0;

    DROP TABLE IF EXISTS reached;
    CREATE TABLE reached (
        nodeID CHAR(1) PRIMARY KEY
    ) ENGINE=HEAP;

    INSERT INTO reached VALUES (root );
    SET rows = ROW_COUNT();

    WHILE rows > 0 DO
        INSERT IGNORE INTO reached
            SELECT DISTINCT childID
            FROM edges AS e
            INNER JOIN reached AS p ON e.parentID = p.nodeID;
        SET rows = ROW_COUNT();

        INSERT IGNORE INTO reached
            SELECT DISTINCT parentID
            FROM edges AS e
            INNER JOIN reached AS p ON e.childID = p.nodeID;
        SET rows = rows + ROW_COUNT();
    END WHILE;

    SELECT * FROM reached;
    DROP TABLE reached;
END; go
DELIMITER ;




Mauritz

Posts: 314
Registered: 8/23/07
Re: No char() type?
Posted: Oct 7, 2011 9:55 AM   in response to: McScreech
 
  Click to reply to this thread Reply

You don't need to specify a parameter as CHAR while debugging. In this case there wont be any difference between the two.

That said the debugger should break like that. I will investigate the issue.



McScreech

Posts: 13
Registered: 9/30/11
Re: No char() type?
Posted: Oct 18, 2011 6:46 AM   in response to: Mauritz
 
  Click to reply to this thread Reply

Any suggestions yet? McS.



McScreech

Posts: 13
Registered: 9/30/11
Re: Debugger not working
Posted: Nov 2, 2011 11:40 AM   in response to: McScreech
 
  Click to reply to this thread Reply

I still cannot seem to debug any stored procedures, even those that do give acceptable results when executed without calling the debugger. Also, there appear to be several open questions regarding this issue.

Has anyone made progress with this?

Thanx, McS



Legend
Guru: 2001 + pts
Expert: 751 - 2000 pts
Enthusiast: 31 - 750 pts
Novice: 0 - 30 pts
Moderators
Helpful answer (5 pts)
Answered (10 pts)

Point your RSS reader here for a feed of the latest messages in all forums