Below is the list of changes that have just been committed into a local
mysqldoc repository of paul. When paul does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://www.mysql.com/doc/I/n/Installing_source_tree.html
ChangeSet
1.2635 05/05/06 17:20:56 paul@stripped +1 -0
internals.texi:
Add markup.
Docs/internals.texi
1.74 05/05/06 17:20:48 paul@stripped +74 -55
Add markup.
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: paul
# Host: frost.snake.net
# Root: /Volumes/frost2/MySQL/bk/mysqldoc
--- 1.73/Docs/internals.texi 2005-04-14 18:14:34 -05:00
+++ 1.74/Docs/internals.texi 2005-05-06 17:20:48 -05:00
@@ -57,7 +57,7 @@
* optimizer:: The Optimizer
* Algorithms:: Important Algorithms and Structures
* MySQL column types:: The different column types in MySQL
-* Charsets:: Charsets and Related Issues
+* Charsets:: Character Sets and Related Issues
* selects:: How MySQL Performs Different Selects
* transformations:: How MySQL Transforms Subqueries
* Client/Server Protocol:: MySQL Client/Server Protocol
@@ -389,7 +389,7 @@
The Optimizer
Important Algorithms and Structures
The different column types in MySQL
-Charsets and Related Issues
+Character Sets and Related Issues
How MySQL Performs Different Selects
How MySQL Transforms Subqueries
MySQL Client/Server Protocol
@@ -4508,74 +4508,93 @@
@section VARCHAR type
@itemize @bullet
+
+@item
+In old tables (from MySQL 4.1 and earlier), @code{VARCHAR} columns have type
+@code{MYSQL_TYPE_VAR_STRING}, which works exactly like a @code{CHAR} with
+the exception that if you do an @code{ALTER TABLE}, it's converted to a true
+@code{VARCHAR} (@code{MYSQL_TYPE_VARCHAR}). (This means that old tables
+will work as before for users)
+
+@item
+Apart from the above case, there is not anymore any automatic changes from
+@code{CHAR} to @code{VARCHAR} or from @code{VARCHAR} to @code{CHAR}. MySQL
+will remember the used type and stick to it.
+
+@item
+@code{VARCHAR} is implemented in @file{field.h} and @file{field.cc} through
+the new class @code{Field_varstring}.
+
+@item
+@code{MyISAM} implements @code{VARCHAR} both for dynamic-length and
+fixed-length rows (as signaled with the @code{ROW_FORMAT} flag)
+
@item
-In old tables (from MySQL 4.1 and below) VARCHAR fields have type
-MYSQL_TYPE_VAR_STRING, which works exactly like a CHAR with the
-exception that if you do an ALTER TABLE it's converted to a true
-VARCHAR (MYSQL_TYPE_VARCHAR).
-(This means that old tables will work as before for users)
-@item
-Apart from the above case, there is not anymore any automatic changes
-from CHAR to VARCHAR or from VARCHAR to CHAR. MySQL will remember the
-used type and stick to it.
-@item
-VARCHAR is implemented in field.h and field.cc through the
-new class Field_varstring.
-@item
-MyISAM implements VARCHAR both for dynamic length and fixed length
-rows (as signaled with the ROW_FORMAT flag)
-@item
-The main difference between VARCHAR and CHAR is that VARCHAR stores end
-space. (If end space doesn't fit into the column, this is an error in
-strict mode). Note that end space are not significant in compare or for
-unique; In this case VARCHAR works just like CHAR.
+The main difference between @code{VARCHAR} and @code{CHAR} is that
+@code{VARCHAR} stores end space. (If end space doesn't fit into the column,
+this is an error in strict mode). Note that end space are not significant in
+comparisons or for unique. In this case, @code{VARCHAR} works just like
+@code{CHAR}.
+
@item
-In table->record there is reserved a fixed amount of space for
+In @code{table->record}, there is reserved a fixed amount of space for
the varchar lengths (1 or 2 bytes) + data.
+
@item
-If VARCHAR storage length <= 255 then we use 1 byte length, else a 2
-byte length. This gives us 65535 as a maximum size for VARCHAR (for
-multi-byte character sets the maximum size is of course smaller).
+If @code{VARCHAR} storage length <= 255, then we use 1-byte length, else a
+2-byte length. This gives us 65535 as a maximum size for @code{VARCHAR} (for
+multi-byte character sets, the maximum size is of course smaller).
+
@item
The number of bytes used to store the length is in the field
-Field_varchar->length_bytes. Note that internally this can be 2 even if
-Field_varchar->field_length < 256 (for example for a shortened key to a
-varchar(256)).
+@code{Field_varchar->length_bytes}. Note that internally this can be 2 even if
+@code{Field_varchar->field_length} < 256 (for example, for a shortened key to a
+@code{varchar(256)}).
+
@item
-There is a new macro: HA_VARCHAR_PACKLENGTH(field_length) that can be
-used on field->length in write_row / read_row to check how many length
+There is a new macro, @code{HA_VARCHAR_PACKLENGTH(field_length)}, that can be
+used on @code{field->length} in write_row / read_row to check how many length
bytes are used. (In this context we can't have a field_length < 256 with
-a 2 byte pack length)
+a 2-byte pack length)
+
+@item
+When creating a key for the handler, @code{HA_KEYTYPE_VARTEXT1} and
+@code{HA_KEYTYPE_BINARY1} are used for a key on a column that has a 1-byte
+length prefix and @code{HA_KEYTYPE_VARTEXT2} and @code{HA_KEYTYPE_BINARY2}
+for a column that has a 2-byte length prefix. (In the future we will
+probably delete @code{HA_KEYTYPE_BINARY#}, as this can be instead be done by
+just using the @code{binary} character set with @code{HA_KEYTYPE_VARTEXT#})
+
@item
-When creating a key for the handler, HA_KEYTYPE_VARTEXT1 and
-HA_KEYTYPE_BINARY1 are used for a key on a column that has a 1 byte
-length prefix and HA_KEYTYPE_VARTEXT2 and HA_KEYTYPE_BINARY2 for a
-column that has a 2 byte length prefix. (In the future we will probably
-delete HA_KEYTYPE_BINARY# as this can be instead be done by just using
-the binary characterset with HA_KEYTYPE_VARTEXT#)
-@item
-When sending a key to the handler for index_read() or records_in_range,
-we always use a 2 byte length for the VARCHAR to make things simpler.
-(The intention is in 5.1 change CHAR's to also use a 2 byte length for
+When sending a key to the handler for @code{index_read()} or records_in_range,
+we always use a 2-byte length for the @code{VARCHAR} to make things simpler.
+(The intention is in 5.1 change @code{CHAR}'s to also use a 2-byte length for
these functions, as this will speed up and simplify the key handling
code on the handler side)
+
@item
-The test case 'mysql-test/include/varchar.inc' should be include in the
-code that tests the handler, see t/myisam.test for how to use this. You
-should verify the result against the one in mysql-test/t/myisam.result'
-to ensure that you get the correct results.
-@item
-Clients sees both the old and new VARCHAR type as MYSQL_TYPE_VAR_STRING,
-it will never (at least for 5.0) see MYSQL_TYPE_VARCHAR. This is to
-ensure that old clients will work as before.
-@item
-If one runs MySQL 5.0 with the --new option, then MySQL will show old
-VARCHAR columns as 'CHAR' in SHOW CREATE TABLE. (This is useful when
-testing if a table is using the new VARCHAR type or not).
+The test case file @file{mysql-test/include/varchar.inc} should be included
+in the code that tests the handler. See @file{t/myisam.test} for how to use
+this. You should verify the result against the one in
+@file{mysql-test/t/myisam.result} to ensure that you get the correct
+results.
+
+@item
+A client sees both the old and new @code{VARCHAR} type as
+@code{MYSQL_TYPE_VAR_STRING}. It will never (at least for 5.0) see
+@code{MYSQL_TYPE_VARCHAR}. This is to ensure that old clients will work as
+before.
+
+@item
+If you run MySQL 5.0 with the @code{--new} option, MySQL will show old
+@code{VARCHAR} columns as @code{'CHAR'} in @code{SHOW CREATE TABLE}. (This
+is useful when testing whether a table is using the new @code{VARCHAR} type
+or not).
+
@end itemize
@node Charsets, selects, MySQL column types, Top
-@chapter Charsets and Related Issues
+@chapter Character Sets and Related Issues
@menu
* CHARSET_INFO:: @code{CHARSET_INFO} Structure
| Thread |
|---|
| • bk commit - mysqldoc@docsrva tree (paul:1.2635) | paul | 7 May |