summaryrefslogtreecommitdiff
path: root/sql/item_func.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r--sql/item_func.cc56
1 files changed, 40 insertions, 16 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 4caa959bce8..b59aceb512e 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -1496,14 +1496,7 @@ void debug_sync_point(const char* lock_name, uint lock_timeout)
thd->mysys_var->current_mutex= &LOCK_user_locks;
thd->mysys_var->current_cond= &ull->cond;
-#ifdef HAVE_TIMESPEC_TS_SEC
- abstime.ts_sec=time((time_t*) 0)+(time_t) lock_timeout;
- abstime.ts_nsec=0;
-#else
- abstime.tv_sec=time((time_t*) 0)+(time_t) lock_timeout;
- abstime.tv_nsec=0;
-#endif
-
+ set_timespec(abstime,lock_timeout);
while (!thd->killed &&
(error=pthread_cond_timedwait(&ull->cond,&LOCK_user_locks,&abstime))
!= ETIME && error != ETIMEDOUT && ull->locked) ;
@@ -1591,14 +1584,7 @@ longlong Item_func_get_lock::val_int()
thd->mysys_var->current_mutex= &LOCK_user_locks;
thd->mysys_var->current_cond= &ull->cond;
-#ifdef HAVE_TIMESPEC_TS_SEC
- abstime.ts_sec=time((time_t*) 0)+(time_t) timeout;
- abstime.ts_nsec=0;
-#else
- abstime.tv_sec=time((time_t*) 0)+(time_t) timeout;
- abstime.tv_nsec=0;
-#endif
-
+ set_timespec(abstime,timeout);
while (!thd->killed &&
(error=pthread_cond_timedwait(&ull->cond,&LOCK_user_locks,&abstime))
!= ETIME && error != ETIMEDOUT && ull->locked) ;
@@ -1859,6 +1845,16 @@ Item_func_set_user_var::val_str(String *str)
}
+void Item_func_set_user_var::print(String *str)
+{
+ str->append('(');
+ str->append(name.str,name.length);
+ str->append(":=",2);
+ args[0]->print(str);
+ str->append(')');
+}
+
+
user_var_entry *Item_func_get_user_var::get_entry()
{
if (!entry || ! entry->value)
@@ -1951,6 +1947,34 @@ enum Item_result Item_func_get_user_var::result_type() const
return entry->type;
}
+
+void Item_func_get_user_var::print(String *str)
+{
+ str->append('@');
+ str->append(name.str,name.length);
+ str->append(')');
+}
+
+bool Item_func_get_user_var::eq(const Item *item) const
+{
+ /* Assume we don't have rtti */
+ if (this == item)
+ return 1; // Same item is same.
+ /* Check if other type is also a get_user_var() object */
+#ifdef FIX_THIS
+ if (item->eq == &Item_func_get_user_var::eq)
+ return 0;
+#else
+ if (item->type() != FUNC_ITEM ||
+ ((Item_func*) item)->func_name() != func_name())
+ return 0;
+#endif
+ Item_func_get_user_var *other=(Item_func_get_user_var*) item;
+ return (name.length == other->name.length &&
+ !memcmp(name.str, other->name.str, name.length));
+}
+
+
longlong Item_func_inet_aton::val_int()
{
uint byte_result = 0;