summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <monty@work.mysql.com>2001-09-28 06:28:04 +0200
committerunknown <monty@work.mysql.com>2001-09-28 06:28:04 +0200
commit1a57e278c2bf3b93d218cb0f610ba5d3a74e8968 (patch)
treea6b1c8b90c5b9593ce01cf029acb8150d80a1922 /sql
parenta353f6249ce88e6b652e3a8b15af4a3f5f96bc72 (diff)
parent6ba992fb5da4069b5d77e2cfd143d075a7ce07ee (diff)
downloadmariadb-git-1a57e278c2bf3b93d218cb0f610ba5d3a74e8968.tar.gz
merge
BitKeeper/etc/logging_ok: auto-union acinclude.m4: Auto merged mysql-test/r/null_key.result: Auto merged sql/mysqld.cc: Auto merged sql/sql_select.cc: Auto merged sql/udf_example.cc: Auto merged
Diffstat (limited to 'sql')
-rw-r--r--sql/mysqld.cc2
-rw-r--r--sql/nt_servc.cc3
-rw-r--r--sql/sql_select.cc24
-rw-r--r--sql/udf_example.cc25
4 files changed, 32 insertions, 22 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 67b5ba882d2..1cf109489ab 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -2046,7 +2046,7 @@ The server will not act as a slave.");
{
if(start_mode)
{
- if (WaitForSingleObject(hEventShutdown,INFINITE)==WAIT_OBJECT_0)
+ if (WaitForSingleObject(hEventShutdown,1000)==WAIT_TIMEOUT)
Service.Stop();
}
else
diff --git a/sql/nt_servc.cc b/sql/nt_servc.cc
index 5884300fe95..3a36f5740a9 100644
--- a/sql/nt_servc.cc
+++ b/sql/nt_servc.cc
@@ -246,7 +246,8 @@ void NTService::ServiceMain(DWORD argc, LPTSTR *argv)
WaitForSingleObject (pService->hExitEvent, INFINITE);
// wait for thread to exit
- WaitForSingleObject (pService->hThreadHandle, 30000);
+ if (WaitForSingleObject (pService->hThreadHandle, 1000)==WAIT_TIMEOUT)
+ CloseHandle(pService->hThreadHandle);
pService->Exit(0);
}
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 3aa534222e7..367b1d55a36 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -2332,7 +2332,20 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
{
JOIN_TAB *tab=join->join_tab+i;
table_map current_map= tab->table->map;
+ bool use_quick_range=0;
used_tables|=current_map;
+
+ if (tab->type == JT_REF && tab->quick &&
+ tab->ref.key_length < tab->quick->max_used_key_length)
+ {
+ /* Range uses longer key; Use this instead of ref on key */
+ tab->type=JT_ALL;
+ use_quick_range=1;
+ tab->use_quick=1;
+ tab->ref.key_parts=0; // Don't use ref key.
+ join->best_positions[i].records_read=tab->quick->records;
+ }
+
COND *tmp=make_cond_for_table(cond,used_tables,current_map);
if (!tmp && tab->quick)
{ // Outer join
@@ -2375,7 +2388,7 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
if (tab->const_keys && tab->table->reginfo.impossible_range)
DBUG_RETURN(1);
}
- else if (tab->type == JT_ALL)
+ else if (tab->type == JT_ALL && ! use_quick_range)
{
if (tab->const_keys &&
tab->table->reginfo.impossible_range)
@@ -2434,15 +2447,6 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
}
}
}
- if (tab->type == JT_REF && sel->quick &&
- tab->ref.key_length < sel->quick->max_used_key_length)
- {
- /* Range uses longer key; Use this instead of ref on key */
- tab->type=JT_ALL;
- tab->use_quick=1;
- tab->ref.key_parts=0; // Don't use ref key.
- join->best_positions[i].records_read=sel->quick->records;
- }
}
}
}
diff --git a/sql/udf_example.cc b/sql/udf_example.cc
index 3a528a9ad3a..44a1d00437a 100644
--- a/sql/udf_example.cc
+++ b/sql/udf_example.cc
@@ -66,7 +66,7 @@
** You can easily get all switches right by doing:
** cd sql ; make udf_example.o
** Take the compile line that make writes, remove the '-c' near the end of
-** the line and add -o udf_example.so to the end of the compile line.
+** the line and add -shared -o udf_example.so to the end of the compile line.
** The resulting library (udf_example.so) should be copied to some dir
** searched by ld. (/usr/lib ?)
**
@@ -97,6 +97,13 @@
** Active function will be reloaded on every restart of server
** (if --skip-grant-tables is not given)
**
+** If you ge problems with undefined symbols when loading the shared
+** library, you should verify that mysqld is compiled with the -rdynamic
+** option.
+**
+** If you can't get AGGREGATES to work, check that you have the column
+** 'type' in the mysql.func table. If not, run 'mysql_fix_privilege_tables'.
+**
*/
#ifdef STANDARD
@@ -128,6 +135,11 @@ my_bool sequence_init(UDF_INIT *initid, UDF_ARGS *args, char *message);
void sequence_deinit(UDF_INIT *initid);
long long sequence(UDF_INIT *initid, UDF_ARGS *args, char *is_null,
char *error);
+my_bool avgcost_init( UDF_INIT* initid, UDF_ARGS* args, char* message );
+void avgcost_deinit( UDF_INIT* initid );
+void avgcost_reset( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char *error );
+void avgcost_add( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char *error );
+double avgcost( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char *error );
}
@@ -766,6 +778,7 @@ char *reverse_lookup(UDF_INIT *initid, UDF_ARGS *args, char *result,
*res_length=(ulong) (strmov(result,hp->h_name) - result);
return result;
}
+#endif // defined(HAVE_GETHOSTBYADDR_R) && defined(HAVE_SOLARIS_STYLE_GETHOST)
/*
** Syntax for the new aggregate commands are:
@@ -777,13 +790,6 @@ char *reverse_lookup(UDF_INIT *initid, UDF_ARGS *args, char *result,
** (this example is provided by Andreas F. Bobak <bobak@relog.ch>)
*/
-extern "C" {
-my_bool avgcost_init( UDF_INIT* initid, UDF_ARGS* args, char* message );
-void avgcost_deinit( UDF_INIT* initid );
-void avgcost_reset( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char *error );
-void avgcost_add( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char *error );
-double avgcost( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char *error );
-}
struct avgcost_data
{
@@ -810,7 +816,7 @@ avgcost_init( UDF_INIT* initid, UDF_ARGS* args, char* message )
return 1;
}
- if ((args->arg_type[0] != INT_RESULT) && (args->arg_type[1] != REAL_RESULT) )
+ if ((args->arg_type[0] != INT_RESULT) || (args->arg_type[1] != REAL_RESULT) )
{
strcpy(
message,
@@ -917,5 +923,4 @@ avgcost( UDF_INIT* initid, UDF_ARGS* args, char* is_null, char* error )
return data->totalprice/double(data->totalquantity);
}
-#endif // defined(HAVE_GETHOSTBYADDR_R) && defined(HAVE_SOLARIS_STYLE_GETHOST)
#endif /* HAVE_DLOPEN */