summaryrefslogtreecommitdiff
path: root/sql/opt_range.cc
diff options
context:
space:
mode:
authorunknown <monty@butch.>2002-11-07 03:54:00 +0200
committerunknown <monty@butch.>2002-11-07 03:54:00 +0200
commitc88b91020866b1505404157c76c56cbb92410ec5 (patch)
tree2cbd26b72e2ab9ce6d8a7e6cf96fab865fec9834 /sql/opt_range.cc
parent841fa6f694a5d998b94a6cd4508fe7d26e8407f3 (diff)
downloadmariadb-git-c88b91020866b1505404157c76c56cbb92410ec5.tar.gz
Portability fixes for Fortre C++ 5.0 (on Sun) in 32 and 64 bit modes.
client/mysqlbinlog.cc: Portability fix configure.in: Added use of ASFLAGS (For Solaris with Forte 5.0) include/my_global.h: Portability fix include/myisam.h: Portability fix include/queues.h: Portability fix innobase/include/ut0ut.h: Portability fix innobase/log/log0log.c: Portability fix innobase/rem/rem0cmp.c: Portability fix innobase/trx/trx0sys.c: Portability fix isam/pack_isam.c: Portability fix myisam/ft_boolean_search.c: Portability fix myisam/mi_dynrec.c: Code change to go around bug in Forte 5.0 myisam/sort.c: Portability fix mysys/my_aes.c: Portability fix scripts/Makefile.am: Support for ASFLAGS scripts/mysqlbug.sh: Support for ASFLAGS sql/field.cc: Portability fix sql/filesort.cc: Portability fix sql/gen_lex_hash.cc: Portability fix sql/ha_innodb.cc: Portability fix Changed SHOW INNODB STATUS to return error instead of writing message to log file. sql/ha_isammrg.cc: Portability fix sql/ha_myisam.cc: Portability fix sql/ha_myisammrg.cc: Portability fix sql/hash_filo.h: Portability fix sql/hostname.cc: Portability fix sql/item_cmpfunc.h: Indentation change sql/item_func.cc: Portability fix sql/item_func.h: Portability fix sql/log.cc: Portability fix sql/log_event.cc: Portability fix sql/mysql_priv.h: Portability fix sql/mysqld.cc: Portability fix Fixed bug with rpl_recovery_rank command line option on 64 bit systems sql/opt_range.cc: Portability fix sql/repl_failsafe.cc: Portability fix sql/slave.cc: Portability fix sql/slave.h: Portability fix sql/sql_acl.cc: Portability fix sql/sql_base.cc: Portability fix sql/sql_cache.cc: Portability fix sql/sql_cache.h: Portability fix sql/sql_class.cc: Portability fix sql/sql_delete.cc: Portability fix sql/sql_insert.cc: Portability fix sql/sql_manager.cc: Portability fix sql/sql_parse.cc: Portability fix BUILD/compile-solaris-sparc-forte: C sql/sql_udf.cc: Portability fix sql/sql_update.cc: Portability fix strings/Makefile.am: Portability fix strings/bmove_upp-sparc.s: Fix so that this works on 32 and 64 bit sparcs strings/str_test.c: Cleanup strings/strappend-sparc.s: Fix so that this works on 32 and 64 bit sparcs strings/strend-sparc.s: Fix so that this works on 32 and 64 bit sparcs strings/strmake-sparc.s: Fix so that this works on 32 and 64 bit sparcs strings/strmov-sparc.s: Fix so that this works on 32 and 64 bit sparcs strings/strnmov-sparc.s: Fix so that this works on 32 and 64 bit sparcs strings/strstr-sparc.s: Fix so that this works on 32 and 64 bit sparcs strings/strxmov-sparc.s: Fixes to make this more portable, but it's still not usable on 64 bit systems :( BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r--sql/opt_range.cc55
1 files changed, 30 insertions, 25 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 181d97ceacc..38fc8928eaf 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -2461,9 +2461,9 @@ int QUICK_SELECT::get_next()
DBUG_RETURN(HA_ERR_END_OF_FILE); // All ranges used
if (range->flag & NO_MIN_RANGE) // Read first record
{
- int error;
- if ((error=file->index_first(record)))
- DBUG_RETURN(error); // Empty table
+ int local_error;
+ if ((local_error=file->index_first(record)))
+ DBUG_RETURN(local_error); // Empty table
if (cmp_next(range) == 0)
DBUG_RETURN(0);
range=0; // No matching records; go to next range
@@ -2496,13 +2496,13 @@ int QUICK_SELECT::get_next()
/* compare if found key is over max-value */
/* Returns 0 if key <= range->max_key */
-int QUICK_SELECT::cmp_next(QUICK_RANGE *range)
+int QUICK_SELECT::cmp_next(QUICK_RANGE *range_arg)
{
- if (range->flag & NO_MAX_RANGE)
+ if (range_arg->flag & NO_MAX_RANGE)
return (0); /* key can't be to large */
KEY_PART *key_part=key_parts;
- for (char *key=range->max_key, *end=key+range->max_length;
+ for (char *key=range_arg->max_key, *end=key+range_arg->max_length;
key < end;
key+= key_part++->part_length)
{
@@ -2523,7 +2523,7 @@ int QUICK_SELECT::cmp_next(QUICK_RANGE *range)
if (cmp > 0)
return 1;
}
- return (range->flag & NEAR_MAX) ? 1 : 0; // Exact match
+ return (range_arg->flag & NEAR_MAX) ? 1 : 0; // Exact match
}
@@ -2607,9 +2607,9 @@ int QUICK_SELECT_DESC::get_next()
if (range->flag & NO_MAX_RANGE) // Read last record
{
- int error;
- if ((error=file->index_last(record)))
- DBUG_RETURN(error); // Empty table
+ int local_error;
+ if ((local_error=file->index_last(record)))
+ DBUG_RETURN(local_error); // Empty table
if (cmp_prev(range) == 0)
DBUG_RETURN(0);
range=0; // No matching records; go to next range
@@ -2655,16 +2655,18 @@ int QUICK_SELECT_DESC::get_next()
}
}
+
/*
- * Returns 0 if found key is inside range (found key >= range->min_key).
- */
-int QUICK_SELECT_DESC::cmp_prev(QUICK_RANGE *range)
+ Returns 0 if found key is inside range (found key >= range->min_key).
+*/
+
+int QUICK_SELECT_DESC::cmp_prev(QUICK_RANGE *range_arg)
{
- if (range->flag & NO_MIN_RANGE)
+ if (range_arg->flag & NO_MIN_RANGE)
return (0); /* key can't be to small */
KEY_PART *key_part = key_parts;
- for (char *key = range->min_key, *end = key + range->min_length;
+ for (char *key = range_arg->min_key, *end = key + range_arg->min_length;
key < end;
key += key_part++->part_length)
{
@@ -2688,42 +2690,45 @@ int QUICK_SELECT_DESC::cmp_prev(QUICK_RANGE *range)
if (cmp < 0)
return 1;
}
- return (range->flag & NEAR_MIN) ? 1 : 0; // Exact match
+ return (range_arg->flag & NEAR_MIN) ? 1 : 0; // Exact match
}
+
/*
* True if this range will require using HA_READ_AFTER_KEY
See comment in get_next() about this
*/
-bool QUICK_SELECT_DESC::range_reads_after_key(QUICK_RANGE *range)
+bool QUICK_SELECT_DESC::range_reads_after_key(QUICK_RANGE *range_arg)
{
- return ((range->flag & (NO_MAX_RANGE | NEAR_MAX)) ||
- !(range->flag & EQ_RANGE) ||
- head->key_info[index].key_length != range->max_length) ? 1 : 0;
+ return ((range_arg->flag & (NO_MAX_RANGE | NEAR_MAX)) ||
+ !(range_arg->flag & EQ_RANGE) ||
+ head->key_info[index].key_length != range_arg->max_length) ? 1 : 0;
}
+
/* True if we are reading over a key that may have a NULL value */
-bool QUICK_SELECT_DESC::test_if_null_range(QUICK_RANGE *range,
+bool QUICK_SELECT_DESC::test_if_null_range(QUICK_RANGE *range_arg,
uint used_key_parts)
{
uint offset,end;
KEY_PART *key_part = key_parts,
*key_part_end= key_part+used_key_parts;
- for (offset= 0, end = min(range->min_length, range->max_length) ;
+ for (offset= 0, end = min(range_arg->min_length, range_arg->max_length) ;
offset < end && key_part != key_part_end ;
offset += key_part++->part_length)
{
uint null_length=test(key_part->null_bit);
- if (!memcmp((char*) range->min_key+offset, (char*) range->max_key+offset,
+ if (!memcmp((char*) range_arg->min_key+offset,
+ (char*) range_arg->max_key+offset,
key_part->part_length + null_length))
{
offset+=null_length;
continue;
}
- if (null_length && range->min_key[offset])
+ if (null_length && range_arg->min_key[offset])
return 1; // min_key is null and max_key isn't
// Range doesn't cover NULL. This is ok if there is no more null parts
break;
@@ -2736,7 +2741,7 @@ bool QUICK_SELECT_DESC::test_if_null_range(QUICK_RANGE *range,
*/
if (key_part != key_part_end && key_part->null_bit)
{
- if (offset >= range->min_length || range->min_key[offset])
+ if (offset >= range_arg->min_length || range_arg->min_key[offset])
return 1; // Could be null
key_part++;
}