INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Developer Question regarding MySQL Syntax?

Developer Question regarding MySQL Syntax?

(OP)
Most of the time developing with MySQL goes along just fine. Sometimes, however, the amount of data elements to be maintained can exceed hundreds for certain apps. With this amount of data debugging the SQL statements can become tedious due to the sheer number of elements, quoting, commas, etc. Of course the MySQL error messages simply state "Error in your syntax . . ."

So, I am wondering, is anyone aware of a SQL statement verifier that does a reasonable job of verifying? I've searched and tried a number but most of what I found simply repeated that simple message. Of course a good one should incorporate the database definition so that most likely eliminates "simple".

Therefore, any thoughts, suggestions, ideas, etc. which might reduce the amount of time one spends on these types of errors?

Thanks for reading and also for any suggestions.
ponder

RE: Developer Question regarding MySQL Syntax?

Hi,

I know how to spell "MySQL". So this comment will be generic at best.

I've had similar problems with SQL in other applications, and I've helped others debug theirs by odffering this advice. It takes time to organize and it seems to take up a lot of space. But it's great for identifying problems or modifying the query. I like the way it structures the code for ease of understanding.

So here's what I'd like you to do. Post one of your smaller queries. I'll put it through my process and post back an example of what I'd do.

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: Developer Question regarding MySQL Syntax?

Quote:

Therefore, any thoughts, suggestions, ideas, etc. which might reduce the amount of time one spends on these types of errors?

Send the query to some visual output so you can read it before sending it to the database server.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum

RE: Developer Question regarding MySQL Syntax?

Do you get more than just "Error in your syntax..."?

Normally, one gets "Error in your syntax near...[where the booboo is]"

And of course, a visual tool can be better than terminal/command.

https://dev.mysql.com/downloads/workbench/
http://www.heidisql.com/
https://github.com/webyog/sqlyog-community/wiki/Do...

Even viewing the query in a text editor that has syntax coloring can be helpful to find that missed punctuation.

https://www.geany.org/

RE: Developer Question regarding MySQL Syntax?

(OP)
Thank you for the advice and recommendations. I also use Geany for my main editor and it helps tremendously, especially pairing brackets, quotes, etc.
FWIW - my query string had over fifty elements and my error turned out to be a trailing comma just before the ) Values( clause. I plan to investigate the visual tools referenced so hopefully save some time in the future.
Thanks again...
smile

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close