MySQL & mSQL by Randy Jay Yarger, George Reese, and Tim King Unconfirmed error reports are from readers. They have not yet been approved or disproved by the author or editor and represent solely the opinion of the reader. This page was updated April 9, 2002 Here's a key to the markup: [page-number]: serious technical mistake {page-number}: minor technical mistake : important language/formatting problem (page-number): language change or minor formatting problem ?page-number?: reader question or request for clarification UNCONFIRMED errors and comments from readers: (xi) Preface, "Purpose" Change: "...Open Source software even through their licenses..." to: "...Open Source software even though their licenses..." (xiii) The book reads: "MySQL comes first only because we arbitrarily decided to make the most popular of the two appear first." The book should read: "MySQL comes first only because we arbitrarily decided to make the more popular of the two appear first." {4} second sentence on bottom paragraph: "The file system file is the electronic..." shouldn't this be "The flat system file is the electronic..." or "The flat file system is the electronic..."? (5) Table 1-2: Kurt Rambis is no longer coaching the Lakers. (9) paragraph before "The History of MySQL", last sentence: remove the second "to". (9) last word of footnote: "memeory" is misspelled. (10) "The History of MySQL" Change: "...Win32, and OS/2. TCX estimates that..." to: "...Win32, and OS/2. TcX estimates that..." (10) 6th complete paragraph, last word should be "servers", not "severs". (16) Figure 2-2: the order of attributes is different from Table 2-1. (16) Figure 2-2: "Record Name" should be "Record Label". (17) Figure 2-3: for the CD entity, the attributes are ordered differently than in fig. 2-2 and table 2-1. (20) Figure 2-6: CD entity is missing "Band Name" and Song entity should have a "Song ID" and "Song Name" instead of a "Song Name ID". (22) 1st sentence: "If one of the sides as a degree..." should be "If one of the sides has a degree..." (22) 2nd paragraph, 1st sentence: "The final kind of relationships..." should be "The final kind of relationship..." (22) 2nd paragraph, 2nd sentence: singular rather than plural form should be used. (25) Figure 2-12: The State entity should have "State ID" rather than "State Code"; it also needs the attribute "State Abbreviation". (25) Figure 2-12: The Record Label entity should not have "State Name" and "State Abbreviation" attributes. {26} In paragraph 2 you mention that: "We covered an approach to creating such a model which is in-line with the type and complexity of databases you are likely to encounter in developing MySQL or mSQL databases." I assumed "good" databases used foreign keys. Also on page 26 item 4 under paragraph 4: 4. Relationships are modeled as foreign keys. We will cover this later. I never saw anything on foreign keys until Chapter 15 where it states: page 234 paragraph 1: "The FOREIGN KEY operation is currently not implemented in MySQL. While the syntax is there, attempting and action on a FOREIGN KEY will do nothing." The Question is, how should a proper MySQL database be designed if the FOREIGN KEY feature does not work. Or if it does and I have missed that part in the book where can I find it? (27) Table 2-2: SongLength is missing from the Song table. (27) Table 2-2: RecordLabelName and RecordLabelId cannot both be primary keys. {27} Table 2-2: In the "Notes" column for the last row, the phrase "primary key" should be deleted from the table. (28) Table 2-3: SongLength is missing from the Song table. (29) Example 2-1, 2nd line: should have "RECORD_LABEL_ID" instead of "RECORD_LABEL_I". Also, the Song table is missing "SONG_LENGTH", the Song table needs a foreign key for Artist, and the table "RecorLabel" should be "RecordLabel". (29) Example 2-1: The spacing should be adjusted so all tables read as clearly as the Song table. {29} Example 2-1: There are various indentation, spelling, and logical errors too numerous to identify here. The example should be replaced with the following: Example 2-1. An Example Script for Creating the CD Database in MySQL CREATE TABLE CD (CD_ID INT NOT NULL, RECORD_LABEL_ID INT, CD_TITLE TEXT, PRIMARY KEY (CD_ID)) CREATE TABLE Artist (ARTIST_ID INT NOT NULL, ARTIST_NAME TEXT, PRIMARY KEY (ARTIST_ID)) CREATE TABLE Song (SONG_ID INT NOT NULL, CD_ID INT, ARTIST_ID INT, SONG_NAME TEXT, PRIMARY KEY (SONG_ID)) CREATE TABLE RecordLabel (RECORD_LABEL_ID INT NOT NULL, RECORD_LABEL_NAME TEXT, PRIMARY KEY (RECORD_LABEL_ID)) (29) Example 2-2: In the Artist table, the ARTIST_ID should be "INT NOT NULL" rather than "INT NO NULL". SONG_LENGTH and a foreign key for Artist are both missing from the Song table. {29} Example 2-2: There are various indentation, spelling, and logical errors too numerous to identify here. The example should be replaced with the following: Example 2-2. An Example Script for Creating the CD Database in mSQL CREATE TABLE CD (CD_ID INT NOT NULL, RECORD_LABEL_ID INT, CD_TITLE TEXT(50)) CREATE UNIQUE INDEX CD_IDX ON CD (CD_ID) CREATE TABLE Artist (ARTIST_ID INT NOT NULL, ARTIST_NAME TEXT(50)) CREATE UNIQUE INDEX Artist_IDX ON Artist (ARTIST_ID) CREATE TABLE Song (SONG_ID INT NOT NULL, CD_ID INT, ARTIST_ID INT, SONG_NAME TEXT(50)) CREATE UNIQUE INDEX Song_IDX ON Song (SONG_ID) CREATE TABLE RecordLabel (RECORD_LABEL_ID INT NOT NULL, RECORD_LABEL_NAME TEXT(50)) CREATE UNIQUE INDEX RecordLabel_IDX ON RecordLabel (RECORD_LABEL_ID) [30] Last sentence; Sentence suggests installing from source, which conflicts with p41, Installing MySQL, 2nd para, penultimate sentence, which advises all but a few to install from binary. (33) Table 3-1: The two primary sites for MySQL would be more prominent and obvious if they were in boldface. (34) 2nd full paragraph after file list, 4th sentence: "This is a case for the last..." should be "This is the case for the last..." {34} The first step to 'Installing from Source' is to gunzip -c mysql-x.xx.xx.tar.gz | tar xvf - The first step is to gzip. (35) 1st paragraph, last sentence: "Running with the--help..." should have a space between "the" and "--help". (35) The "with-low-memory" option should have two dashes before it, rather than an em dash. (35) under the "localstatedir" option: "/usr/local/var" should probably have a trailing slash. {35} (penultimate paragraph) - "installing MySQL from source" says that the mysql_install_db script " ..will also start the server daemon" I've installed mysql Ver 9.38 Distrib 3.22.32, for pc-solaris2.7 (i386) from source and the install db script doesn't start the daemon you need to run safe_mysqld & to do that. this might be worth checking to save grief for others. ALSO - though I can't see it really having any place in the text, users installing it on Solaris need to use gtar (GNU tar) rather than the Solaris tar when unpacking mySQL - don't know why but its on the mysql web page. Solaris tar reports checksum errors unpacking the source and binary distributions. (36) in the list of installation steps: the first step should be "gunzip..." rather than "gzip..." (36) just a note about binary distributions: there are also rpm and deb distributions available. {36} 'To summarize, a sequence of installaion steps look like this:' The first step is to gzip !!! (37) 1st paragraph of mSQL section, 2nd sentence: the URL should end with "au" rather than "avl". (38) in the sequence of installation steps, the first step should be "gunzip..." (40) Figure 4-1: The caption should have "server" rather than "sever". (41) 2nd paragraph after "Running MySQL", 2nd sentence: is the path correct or does it need a "mysql" in the middle? If not, then the path on page 42 is wrong. {49} a.) Change "-# LOG" to "-# debug" ... ? b.) Some relevant information about the MySQL version I'm using: C:\mysql\bin>mysqladmin version mysqladmin Ver 6.8 Distrib 3.21.29a-gamma, for Win95 on i586 TCX Datakonsult AB, by Monty Server version 3.21.29a-gamma-debug (50) 2nd paragraph after "Backups", last sentence: "...next most important form up backup...", the "up" should be "of". (50) 3rd paragraph after "Backups", 3rd sentence: "...or some similar data." should be "...or some similar schedule." (50) second paragraph.... "In this section, we will focus on the next most important form up backup:....." I think that this is supposed to be "...the next most important form OF backup." (50) Backups, 3rd para, 3rd sentence; Statement 'back up all data once a week or some similar data' should read 'back up all data once a week or some similar interval' (51) 1st paragraph after "Security", 3rd sentence: perhaps "mysql" (the database) could be in constant width font? Also, the period should be outside of the quotes. (51) underneath "The user table", the last sentence is redundant and would be better as "The user table has the structure shown in Table 4-1:" (51) Chapter 4, "Backups" Change: "...do it often and that your periodically check your..." to: "...do it often and that you periodically check your..." (51) Table 4-1: "Insert_riv" should be "Insert_priv". (53) the list of SQL INSERT statements would be easier to read if the "VALUES" lines were indented about 7 characters. (54) Table 4-2: "Insert_riv" should be "Insert_priv". (55) Table 4-3: "Insert_riv" should be "Insert_priv". (56) Penultimate sentence; The word 'user' should be in constant width as it is a keyword specific to MySQL in that context. {57} This problem lies in the last sentence before demonstration of the mysqlaccess utility. The text currently reads: For example, using the command mysqlaccess nobody isp.com mydata might report the following output: It should read: For example, using the command mysqlaccess isp.com nobody mydata might report the following output: This is backed by the following information: Upon issuing the mysqlaccess command with no syntax: raptor /home/baphomet# mysqlaccess --help mysqlaccess Version 2.04-alpha2, 09 Feb 2000 By RUG-AIV, by Yves Carlier (Yves.Carlier@rug.ac.be) Changes by Steve Harvey (sgh@vex.net) This software comes with ABSOLUTELY NO WARRANTY. You have to supply a userid. You have to supply the name of a database. Usage: mysqlaccess [host [user [db]]] OPTIONS Version number of MySQL Daemon for further clarrification: raptor /home/baphomet# mysql -V mysql Ver 9.38 Distrib 3.22.32, for pc-linux-gnu (i686) (58) paragraph after "MySQL Utilities", last sentence: the reference to "Chapter 18, PHP and Lite Reference" should refer to "Chapter 17, MySQL and mSQL Programs and Utilities". (59) paragraph after "Third Party Tools", 2nd sentence: should refer to "Inprise's Delphi" rather than "Inrpise's Delphi". (61) 1st sentence after "Sqlscreens": the first "databases" should be singular. (63) very top sentence: "...just how MySQL works under the covers..." is a morally questionable statement! :) A more common expression is "...just how MySQL works under the hood..." (63) table_cache 'mysqld' option: The book reads: "If you gave" It should read "If you have" (65) 2nd sentence next to the turkey: there should be a space between "isamchk" and "-r". (70) Figure 5-1: 5 clients each with an arrow is shown pointing to 4 queries. What does this mean? (70) 1st complete paragraph, last sentence: "...enables any C program to connect to a mSQL server...", the "a" should be "an". (73) is the unix command for starting the daemon "9781565924345d2 &" or "msql2d &"? (74) 1st complete paragraph, 1st sentence: "While the Win32 does not yet..." should be "While the Win32 version does not yet..." (75) 2nd paragraph, 3rd sentence: "...they are followed by the character when using..." Followed by what character? (75) second text paragraph contains: followed by the character when should read: followed by the = character when (77) under "Unix_Port" option, 2nd sentence: "%I%" does not need the second "%". (83) in the format shown for the 9781565924345.acl file, the 2nd stanza: "wriite" should be "write". (84) last sentence on page: "...and a -f options enables you..." the "options" should be singular. (85) under "9781565924345export", 2nd sentence: the word "database" should be plural, or more properly "database management systems". (88) under "mSQL-JDBC", last sentence: there should be a comma after "discusses". (90) after "SQL Basics", 3rd sentence: refers to "...a SQL grammar..." but the rest of the book refers to SQL as "an SQL". (92) near bottom of page, sentence before 2nd CREATE TABLE example: "The CREATE example above could just as well appeared:", the last word should be "appear". (93) after example table, 2nd sentence: "A field's datatype specified..." should be "A field's datatype specifies..." (93) Chapter 6, "The Design of SQL" Change: "This first element of an SQL query..." to: "The first element of an SQL query..." Note: In this book, there are some passages (as above) that read "an SQL" and there are other passages that read "a SQL" (p.90 -- "...Doug Brown implements a SQL grammar..."). Which is it? Or is it moot as the footnote (p.90) claims: "Prounounced either "sequel" or "ess-que-ell." (93) Chapter 6, "Creating and Dropping Tables" Change: "A field's datatype specified what kind of data the field can hold." to: "A field's datatype specifies what kind of data the field can hold." {93} 1st paragraph; Should the text: "... CREATE TABLE people (CHAR(10)) ..." be instead: "... CREATE TABLE people (name CHAR(10)) ..." as it refers to the example on the previous page? (94) after "SQL Datatypes", 2nd sentence: to be consistent, the reference to "...a SQL datatype..." should be "...an SQL datatype..." {94} DROP TABLE table_name IF EXISTS should be: DROP TABLE IF EXISTS table_name (96) paragraph after "Character Types", 5th sentence: "The important fact to note here is that indexing one character..." the "one" should be "on". (98) Last word; 'That is a 41% savings!' should read 'That is a 41% saving!' (98) last paragraph, 3rd sentence: 576 bytes is 144x4 not 144x3. (98) Chapter 6, "Variable-length character fields in mSQL" Change: "If you multiple that times thousands..." to: "If you multiply that times thousands..." (99) Chapter 6, "Enumerations and Sets" Change: "The ENUM type allows you specify at table creation..." to: "The ENUM type allows you to specify at table creation..." (99) paragraph after "Binary Datatypes", last sentence: shouldn't binary data be sorted in case-sensitive, not insensitive order? (99) Binary Datatypes, second sentence; Should be a comma between CHAR and BINARY. (99) 1st paragraph after "Enumerations and Sets", 2nd sentence: "The ENUM type allows you specify..." there should be a "to" between "you" and "specify". (99) "Enumerations and Sets," 1st paragraph; In the following passage: "CREATE TABLE meal(meal_id INT NOT NULL PRIMARY KEY, fruit ENUM(`apple', `orange', `kiwi', `banana'))" It appears as though the quotation marks used to delineate the enumerated values are back-ticks and apastrophes. Perhaps "curly-quotes" were just left on accidentally, but it makes it look like one must format these quotes accordingly. If back-ticks and apastrophes are not the correct quotation marks, and a pair of single quotes should in fact be used, they should appear like the single quotes do on p.92 and other places. (This error occurs many more places throughout the book) [100] There are two problems in the first full paragraph: 1) It refers you to Chapter 17 for the data type descriptions, that should be Chapter 15. 2) This paragraph indicates that MySQL & mSQL both support the MONEY datatype. The only mention of the MONEY datatype in Chapter 15 is for mSQL. (100) last sentence before "Indices" section: the reference should be to "Chapter 15, SQL Reference" instead of "Chapter 17, MySQL..." (100) before "Indices" section: I have not noticed any support for the MONEY type in MySQL. (102) 3rd paragraph after "mSQL sequences", 1st sentence: "...and will increase by 5 each time some accesses the sequence." The "some" should be "someone". [102] In the 9781565924345 sequence, you have: CREATE SEQUENCE ON table_name [VALUE start STEP incr] mSQL is quite terse w/ the order of words in its SQL. it requires STEP before VALUE CREATE SEQUENCE ON table_name [STEP incr VALUE start] (102) The first paragraph readsL "The AUTO_INCREMENT row must be indexed." It should read: "The AUTO_INCREMENT column must be indexed." {102} The first example reads: "CREATE TABLE cities (id INT NOT NULL PRIMARY KEY AUTO_INCREMENT," This causes a syntax error on version 3.21. It should read: "CREATE TABLE cities (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY," (106) 1st paragraph after "Joins", 2nd sentence: "...enable you to match a row from one table up with a row..." would read more clearly without "up". (109) 1st paragraph after "Extended Functionality", 1st sentence: "...in the other database engine." the "engine" should be plural. (109) paragraph after "MySQL Features", 4th sentence: "For example, the function SQRT(16) returns 4." The "4" should be in constant width font. {110} Last example before pahagraph at bottom of page; The salt is two random characters stored at the beginning of the encrypted password string, and has no correlation to the beginning of the actual string being encrypted, so the query provided would only return a result on the off chance that the salt is the first two characters of the name. The correct query should be: SELECT name FROM people WHERE password = ENCRYPT( name, LEFT(password, 2)) (111) at the top of the page: the SELECT example should include the book table in the FROM clause. (111) I think natural outer join is a bit under-explained. Sample initial tables and returned rows would be usefull (113) 3rd paragraph, last sentence: "import" should be "important". (114) 3rd paragraph: "Open Source" is not and has never been a trademark. (117) 2nd paragraph after "Objects", 1st sentence: "System" should be added after "Management". Also, "...simply a list of records..." should be "...simply lists of records..." (118) 4th complete paragraph, 5th sentence: "...increase for demand..." should be "...increased demand..." (118) 1st paragraph under "GNU SQL", last sentence: "...one glaring omissions..." the "omissions" should be singular. (118) In the fourth paragraph: "ranks up their in popularity with" should be: "ranks up there in popularity with" [122] I am not sure it but is in chapter 10 on the web....; Error: DBD/DBI stands for DataBase Dependent/DataBase Independent perl application -> DBI -> DBD->Informix DBD->Oracle DBD->mySQL Correct: DBD/DBI stands for DataBase Driver/DataBase Interface ?124? Figure 8-1: How does this figure explain the client/server architecture? Does the one-way arrow mean that the client sends something to the server, but not vice-versa? Is the server a can? ?125? 1st paragraph, last sentence: "...a badly written system..." perhaps the "system" should be "application" or "client"? ?126? the "Rules of Thumb" box and the note next to the turkey icon both interrupt the flow of reading. Perhaps they could be placed at the end of the "Object/Relational Modeling" section? (126) 1st paragraph, 2nd sentence: "each row from the database..." the "each" should be capitalized. ?127? Figure 8-3: The "Address" object is missing a field for "state". Also, what does the "1" indicate at the end of the arrow? (127) paragraph before "The Three-tier Architecture": this paragraph twice refers to a "Company" class. This should be "Address" instead. (128) paragraph next to the owl icon, 2nd sentence: the period should be removed from "ultra-thin client.". (128) paragraph next to the owl icon, last sentence: "...the most client processing..." the "most" should probably be "majority of" or something similar. {132} Describes earlier habit of capitalizing starting HTML tags and lowercasing ending tags as a convention. I've worked and conversed with hundreds of HTML authors, HTML editor programmers, HTML validator programmers, IETF representatives, read many HTML authoring books and web pages, and never seen this before. Obviously, it isn't incorrect, but you might want to do something more conventional. The next HTML spec will require lowercase starting and closing tags (higher density of lc letters compresses better than using uc) so perhaps standardizing to all lc in the next printing might be a good idea... and passing the idea onto editors of other books might help as well. {134} example 9-1: the closing "" is missing. {135} first paragraph after "Example 9-1"; The author mentions the IMAGE style as usually being incompatible with "hearing- impaired accessible browsers"... I have friends in both the hearing-impaired and visually impaired communities, and am fairly sure the author meant "visually-impaired accessible browsers" [136] Bullet points; 'Standard output' is described below bullets as being a method of passing information from server to CGI program. Standard output is actually used to send data from CGI program to server. (137) 1st paragraph after "Environment Variables", 2nd sentence: "...unofficial ones that are used..." the "that" should be removed. (137) 1st paragraph after "Environment Variables", last sentence should be "Table 9-1 lists the CGI..." (137) Table 9-1 lists 15 variables, but the paragraph before said there are 17 standard variables. (137) Sentence before Figure 9-1; The form data given appears to be from a non-existant example. Maybe it should be prefixed 'e.g.' ? (139) 1st para, last sentence; 'finger root' is a UNIX/Linux command and thus should be in a different font or quoted. (139) Chapter 9, "Standard Input" Change: "...can be found on Yahoo at..." to: "...can be found on Yahoo! at..." with 'Yahoo!' in italics. (140) in Example 9-2, the comment for the line "@fields..." should read "This retrieves the names of all of..." (140) in Example 9-2, the 4th line from the bottom of the page should have a "#" in front of it. (140) second footnote... "mit" should be italicized like rest of URL (141) in Example 9-2, the 2nd comment line after "foreach..." could use a closing parenthesis ")". [141] Example 9-3; If the given source code is pure C, both 'llist' and 'node' should be prefixed with 'struct' where they are used. (144) 1st complete paragraph, the 3rd sentence seems to be talking about laundry. Perhaps it should read: "Needless to say, this hampers productivity." (144) Figure 9-2, the 2nd invocation of the CGI program should be labeled with "invoke" rather than "involve". {147} in Example 9-4, the 2nd line on the page should close the HTML with "". (147) 3rd paragraph, 4th sentence: "...the direction in wish you want..." the "wish" should be "which". {148} Chapter 9, Example 9-5 Change: "} elsif ( not $output->param('start') ) {" to: "} elseif ( not $output->param('start') ) {" (150) Chapter 9, "Security" Change: "$|++; # Disable the buffering in the child as way." to: "$|++; # Disable the buffering in the child as well." (150) the example CGI program could use better formatting of the comments. {150} perl code, line starting with "$pid"... wraps leaving part of a comment ("opens a") on the subsequent line, uncommented. (152) the paragraph next to the owl icon, 2nd sentence, parenthetical comment: "...as opposed to nonweb connected databases..." should be "...as opposed to non web-connected databases..." (155) Sentence before Perl code; '...you must use DBI to get access:' - use is a Perl keyword in this context and so should be constant width. [157] The bottom of the code reads: print < HTML exit(0) It should read: print < END_OF_HTML exit(0); [158] The fifth line in the code sample reads: # Use the Msql.pm module it should read: # Use the DBI module {159} Example 10-3, there are a couple points that seem would fail under use strict: neither $table or $server are declared with 'my' anywhere. [159-161] The code provided does not compile, and also is missing some critical variable definitions. I modified the code that will compile and execute correctly. Revised Code: #!/usr/bin/perl -w use strict; use CGI qw(:standard); use CGI::Carp; use DBI; CGI::use_named_parameters(1); my($server,$db,$table, $host); my $output = new CGI; $server = param('server') or $server = ''; $db = param('db') or die("Database not supplied!"); $table = param('table') or die("Table not supplied!"); my $dbh = DBI->connect("DBI:mysql:$db:$server", "bmasters", "master1"); my $table_data = $dbh->prepare("select * from $table"); $table_data->execute; if (not $table_data) { print header, start_html('title'=> "Information on $host => $db => $table", 'BGCOLOR' => 'white'); print <$host

