List:Commits« Previous MessageNext Message »
From:Konstantin Osipov Date:August 10 2008 9:12pm
Subject:bzr commit into mysql-6.0-runtime branch (konstantin:2697)
View as plain text  
#At file:///opt/local/work/mysql-6.0-records/

 2697 Konstantin Osipov	2008-08-10
      Move read_record related functions to a new header - records.h
added:
  sql/records.h
modified:
  sql/Makefile.am
  sql/handler.h
  sql/mysql_priv.h
  sql/records.cc
  sql/sql_select.h
  sql/structs.h

per-file messages:
  sql/Makefile.am
    Introduce records.h
  sql/handler.h
    Forward-declare class handler, which previously was forward-declared
    in structs.h
  sql/mysql_priv.h
    Include records.h, previously part of structs.h
  sql/records.cc
    Use records.h
  sql/records.h
    Introduce records.h -- an interface header to records.cc
  sql/sql_select.h
    Update to use new declarations.
  sql/structs.h
    Move declarations of READ_RECORD and related functions to records.h
=== modified file 'sql/Makefile.am'
--- a/sql/Makefile.am	2008-08-08 01:33:43 +0000
+++ b/sql/Makefile.am	2008-08-10 19:12:50 +0000
@@ -89,7 +89,7 @@ noinst_HEADERS =	item.h item_func.h item
 			sql_partition.h partition_info.h partition_element.h \
 			probes.h sql_audit.h transaction.h \
 			contributors.h sql_servers.h ddl_blocker.h \
-			si_objects.h sql_plist.h mdl.h
+			si_objects.h sql_plist.h mdl.h records.h
 
 mysqld_SOURCES =	sql_lex.cc sql_handler.cc sql_partition.cc \
 			item.cc item_sum.cc item_buff.cc item_func.cc \

=== modified file 'sql/handler.h'
--- a/sql/handler.h	2008-08-10 14:49:52 +0000
+++ b/sql/handler.h	2008-08-10 19:12:50 +0000
@@ -624,6 +624,7 @@ struct handler_iterator {
   void *buffer;
 };
 
+struct handler;
 /*
   handlerton is a singleton structure - one instance per storage engine -
   to provide access to storage engine functionality that works on the

=== modified file 'sql/mysql_priv.h'
--- a/sql/mysql_priv.h	2008-08-10 14:49:52 +0000
+++ b/sql/mysql_priv.h	2008-08-10 19:12:50 +0000
@@ -916,6 +916,7 @@ bool general_log_write(THD *thd, enum en
 #include "tztime.h"
 #ifdef MYSQL_SERVER
 #include "sql_servers.h"
+#include "records.h"
 #include "opt_range.h"
 
 #ifdef HAVE_QUERY_CACHE

=== modified file 'sql/records.cc'
--- a/sql/records.cc	2008-07-17 19:55:18 +0000
+++ b/sql/records.cc	2008-08-10 19:12:50 +0000
@@ -13,6 +13,9 @@
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
+#ifdef USE_PRAGMA_INTERFACE
+#pragma implementation /* gcc class implementation */
+#endif
 
 /**
   @file
@@ -21,8 +24,10 @@
   Functions for easy reading of records, possible through a cache
 */
 
+#include "records.h"
 #include "mysql_priv.h"
 
+
 static int rr_quick(READ_RECORD *info);
 int rr_sequential(READ_RECORD *info);
 static int rr_from_tempfile(READ_RECORD *info);

