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.2500 05/02/08 20:01:34 paul@stripped +1 -0
internals.texi:
Fix up Texinfo constructs.
Docs/internals.texi
1.62 05/02/08 20:01:19 paul@stripped +51 -51
Fix up Texinfo constructs.
# 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.61/Docs/internals.texi 2005-02-08 19:10:31 -06:00
+++ 1.62/Docs/internals.texi 2005-02-08 20:01:19 -06:00
@@ -52,7 +52,7 @@
@center Copyright @copyright{} 1998-2004 MySQL AB
@menu
-* guided tour:: Guided Tour
+* guided tour:: A Guided Tour Of The MySQL Source Code
* coding guidelines:: Coding Guidelines
* optimizer:: The Optimizer
* Algorithms:: Important Algorithms and Structures
@@ -824,14 +824,14 @@
@example
int mysql_update(THD *thd, ...)
-{
+@{
...
if ((lock_tables(thd, table_list)))
DBUG_RETURN(1); ...
...
init_read_record(&info,thd,table,select,0,1); ...
while (!(error=info.read_record(&info)) && !thd->killed)
- {
+ @{
...
if (!(error=table->file->update_row((byte*) table->record[1]),
(byte*) table->record[0])))
@@ -840,13 +840,13 @@
if (table->triggers)
table->triggers->process_triggers(thd, TRG_EVENT_UPDATE, TRG_ACTION_AFTER);
...
- }
+ @}
...
if (updated && (error <= 0 || !transactional_table))
- {
+ @{
mysql_bin_log.write(&qinfo) && transactional_table);
...
-}
+@}
@end example
Here's a snippet of code from a .c file in the sql directory,
@@ -923,7 +923,7 @@
@example
int main(int argc, char **argv)
- {
+ @{
_cust_check_startup();
(void) thr_setconcurrency(concurrency);
init_ssl();
@@ -937,7 +937,7 @@
handle_connections_sockets(0); // !
DBUG_PRINT("quit",("Exiting main thread"));
exit(0);
- }
+ @}
@end example
Here is where it all starts, in the main function of mysqld.cc.
@@ -973,13 +973,13 @@
@example
handle_connections_sockets (arg __attribute__((unused))
- {
+ @{
if (ip_sock != INVALID_SOCKET)
- {
+ @{
FD_SET(ip_sock,&clientFDs);
DBUG_PRINT("general",("Waiting for connections."));
while (!abort_loop)
- {
+ @{
new_sock = accept(sock, my_reinterpret_cast(struct sockaddr*)
(&cAddr),
&length);
@@ -987,7 +987,7 @@
if (sock == unix_sock)
thd->host=(char*) localhost;
create_new_thread(thd); // !
- }
+ @}
@end example
Inside handle_connections_sockets you'll see the hallmarks of a
@@ -1009,13 +1009,13 @@
@example
create_new_thread(THD *thd)
- {
+ @{
pthread_mutex_lock(&LOCK_thread_count);
pthread_create(&thd->real_id,&connection_attrib,
handle_one_connection, // !
(void*) thd));
pthread_mutex_unlock(&LOCK_thread_count);
- }
+ @}
@end example
Here is a close look at the routine that spawns the new thread.
@@ -1028,13 +1028,13 @@
@example
handle_one_connection(THD *thd)
- {
+ @{
init_sql_alloc(&thd->mem_root, MEM_ROOT_BLOCK_SIZE, MEM_ROOT_PREALLOC);
while (!net->error && net->vio != 0 && !thd->killed)
- {
+ @{
if (do_command(thd)) // !
break;
- }
+ @}
close_connection(net);
end_thread(thd,1);
packet=(char*) net->read_pos;
@@ -1072,14 +1072,14 @@
@example
bool do_command(THD *thd)
-{
+@{
net_new_transaction(net);
packet_length=my_net_read(net);
packet=(char*) net->read_pos;
command = (enum enum_server_command) (uchar) packet[0];
dispatch_command(command,thd, packet+1, (uint) packet_length);
// !
-}
+@}
@end example
You've probably noticed by now that whenever we call a lower-level
@@ -1102,8 +1102,8 @@
@example
bool dispatch_command(enum enum_server_command command, THD *thd,
char* packet, uint packet_length)
-{
- switch (command) {
+@{
+ switch (command) @{
case COM_INIT_DB: ...
case COM_REGISTER_SLAVE: ...
case COM_TABLE_DUMP: ...
@@ -1117,7 +1117,7 @@
default:
send_error(thd, ER_UNKNOWN_COM_ERROR);
break;
- }
+ @}
@end example
And here's just part of a very large switch statement in sql_parse.cc.
@@ -1167,8 +1167,8 @@
@example
bool dispatch_command(enum enum_server_command command, THD *thd,
char* packet, uint packet_length)
- {
- switch (command) {
+ @{
+ switch (command) @{
case COM_INIT_DB: ...
case COM_REGISTER_SLAVE: ...
case COM_TABLE_DUMP: ...
@@ -1182,7 +1182,7 @@
default:
send_error(thd, ER_UNKNOWN_COM_ERROR);
break;
- }
+ @}
@end example
Let's return to the grand central junction again in sql_parse.cc
@@ -1193,15 +1193,15 @@
@example
void mysql_stmt_execute(THD *thd, char *packet)
- {
+ @{
if (!(stmt=find_prepared_statement(thd, stmt_id, "execute")))
- {
+ @{
send_error(thd);
DBUG_VOID_RETURN;
- }
+ @}
init_stmt_execute(stmt);
mysql_execute_command(thd); // !
- }
+ @}
@end example
In this case, the line that we're following is the line that executes
@@ -1219,7 +1219,7 @@
@example
void mysql_execute_command(THD *thd)
- switch (lex->sql_command) {
+ switch (lex->sql_command) @{
case SQLCOM_SELECT: ...
case SQLCOM_SHOW_ERRORS: ...
case SQLCOM_CREATE_TABLE: ...
@@ -1227,7 +1227,7 @@
case SQLCOM_INSERT: ... // !
case SQLCOM_DELETE: ...
case SQLCOM_DROP_TABLE: ...
- }
+ @}
@end example
In the mysql_execute_command function. we encounter another
@@ -1238,7 +1238,7 @@
@example
case SQLCOM_INSERT:
-{
+@{
my_bool update=(lex->value_list.elements ? UPDATE_ACL : 0);
ulong privilege= (lex->duplicates == DUP_REPLACE ?
INSERT_ACL | DELETE_ACL : INSERT_ACL | update);
@@ -1247,10 +1247,10 @@
if (grant_option && check_grant(thd,privilege,tables))
goto error;
if (select_lex->item_list.elements != lex->value_list.elements)
- {
+ @{
send_error(thd,ER_WRONG_VALUE_COUNT);
DBUG_VOID_RETURN;
- }
+ @}
res = mysql_insert(thd,tables,lex->field_list,lex->many_values,
select_lex->item_list, lex->value_list,
(update ? DUP_UPDATE : lex->duplicates));
@@ -1258,7 +1258,7 @@
if (thd->net.report_error)
res= -1;
break;
-}
+@}
@end example
For this snippet, we've blown up the code around the SQLCOM_INSERT case
@@ -1306,7 +1306,7 @@
@example
int mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields,
List<List_item> &values_list,enum_duplicates duplic)
- {
+ @{
table = open_ltable(thd,table_list,lock_type);
if (check_insert_fields(thd,table,fields,*values,1) ||
setup_tables(table_list) ||
@@ -1319,7 +1319,7 @@
error=ha_autocommit_or_rollback(thd,error);
query_cache_invalidate3(thd, table_list, 1);
mysql_unlock_tables(thd, thd->lock);
- }
+ @}
@end example
For the mysql_insert routine, we're just going to read what's
@@ -1340,9 +1340,9 @@
@example
int write_record(TABLE *table,COPY_INFO *info)
- {
+ @{
table->file->write_row(table->record[0]; // !
- }
+ @}
@end example
You can see from our marker that we're going to follow the
@@ -1369,7 +1369,7 @@
key_used_on_scan(MAX_KEY),
create_time(0), check_time(0), update_time(0), mean_rec_length(0),
ft_handler(0)
- {}
+ @{@}
...
virtual int write_row(byte * buf)=0;
@end example
@@ -1388,7 +1388,7 @@
@example
int ha_myisam::write_row(byte * buf)
-{
+@{
statistic_increment(ha_write_count,&LOCK_status);
/* If we have a timestamp column, update it to the current time */
if (table->time_stamp)
@@ -1400,7 +1400,7 @@
if (table->next_number_field && buf == table->record[0])
update_auto_increment();
return mi_write(file,buf); // !
-}
+@}
@end example
And that brings us to write_row in the ha_myisam.cc program. Remember
@@ -1413,16 +1413,16 @@
@example
int mi_write(MI_INFO *info, byte *record)
-{
+@{
_mi_readinfo(info,F_WRLCK,1);
_mi_mark_file_changed(info);
/* Calculate and check all unique constraints */
for (i=0 ; i < share->state.header.uniques ; i++)
- {
+ @{
mi_check_unique(info,share->uniqueinfo+i,record,
mi_unique_hash(share->uniqueinfo+i,record),
HA_OFFSET_ERROR);
- }
+ @}
... to be continued in next snippet
@end example
@@ -1443,14 +1443,14 @@
/* Write all keys to indextree */
for (i=0 ; i < share->base.keys ; i++)
- {
+ @{
share->keyinfo[i].ck_insert(info,i,buff,
_mi_make_key(info,i,buff,record,filepos)
- }
+ @}
(*share->write_record)(info,record);
if (share->base.auto_key)
update_auto_increment(info,record);
-}
+@}
@end example
In this second half of the mi_write function, we see another clear
@@ -3313,12 +3313,12 @@
and we include operators such as = and LIKE, which are operators that
return boolean values. Consider the following statement:
@example
-SELECT UPPER(column1) FROM t WHERE column2 = @x
+SELECT UPPER(column1) FROM t WHERE column2 = @@x
@end example
For this statement, MySQL will need to store a list of items for the
select list ('column1' column reference and UPPER function), and a
list of items for the WHERE clause ('column2' column reference and
-'@x' variable and '=' operator).
+'@@x' variable and '=' operator).
Terminology: an Item instance in a MySQL program roughly corresponds
to a "site", which according to the standard_SQL definition is
@@ -3381,7 +3381,7 @@
use of Item and its subclasses.
-@node filesort, bulk-insert, Algorithms, Algorithms
+@node filesort, bulk-insert, item class, Algorithms
@section How MySQL Does Sorting (@code{filesort})
@c NOTE: This description is also present in manual.texi
| Thread |
|---|
| • bk commit - mysqldoc tree (paul:1.2500) | paul | 9 Feb |