MySQL 4.1.13 lint?

2005-10-13 Thread Hugh Sasse
I'm fairly new to MySQL and am getting an error messages like:

ERROR 1064 (42000) at line 5: 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 'id int(14) unsigned NOT NULL auto_increment,
forename varchar(40) NOT NU' at line 2
neelix hgs 18 % 

So it doesn't tell me exactly where, or what the nature of the
syntax error is (and it can't even tell me it is version 4.1.13
which I know already).  It has truncated the second line, so it's not
that the rest is missing.  My editor's syntax highlighter doesn't
show anything awful.  This is actually for lines 7 and 8 of the
input, the first 4 lines being comments, so the numbering in the
output is wrong.

Are there any tools (like lint for C) to be more verbose and helpful
about this?  

Thank you,
Hugh


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: MySQL 4.1.13 lint?

2005-10-13 Thread Alec . Cawley
Hugh Sasse [EMAIL PROTECTED] wrote on 13/10/2005 16:27:44:

 I'm fairly new to MySQL and am getting an error messages like:
 
 ERROR 1064 (42000) at line 5: 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 'id int(14) unsigned NOT NULL 
auto_increment,
 forename varchar(40) NOT NU' at line 2
 neelix hgs 18 % 
 
 So it doesn't tell me exactly where, or what the nature of the
 syntax error is (and it can't even tell me it is version 4.1.13
 which I know already).  It has truncated the second line, so it's not
 that the rest is missing.  My editor's syntax highlighter doesn't
 show anything awful.  This is actually for lines 7 and 8 of the
 input, the first 4 lines being comments, so the numbering in the
 output is wrong.
 
 Are there any tools (like lint for C) to be more verbose and helpful
 about this? 

No, I don;'t think there are any such tools.

When you get this sort of message, the error is nearly always *just 
before* the quoted bit. Which means that you have to get hold of the full 
command line that you sent and find out what immediately preceded the 
characters it has given as an error. 

Alec



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: MySQL 4.1.13 lint?

2005-10-13 Thread Hugh Sasse
On Thu, 13 Oct 2005, [EMAIL PROTECTED] wrote:

 Hugh Sasse [EMAIL PROTECTED] wrote on 13/10/2005 16:27:44:
 
  I'm fairly new to MySQL and am getting an error messages like:
  
  ERROR 1064 (42000) at line 5: 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 'id int(14) unsigned NOT NULL 
 auto_increment,
  forename varchar(40) NOT NU' at line 2
  neelix hgs 18 % 
  
[...]
  
  Are there any tools (like lint for C) to be more verbose and helpful
  about this? 
 
 No, I don;'t think there are any such tools.
 
 When you get this sort of message, the error is nearly always *just 
 before* the quoted bit. Which means that you have to get hold of the full 

That's the first line of a  create Table:

CREATE TABLE IF NOT EXISTS students(

id int(14) unsigned NOT NULL auto_increment,
forename varchar(40) NOT NULL default '',
surname varchar(40) NOT NULL default '',
[...]


 command line that you sent and find out what immediately preceded the 
 characters it has given as an error. 

It would be helpful if it could spit out expected %s, which would
give some more clues  I know that parsers are difficult to get
right, however
 
 Alec
 

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: MySQL 4.1.13 lint?

2005-10-13 Thread SGreen
Hugh Sasse [EMAIL PROTECTED] wrote on 10/13/2005 11:27:44 AM:

 I'm fairly new to MySQL and am getting an error messages like:
 
 ERROR 1064 (42000) at line 5: 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 'id int(14) unsigned NOT NULL 
auto_increment,
 forename varchar(40) NOT NU' at line 2
 neelix hgs 18 % 
 
 So it doesn't tell me exactly where, or what the nature of the
 syntax error is (and it can't even tell me it is version 4.1.13
 which I know already).  It has truncated the second line, so it's not
 that the rest is missing.  My editor's syntax highlighter doesn't
 show anything awful.  This is actually for lines 7 and 8 of the
 input, the first 4 lines being comments, so the numbering in the
 output is wrong.
 
 Are there any tools (like lint for C) to be more verbose and helpful
 about this? 
 
 Thank you,
 Hugh
 

MySQL does not normally use  (double quotes) as name identifiers, it 
uses ` `(backticks). Change all of your  to ` to make your syntax 
correct. That would mean that part of your original statement will look 
like

`id` int(14) unsigned NOT NULL auto_increment,
`forename` varchar(40) NOT NULL,

In this case line 2 did not refer to the position in the script but to 
the line within the statement. Your line 1 was something like

CREATE TABLE sometablename (

which made your first column definition (the id column) appear on line 2. 
Make better sense?

For more details on ` vs.   please read 
http://dev.mysql.com/doc/refman/4.1/en/legal-names.html

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine



Re: MySQL 4.1.13 lint?

2005-10-13 Thread Peter Brawley

Hugh,

Agreed that the MySQL error reporter is primitive, and that 'lint for 
MySQL' would be a smash hit, but if you look up error 1064 you'll find 
it is a naming error, two of which are visible in your error 
report--column names enclosed in double quotes.


PB
http://www.artfulsoftware.com

-

Hugh Sasse wrote:


I'm fairly new to MySQL and am getting an error messages like:

ERROR 1064 (42000) at line 5: 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 'id int(14) unsigned NOT NULL auto_increment,
   forename varchar(40) NOT NU' at line 2
neelix hgs 18 % 


So it doesn't tell me exactly where, or what the nature of the
syntax error is (and it can't even tell me it is version 4.1.13
which I know already).  It has truncated the second line, so it's not
that the rest is missing.  My editor's syntax highlighter doesn't
show anything awful.  This is actually for lines 7 and 8 of the
input, the first 4 lines being comments, so the numbering in the
output is wrong.

Are there any tools (like lint for C) to be more verbose and helpful
about this?  


   Thank you,
   Hugh


 




--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.11.14/131 - Release Date: 10/12/2005


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: MySQL 4.1.13 lint?

2005-10-13 Thread Hugh Sasse
On Thu, 13 Oct 2005, [EMAIL PROTECTED] wrote:

 
 MySQL does not normally use  (double quotes) as name identifiers, it 
 uses ` `(backticks). Change all of your  to ` to make your syntax 
 correct. That would mean that part of your original statement will look 
 like

Thank you.
 
 In this case line 2 did not refer to the position in the script but to 

but line 5 was at least line 7 in the script, and at most line 4 in
the statement.
 the line within the statement. Your line 1 was something like
 
 CREATE TABLE sometablename (
 
 which made your first column definition (the id column) appear on line 2. 
 Make better sense?

Yes. Thank you.
 
 For more details on ` vs.   please read 
 http://dev.mysql.com/doc/refman/4.1/en/legal-names.html
 
Thank you, I'm off there now.
Hugh

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: MySQL 4.1.13 lint?

2005-10-13 Thread Hugh Sasse
On Thu, 13 Oct 2005, Peter Brawley wrote:

 Hugh,
 
 Agreed that the MySQL error reporter is primitive, and that 'lint for MySQL'

If I were familiar with the code base I'd happy send patches, but I
was hoping improve diagnostics  might get nudged up somebody's
list by raising it.

 would be a smash hit, but if you look up error 1064 you'll find it is a naming

The first several results returned by google are no help.

 error, two of which are visible in your error report--column names enclosed in
 double quotes.

I'll probably need to talk to the maintainers of the vim syntax file
then, as well, because though that's a MySQL 3 syntax file I expect
it was still wrong.  Imho it should show white on red as a result,
not red on black (string).
 
 PB
 http://www.artfulsoftware.com

Thank you,
Hugh

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]