Unsupported Screen Size: The viewport size is too small for the theme to render properly.

comments break sql in 3.5/3.51

forums forums SQLyog SQLyog: Bugs / Feature Requests comments break sql in 3.5/3.51

  • This topic is empty.
Viewing 4 reply threads
  • Author
    Posts
    • #8075
      number_one
      Participant

      Commenting certain lines out now breaks the sql statements that are sent to the server in SQLyog 3.5/3.51. For example, in 3.11 the following statement would work fine:

      Code:
      select * from people where
      loc=59 AND
      #lname='LONG' AND
      fname='CHARLES'
      limit 10;

      The result SHOULD be that it runs the query without the line “lname='LONG'”; instead, it returns

      Quote:
      Error Code : 1064

      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 '' at line 1

      Also, the following use of comments will break queries in 3.5/3.51:

      A comment on a line just previous to the start of a query will break that query. For example the following statements will produce this error:

      Code:
      #test
      select * from people limit 10;

      The result should obviously be that the query under the comment runs as normal, but it will always return 0 rows. If we add an uncommented semicolon on a separate line before the query but after the comment, the query will run as normal. This one is not as big of a deal as the first issue, but it probably is caused by the same bug. The first issue is a BIG deal, as it means you cannot comment out portions in the middle of a query.

      What appears to be happening is that the parser which determines what is a comment uses the line formatting in the sql editor to determine what is after a pound sign, and it is supposed to stop commenting after the newline, but it seems to be wrapping all of the lines from any given statement to be all on one line before making its determination as to what to comment out.

      In other words:

      Code:
      #test query
      select * from people limit 10;

      becomes

      Code:
      #test query select * from people limit 10;

      before being sent to the server. Likewise,

      Code:
      select * from people where
      loc=59 AND
      #lname='LONG' AND
      fname='CHARLES'
      limit 10;

      becomes

      Code:
      select * from people where loc=59 AND #lname='LONG' AND fname='CHARLES' limit 10;

      before being sent to the server. I tested these directly by entering it all on the same line in the SQL editor and the same errors occur.

      Now this could just be a fluke on my computer, but I have tried uninstalling and reinstalling both 3.5 and 3.51 and it continues to have the problem. I have reinstalled 3.11 and it behaves normally.

    • #14614
      mhsa
      Member

      I noticed the same thing. I think SQLyog strips off the carriage returns, thus MySQL thinks that the statement is all one big long line (instead of the several lines you typed in). Looking at the history pane gives you some idea… When you use an inline comment, MySQL ignores everything after it until the carriage return.

      You can only use the C-style comments, /* … */. These will work for in-line comments, and allow you comment out sections in the middle of your statements.

      HTH!

    • #14615
      Headache
      Member

      I have just started working with SQLyog and after one hour of trying to make new databases and tables I suddenly encounter an annoying problem.

      I seem to get an error message (No 1064) every time I click the “Insert/Update data” button.

      I have deleted the last database and restarted SQLyog! But nothing seems to help.

      Can somebody please give me a hint?

    • #14616
      Shadow
      Member

      Error 1064 corresponds to syntax error meaning you have a flaw in the most recently executed SQL statement. In this case SQLyog may have generated a “bad” INSER/UPDATE command for some of your tables. What version of SQLyog and MySql do you use? What was the table type?

    • #14617
      Ritesh
      Member

      SQLyog logs every command in the History window.

      It will be very helpful if you can paste the SQL statement out here.

Viewing 4 reply threads
  • You must be logged in to reply to this topic.