$db

The table '$table' does not exist in $db on $host. END_OF_HTML exit(0); } print header, start_html('title' =>"Imformation on $host => $db => $table", 'BGCOLOR' => 'white'); print <$host

$db

$table

END_OF_HTML my @fields = @{$table_data->{NAME}}; my @types = @{$table_data->{TYPE}}; my @not_null = @{$table_data->{is_not_null}}; my @length = @{$table_data->{length}}; my ($field); foreach $field (0..$#fields) { print "\n"; print "\n"; } print <

Data

    END_OF_HTML while (my(@data)=$table_data->fetchrow_array) { print "
  1. \n
      "; for(0..$#data) { print "
    • $fields[$_] => $data[$_]
    • \n"; } print "
  2. "; } print < END_OF_HTML exit(0); (Chapter 10) I'm in the process of reading MySQL and mSQL... I've just started into chapter ten and felt that I head to write in about a particularaly nasty error. DBI is repeatedly refered to as standing for DataBase Independant and DBD is repeatedly refered to as standing for DataBase Dependant. This is an error. While DBI is database independant and DBD modules are database dependant, they initials actually stand for DataBase Interface and DataBase Driver. Consult the documentation for DBI, or with Tim Bunce. {160} The listing for Example 10-3 appears to be incorrect. The lines: my @fields = @{$table_data->NAME}; and my @types = @{$table_data->TYPE}; should be my @fields = @{$table_data->{NAME}}; and my @types = @{$table_data->{TYPE}}; since NAME and TYPE are properties of the statement handle object. Without the {}, the compiler looks for NAME and TYPE methods, generating a compiler error when they are not found. Splendid book! [174] The last paragraph in the July 1999 printing reads: we recently converted an entire site from mSQL o MySQL by running "perl -e 's/^Msql/MySQL/" *.cgi" in every directory containing a CGI. The problem is that not only are there unbalanced single (and double) quotes as printed, even with proper quotes (single or double), it doesn't work. Don't you need to write to a temporary file and then copy back to the original *.cgi (using the "foreach" function)? Was it perl 4 you were using (I'm using 5.005_03)? (181) 1st paragraph, 3rd sentence: "...an excellent introduction into Python..." the "into" should be "to". (181) 1st paragraph, 3rd sentence: the 2nd author's last name is "Ascher" with a "c". (182) 1st complete paragraph, 2nd sentence beginning "You should not use the from..." is very confusing. (182) First paragraph after 9781565924345 code block; Note that this was found in the first printing (July 1999), but it has not been mentioned in the online errata. The line: "You should not use the from mSQL import * syntax" ^^^^^^^^ only has the underlined portion tagged as code. It should read: "You should not use the from mSQL import * syntax" ^^^^^^^^^^^^^^^^^^ (184) paragraph after "Updates", last sentence: "...the AUTO_INCREMENT value of the table..." the "of" should be "if". {194} $query = "select * from sharks where "; But it should have been: $query = "select * from sharks"; Because in the latter part a check is performed and the where part is added! (194) Chapter 12, "PHP" Change: "...the HTML example shown earlier which retrieve information from a shark database..." to: "...the HTML example shown earlier which retrieves information from a shark database..." [194] Line 15; Through my tests "+=" only works with numbers in PHP. To make it work with a text string I had to do the following: $query = "SELECT * from sharks"; $query = "$query where SPECIES = 'Isurus Paucus'"; (194) Chapter 12, "PHP" Change all occurences of '' should be modified to be: '?>' (in both cases). I believe the ' I don't know other Linux distribution. But In RedHat based linux distribution, I think is more exact than . So...I think the next version of the book should discuss the difference of distribution. {200} command line for compilation: (one third up from bottom of page) gcc -L/usr/local/mysql/lib -I/usr/local/mysql/include -o select select.c\-lmysql -lnsl -lsocket should read: gcc -L/usr/local/mysql/lib -I/usr/local/mysql/include -o select select.c\-lmysqlclient -lnsl -lsocket ^^^^^^^^^^^^^ The "-lsocket" command line switch isn't required under Linux (in fact, it will cause an error if present) Another one of those trial and error things. Great book, despite the annoying typos. I've yet to come across a bad O'Reilly book, come to think of it. {201} Example 13-2: the comment in the 17th line, "/* the return balue..." should be "/* the return value..." (202) 3rd paragraph, 2nd-to-last sentence: "...issue of great importance in more..." there should be an "a" before "more". (203) footnote: "...documenting the object-oriented..." the "the" should probably be removed. (204) Figure 13-1: the objects shown here differ in small details from the objects as defined in the headers. Each object has a Close() method (with a capitalized "C") in the headers. Connection also has an IsConnected() method. Result does not have an "affected_rows" private variable, but it does have a "row_count" variable. Finally, Row has an IsClosed() method but not a Closed() method. (206) 1st paragraph, 3rd sentence: "...using a mSQL calls the..." the "a" should be removed. {206} The call to mysql_real_connect contains too few arguments. {206} 14 lines up from the bottom of Example 13-4: mysql_real_connect needs 8 parameters and not 7 so it should look like: connection = mysql_real_connect (&mysql, host, uid, pw, db, 0, "", 0); or some how else ... (211) 1st paragraph under "Result Sets", 1st sentence: "...an abstraction on the..." should be "...an abstraction of the..." (211) 1st paragraph under "Result Sets", 2nd sentence: "Specifically, should..." should be "Specifically, it should..." ?211-212? The class definition for result.h (p 211) lists the prototypes for the Result::Result constructor and the Result::~Result destructor but I don't see the function definitions for them anywhere. (212) 1st paragraph, 3rd sentence: "simple" should be "simply". ?215? It is stated that "an example application using these C++ classes is packaged with the examples from this book". I cannot find these examples. Are they in the book or available on the web (or some other medium)? Thank you for looking into these items. With these exceptions, this is a FANTASTIC book that I have put to great use in the last 3 weeks. Cudos! [227] The 1st paragraph after the heading 'A Guest Book Servlet' mentions that "we have packaged with the examples in this book an example that contains a [...] servlet." However, no such code was included in the paragraph, or in any examples section. [227] The book I just purchased is missing part of page 227 (after the second paragraph) and pages 228, 229, and 230. (231) 2nd-to-last ALTER example: "table" and "create_clause" should be italicized like the rest of them. (234) 2nd paragraph under "CREATE", 2nd sentence: "In older versions of SQL..." should be "In older versions of MySQL..." (237) There is a syntax mistake on page 237 in the comment column for ENUM. The line reads: ENUM("apples,""oranges,""bananas") It should read: EMUM"("apples","oranges","bananas")" [243] In the last line of the DESCRIBE / DESC, The book shows: DESC big my\_% as an example for getting information about a table or column. It should say: DESC big "my\_%" or: DESC big 'my\_%' (245) for the list of privileges to GRANT, the first one is misspelled and should be "ALL PRIVILEGES/ALL". {247} The code lines: INSERT INTO old_data ( id, date, field ) SELECT ( id, date, field) FROM data WHERE date < 87459300; should read: INSERT INTO old_data ( id, date, field ) SELECT id, date, field FROM data WHERE date < 87459300; <249> Your description of LOCK TABLES on page 249 states that if a thread creates a READ lock then the controlling thread can write to the table. The MySQL documentation on page 197 states "If a thread obtains a READ lock on a table, that thread (and all other threads) can only read from the table." [249] I have found what I believe to be a serious error in the description of the LOCK query for MySQL. Under the heading LOCK, the second sentence reads: "If a thread creates a READ lock all other threads may read from the table but only the controlling thread can write to the table." This is not actually the case - as I have recently discovered with using MySQL myself, and I found in the MySQL documentation at: http://www.mysql.com/documentation/mysql/commented/manual.php?section=LOCK_T ABLES "If a thread obtains a READ lock on a table, that thread (and all other threads) can only read from the table." The description of the READ lock in the book is quite false in this case - because in the case of a read lock no thread may write to the table at all - including the controlling thread. This is perhaps due to a change in the software since the book was written? I hope you find this useful. Overall I have very much appreciated this book & I greatly enjoy the entire oreilly series - they've become quite the icon of geek/computer culture - and deserve it very much. It's so refreshing to find a series of books that is willing to explain things from the ground up - not assuming you know everything already - and yet does not treat you like an idiot at the same time. Keep up the good work =) (251) The penultimate paragraph currently reads: "[about OPTIONALLY] This will cause MySQL to thread enclosed data as strings and non-enclosed data as numeric." To correct typo: replace "thread" with "treat". {252} The third join example, under Table LEFT [OUTER] JOIN Table2 ON clause, reads: SELECT * FROM people, homes LEFT JOIN people, homes ON people.id=homes.owner It should read: SELECT * FROM people LEFT JOIN homes ON people.id=homes.owner (253) the list of operators for WHERE statements appear to be in an italic font. It would look better in a normal font. ?254-255? In the GROUP BY and ORDER BY clauses, the columns shouldn't be given as a column-name; it is also possible to give the column-number in the query; numbering the fields in a query starts with "1". Example: select col1, col2, col3 from table order by 2; is equivalent to writing select col1, col2, col3 from table order by col2; In both cases, the result will be ordered on col2. I use this feature in PHP-scripts where I extract the result from some tables which need to be sorted on the first column, not necessarely on the primary key (, which may be several columns). {259} The e.g. currently reads: (e.g., ENCRYPT('mypass', '3a') should return "3afi4004idgv"). It should read: (e.g., ENCRYPT('mypass', '3a') will return "3aMC/FUHSlicQ"). Unless ENCRYPT won't always give the same result from a password/salt combination. {259} 4th function definition; BOOK EXTRACT :- DAYOFWEEK(date)/WEEKDAY(date) Returns the number of the day of the week (1 is Sunday) for the given date (e.g. DAY_OF_WEEK('1998-08-22') returns 7). ERROR :- This section is misleading, it gives the impression these 2 functions do the same thing and return 1 for Sunday, but they dont. DAYOFWEEK does return 1 for Sunday to 7 for Saturday as stated, but WEEKDAY is different it returns 0 for Monday to 6 for Sunday. Also 'e.g. DAY_OF_WEEK' shouldn't have underscores in it. (259) last line; time for a singe session. Running GET_LOCK() ... should read: time for a single session. Running GET_LOCK() ... (306) Chapter 18, "dexhex" The glossary term "dexhex" should be changed to "dechex" (as in 'decimal to hexidecimal'). [323] mysql_listtables() should be: mysql_list_tables(). As i understand it, mSQL uses 9781565924345_listtables(), but not both. [378] Example code for using DBI::bind_columns; $myothertable_output->bind_columns(undef, \($name, $date)); is called before the $myothertable_output->execute; line causing the bind_columns to fail. Line 10 in the example should be moved to before line 7 to correct this. {382} DBI::do and DBI::disconnect are out of order alphabetically. {384} Example code for DBI::execute; The last "paragraph" of code in the example calls $statement_handle->execute("J%"); which should be: $statement_handle2->execute("J%"); {386} Section: DBI::fetchrow_hashref The example code for this command is incorrect. The incorrect example code, as given is: 07: my %row1 = $mytable_ouput->fetchrow_hashref; 08: my @field_names = keys %row1; 11: my @row1 = values %row1; In line 7: $mytable_ouput should be $mytable_output (missing "t" in output) In line 7: %row1 should be $row1 (a variable instead of a hash since a hash reference is returned) in line 8: keys %row1 should be keys %{$row1} in line 11: values %row1 should be values %{$row1} Correct code segment, therefore should be: 07: my $row1 = $mytable_output->fetchrow_hashref; 08: my @field_names = keys %{$row1}; 11: my @row1 = values %{$row1}; The entire example, corrected should be: 01: use DBI; 02: my $db = DBI->connect('DBI:mSQL:mydata',undef,undef); 03: my $query = "SELECT * FROM mytable"; 04: my $mytable_output = $db->prepare($query); 05: $mytable_output->execute; 06: 07: my $row1 = $mytable_output->fetchrow_hashref; 08: my @field_names = keys %{$row1}; 09: # @field_names now contains the names of all of the fields in the query. 10: # This needs to be set only once. All future rows will have the same fields. 11: my @row1 = values %{$row1}; {413} The example code started on p. 412 should show the use of Mysql::errno. To do this the, following line on p. 413 has to be changed. The line currently reads: print "Error " . $output->errno . ": " . $output->errmsg ."\ It should read: print "Error " . $db->errno . ": " . $db->errmsg ."\ {472} Change: "DATE datatype, 72, 95, 236, 270" to: "DATE datatype, 71, 95, 236, 270" ... ? (486) Index: Change: "_timestamp system variable, 112" to: "_timestamp system variable, 111" (486) 'UPDATE statement' points to page 269. However, the update statement is on page 268. (Colophon) The explanation of the book's front cover may be in error. There are indeed between eighty and ninety Kingfishers in most parts of the world, however ten of these, including the worlds largest, the kookaburra, live on the Australian continent while I can not find any reference to any New Zealand kingfishers. I know another 14 species are found in Malaysia, so it could well be fair to say that the greatest numbers are found in the southeast Asian region.
Fields
FieldTypeSizeNOT NULL
$fields[$field]$types[$field]"; print $length[$field] if $types[$field] eq 'SQL_CHAR'; print ""; print 'Y' if ($not_null[$field]); print "