summaryrefslogtreecommitdiff
path: root/include/my_global.h
diff options
context:
space:
mode:
authorunknown <konstantin@mysql.com>2004-04-30 03:00:19 +0400
committerunknown <konstantin@mysql.com>2004-04-30 03:00:19 +0400
commitd5237fd09f71ccc8e008118607f8f22af4be630e (patch)
treefc6d7dc87294264a61e636135a576237a43d072f /include/my_global.h
parentae629fff866dda4e0e3411b0614d0c1efdfb6362 (diff)
downloadmariadb-git-d5237fd09f71ccc8e008118607f8f22af4be630e.tar.gz
Fix for Bug#3035 "Prepared statement integer inserts": now unsigned
flag is sent to server with placeholder types. There were no need to extend the protocol as one additional byte was reserved for placeholder code, when placeholder code is in range 0-255. So this byte is now used for flags. Post-review fixes added. include/config-win.h: added floaststore implementation include/my_global.h: added floatstore implementation include/mysql.h: Bug#3035: added 'is_unsigned' member binary_data wasn't used, removed null_field wasn't necessary, removed include/mysql_com.h: Unused defines were removed. libmysql/libmysql.c: Function store_param_type was removed - too much for a function, especially with bug in it. New implementation is inline and takes into account signedness of placeholder. Fixed store functions to not perform double network-host order conversion on high-byte-first systems (should also fix Bug#3578 "Prepared statement integer conversions work wrong in 64-bit Power Mac G5 CPUs"). null_field removed. sql/sql_prepare.cc: Placeholder sign is taken into account when reading data from network. tests/client_test.c: Test for BUG#3035 added: insert and retrieve minimum and maximum of all integer types.
Diffstat (limited to 'include/my_global.h')
-rw-r--r--include/my_global.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/my_global.h b/include/my_global.h
index 6a5b7663c66..7540897e6f4 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -964,10 +964,15 @@ do { doubleget_union _tmp; \
#define float4get(V,M) do { *((long *) &(V)) = *((long*) (M)); } while(0)
#define float8get(V,M) doubleget((V),(M))
#define float4store(V,M) memcpy((byte*) V,(byte*) (&M),sizeof(float))
+#define floatstore(T,V) memcpy((byte*)(T), (byte*)(&V), sizeof(float))
#define float8store(V,M) doublestore((V),(M))
#endif /* __i386__ */
#ifndef sint2korr
+/*
+ We're here if it's not a IA-32 architecture (Win32 and UNIX IA-32 defines
+ were done before)
+*/
#define sint2korr(A) (int16) (((int16) ((uchar) (A)[0])) +\
((int16) ((int16) (A)[1]) << 8))
#define sint3korr(A) ((int32) ((((uchar) (A)[2]) & 128) ? \
@@ -1121,6 +1126,7 @@ do { doubleget_union _tmp; \
*((T)+1)=(((A) >> 16));\
*((T)+0)=(((A) >> 24)); } while(0)
+#define floatstore(T,V) memcpy_fixed((byte*)(T), (byte*)(&V), sizeof(float))
#define doubleget(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(double))
#define doublestore(T,V) memcpy_fixed((byte*) (T),(byte*) &V,sizeof(double))
#define longlongget(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(ulonglong))
@@ -1134,6 +1140,9 @@ do { doubleget_union _tmp; \
#define ulongget(V,M) do { V = uint4korr(M); } while(0)
#define shortstore(T,V) int2store(T,V)
#define longstore(T,V) int4store(T,V)
+#ifndef floatstore
+#define floatstore(T,V) memcpy_fixed((byte*)(T), (byte*)(&V), sizeof(float))
+#endif
#ifndef doubleget
#define doubleget(V,M) memcpy_fixed((byte*) &V,(byte*) (M),sizeof(double))
#define doublestore(T,V) memcpy_fixed((byte*) (T),(byte*) &V,sizeof(double))