=== added file 'sql/records.h'
--- a/sql/records.h	1970-01-01 00:00:00 +0000
+++ b/sql/records.h	2008-08-10 19:12:50 +0000
@@ -0,0 +1,76 @@
+#ifndef SQL_RECORDS_H
+#define SQL_RECORDS_H 
+/* Copyright (C) 2008 Sun/MySQL
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; version 2 of the License.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
+
+#ifdef USE_PRAGMA_INTERFACE
+#pragma interface                      /* gcc class implementation */
+#endif
+#include <my_global.h>                /* for uint typedefs */
+
+struct st_join_table;
+class handler;
+struct TABLE;
+class THD;
+struct SQL_SELECT;
+
+/**
+  A context for reading through a single table using a chosen access method:
+  index read, scan, etc, use of cache, etc.
+
+  Use by:
+  READ_RECORD read_record;
+  init_read_record(&read_record, ...);
+  while (read_record.read_record())
+  {
+    ...
+  }
+  end_read_record();
+*/
+
+struct READ_RECORD
+{
+  typedef int (*Read_func)(READ_RECORD*);
+  typedef int (*Setup_func)(struct st_join_table*);
+
+  TABLE *table;                                 /* Head-form */
+  handler *file;
+  TABLE **forms;                                /* head and ref forms */
+  Read_func read_record;
+  THD *thd;
+  SQL_SELECT *select;
+  uint cache_records;
+  uint ref_length,struct_length,reclength,rec_cache_size,error_offset;
+  uint index;
+  uchar *ref_pos;				/* pointer to form->refpos */
+  uchar *record;
+  uchar *rec_buf;                /* to read field values  after filesort */
+  uchar	*cache,*cache_pos,*cache_end,*read_positions;
+  struct st_io_cache *io_cache;
+  bool print_error, ignore_not_found_rows;
+  struct st_join_table *do_insideout_scan;
+
+public:
+  READ_RECORD() {}
+};
+
+void init_read_record(READ_RECORD *info, THD *thd, TABLE *reg_form,
+		      SQL_SELECT *select, int use_record_cache,
+                      bool print_errors, bool disable_rr_cache);
+void init_read_record_idx(READ_RECORD *info, THD *thd, TABLE *table,
+                          bool print_error, uint idx);
+void end_read_record(READ_RECORD *info);
+
+#endif /* SQL_RECORDS_H */

=== modified file 'sql/sql_select.h'
--- a/sql/sql_select.h	2008-08-07 17:52:43 +0000
+++ b/sql/sql_select.h	2008-08-10 19:12:50 +0000
@@ -174,7 +174,6 @@ class SJ_TMP_TABLE;
 
 typedef enum_nested_loop_state
 (*Next_select_func)(JOIN *, struct st_join_table *, bool);
-typedef int (*Read_record_func)(struct st_join_table *tab);
 Next_select_func setup_end_select_func(JOIN *join);
 
 
@@ -210,7 +209,7 @@ typedef struct st_join_table {
   */
   uint          packed_info;
 
-  Read_record_func read_first_record;
+  READ_RECORD::Setup_func read_first_record;
   Next_select_func next_select;
   READ_RECORD	read_record;
   /* 
@@ -218,8 +217,8 @@ typedef struct st_join_table {
     if it is executed by an alternative full table scan when the left operand of
     the subquery predicate is evaluated to NULL.
   */  
-  Read_record_func save_read_first_record;/* to save read_first_record */ 
-  int (*save_read_record) (READ_RECORD *);/* to save read_record.read_record */
+  READ_RECORD::Setup_func save_read_first_record;/* to save read_first_record */
+  READ_RECORD::Read_func save_read_record;/* to save read_record.read_record */
   double	worst_seeks;
   key_map	const_keys;			/**< Keys with constant part */
   key_map	checked_keys;			/**< Keys checked in find_best */

=== modified file 'sql/structs.h'
--- a/sql/structs.h	2008-08-10 14:49:52 +0000
+++ b/sql/structs.h	2008-08-10 19:12:50 +0000
@@ -18,6 +18,7 @@
 
 struct TABLE;
 class Field;
+class THD;
 
 typedef struct st_date_time_format {
   uchar positions[8];
@@ -115,31 +116,6 @@ typedef struct st_reginfo {		/* Extra in
 } REGINFO;
 
 
-struct st_read_record;				/* For referense later */
-class SQL_SELECT;
-class THD;
-class handler;
-struct st_join_table;
-
-typedef struct st_read_record {			/* Parameter to read_record */
-  TABLE *table;                                 /* Head-form */
-  handler *file;
-  TABLE **forms;                                /* head and ref forms */
-  int (*read_record)(struct st_read_record *);
-  THD *thd;
-  SQL_SELECT *select;
-  uint cache_records;
-  uint ref_length,struct_length,reclength,rec_cache_size,error_offset;
-  uint index;
-  uchar *ref_pos;				/* pointer to form->refpos */
-  uchar *record;
-  uchar *rec_buf;                /* to read field values  after filesort */
-  uchar	*cache,*cache_pos,*cache_end,*read_positions;
-  IO_CACHE *io_cache;
-  bool print_error, ignore_not_found_rows;
-  struct st_join_table *do_insideout_scan;
-} READ_RECORD;
-
 
 /*
   Originally MySQL used MYSQL_TIME structure inside server only, but since

Thread
bzr commit into mysql-6.0-runtime branch (konstantin:2697) Konstantin Osipov10 Aug