Merge 5.0-ndb into local, resolve conflicts

This commit is contained in:
stewart@mysql.com 2004-12-20 11:32:08 +11:00
commit 6cd660dc1a
245 changed files with 10771 additions and 12096 deletions

View file

@ -983,3 +983,6 @@ vio/test-ssl
vio/test-sslclient
vio/test-sslserver
vio/viotest-ssl
extra/mysqld_error.h
extra/sql_state.h
extra/created_include_files

View file

@ -2,6 +2,7 @@ Administrador@light.
Administrator@co3064164-a.
Administrator@co3064164-a.rochd1.qld.optushome.com.au
Administrator@fred.
Administrator@w2k.
Greg@greg-laptop.
Miguel@light.local
Sinisa@sinisa.nasamreza.org
@ -10,6 +11,7 @@ acurtis@pcgem.rdg.cyberkinetica.com
administrador@light.hegel.local
ahlentz@co3064164-a.rochd1.qld.optusnet.com.au
akishkin@work.mysql.com
anjuta@arthur.local
antony@ltantony.dsl-verizon.net
antony@ltantony.rdg.cyberkinetica.com
antony@ltantony.rdg.cyberkinetica.homeunix.net

View file

@ -18,7 +18,7 @@
#AUTOMAKE_OPTIONS = nostdinc
INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/regex \
$(openssl_includes)
$(openssl_includes) -I$(top_srcdir)/extra
LIBS = @CLIENT_LIBS@
DEPLIB= ../libmysql/libmysqlclient.la
LDADD = @CLIENT_EXTRA_LDFLAGS@ $(DEPLIB)

View file

@ -748,7 +748,7 @@ AC_CHECK_HEADERS(fcntl.h float.h floatingpoint.h ieeefp.h limits.h \
strings.h string.h synch.h sys/mman.h sys/socket.h netinet/in.h arpa/inet.h \
sys/timeb.h sys/types.h sys/un.h sys/vadvise.h sys/wait.h term.h \
unistd.h utime.h sys/utime.h termio.h termios.h sched.h crypt.h alloca.h \
sys/ioctl.h malloc.h sys/malloc.h linux/config.h)
sys/ioctl.h malloc.h sys/malloc.h linux/config.h sys/resource.h sys/param.h)
#--------------------------------------------------------------------
# Check for system libraries. Adds the library to $LIBS
@ -2724,6 +2724,7 @@ AC_CONFIG_FILES(ndb/Makefile ndb/include/Makefile dnl
ndb/test/ndbapi/bank/Makefile dnl
ndb/test/tools/Makefile dnl
ndb/test/run-test/Makefile mysql-test/ndb/Makefile dnl
ndb/include/ndb_version.h ndb/include/ndb_global.h dnl
)
fi

View file

@ -15,9 +15,26 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include \
@ndbcluster_includes@ -I$(top_srcdir)/sql
@ndbcluster_includes@ -I$(top_srcdir)/sql \
-I$(top_srcdir)/extra
LDADD = @CLIENT_EXTRA_LDFLAGS@ ../mysys/libmysys.a \
../dbug/libdbug.a ../strings/libmystrings.a
BUILT_SOURCES= mysqld_error.h sql_state.h
pkginclude_HEADERS= $(BUILT_SOURCES)
created_sources = created_include_files
CLEANFILES = $(created_sources)
SUPERCLEANFILES = $(BUILT_SOURCES)
all: $(created_sources)
# This will build mysqld_error.h and sql_state.h
mysqld_error.h: created_include_files
sql_state.h: created_include_files
created_include_files: comp_err
$(top_builddir)/extra/comp_err --charset=$(srcdir)/../sql/share/charsets --out-dir=$(top_builddir)/sql/share/ --header_file=$(top_builddir)/extra/mysqld_error.h --state_file=$(top_builddir)/extra/sql_state.h --in_file=$(srcdir)/../sql/share/errmsg.txt
touch created_include_files
bin_PROGRAMS = replace comp_err perror resolveip my_print_defaults \
resolve_stack_dump mysql_waitpid
noinst_PROGRAMS = charset2html

File diff suppressed because it is too large Load diff

View file

@ -17,12 +17,12 @@
BUILT_SOURCES = mysql_version.h m_ctype.h my_config.h
pkginclude_HEADERS = my_dbug.h m_string.h my_sys.h my_list.h my_xml.h \
mysql.h mysql_com.h mysqld_error.h mysql_embed.h \
mysql.h mysql_com.h mysql_embed.h \
my_semaphore.h my_pthread.h my_no_pthread.h raid.h \
errmsg.h my_global.h my_net.h my_alloc.h \
my_getopt.h sslopt-longopts.h my_dir.h typelib.h \
sslopt-vars.h sslopt-case.h sql_common.h keycache.h \
sql_state.h mysql_time.h $(BUILT_SOURCES)
mysql_time.h $(BUILT_SOURCES)
noinst_HEADERS = config-win.h config-os2.h config-netware.h \
nisam.h heap.h merge.h my_bitmap.h\
myisam.h myisampack.h myisammrg.h ft_global.h\

View file

@ -661,6 +661,7 @@ typedef SOCKET_SIZE_TYPE size_socket;
#define UINT_MAX16 0xFFFF
#define INT_MIN8 (~0x7F)
#define INT_MAX8 0x7F
#define UINT_MAX8 0xFF
/* From limits.h instead */
#ifndef DBL_MIN

View file

@ -52,6 +52,13 @@ typedef long my_time_t;
enum enum_mysql_timestamp_type
str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
uint flags, int *was_cut);
longlong number_to_datetime(longlong nr, MYSQL_TIME *time_res,
my_bool fuzzy_date, int *was_cut);
ulonglong TIME_to_ulonglong_datetime(const MYSQL_TIME *time);
ulonglong TIME_to_ulonglong_date(const MYSQL_TIME *time);
ulonglong TIME_to_ulonglong_time(const MYSQL_TIME *time);
ulonglong TIME_to_ulonglong(const MYSQL_TIME *time);
bool str_to_time(const char *str,uint length, MYSQL_TIME *l_time,
int *was_cut);

View file

@ -537,26 +537,91 @@ enum enum_mysql_stmt_state
};
/* bind structure */
/*
This structure is used to define bind information, and
internally by the client library.
Public members with their descriptions are listed below
(conventionally `On input' refers to the binds given to
mysql_stmt_bind_param, `On output' refers to the binds given
to mysql_stmt_bind_result):
buffer_type - One of the MYSQL_* types, used to describe
the host language type of buffer.
On output: if column type is different from
buffer_type, column value is automatically converted
to buffer_type before it is stored in the buffer.
buffer - On input: points to the buffer with input data.
On output: points to the buffer capable to store
output data.
The type of memory pointed by buffer must correspond
to buffer_type. See the correspondence table in
the comment to mysql_stmt_bind_param.
The two above members are mandatory for any kind of bind.
buffer_length - the length of the buffer. You don't have to set
it for any fixed length buffer: float, double,
int, etc. It must be set however for variable-length
types, such as BLOBs or STRINGs.
length - On input: in case when lengths of input values
are different for each execute, you can set this to
point at a variable containining value length. This
way the value length can be different in each execute.
If length is not NULL, buffer_length is not used.
Note, length can even point at buffer_length if
you keep bind structures around while fetching:
this way you can change buffer_length before
each execution, everything will work ok.
On output: if length is set, mysql_stmt_fetch will
write column length into it.
is_null - On input: points to a boolean variable that should
be set to TRUE for NULL values.
This member is useful only if your data may be
NULL in some but not all cases.
If your data is never NULL, is_null should be set to 0.
If your data is always NULL, set buffer_type
to MYSQL_TYPE_NULL, and is_null will not be used.
is_unsigned - On input: used to signify that values provided for one
of numeric types are unsigned.
On output describes signedness of the output buffer.
If, taking into account is_unsigned flag, column data
is out of range of the output buffer, data for this column
is regarded truncated. Note that this has no correspondence
to the sign of result set column, if you need to find it out
use mysql_stmt_result_metadata.
error - where to write a truncation error if it is present.
possible error value is:
0 no truncation
1 value is out of range or buffer is too small
Please note that MYSQL_BIND also has internals members.
*/
typedef struct st_mysql_bind
{
unsigned long *length; /* output length pointer */
my_bool *is_null; /* Pointer to null indicator */
void *buffer; /* buffer to get/put data */
/* set this if you want to track data truncations happened during fetch */
my_bool *error;
enum enum_field_types buffer_type; /* buffer type */
unsigned long buffer_length; /* buffer length, must be set for str/binary */
/* Following are for internal use. Set by mysql_stmt_bind_param */
unsigned char *inter_buffer; /* for the current data position */
/* output buffer length, must be set when fetching str/binary */
unsigned long buffer_length;
unsigned char *row_ptr; /* for the current data position */
unsigned long offset; /* offset position for char/binary fetch */
unsigned long internal_length; /* Used if length is 0 */
unsigned long length_value; /* Used if length is 0 */
unsigned int param_number; /* For null count and error messages */
unsigned int pack_length; /* Internal length for packed data */
my_bool error_value; /* used if error is 0 */
my_bool is_unsigned; /* set if integer type is unsigned */
my_bool long_data_used; /* If used with mysql_send_long_data */
my_bool internal_is_null; /* Used if is_null is 0 */
my_bool is_null_value; /* Used if is_null is 0 */
void (*store_param_func)(NET *net, struct st_mysql_bind *param);
void (*fetch_result)(struct st_mysql_bind *, unsigned char **row);
void (*fetch_result)(struct st_mysql_bind *, MYSQL_FIELD *,
unsigned char **row);
void (*skip_result)(struct st_mysql_bind *, MYSQL_FIELD *,
unsigned char **row);
} MYSQL_BIND;
@ -598,7 +663,7 @@ typedef struct st_mysql_stmt
/* Types of input parameters should be sent to server */
my_bool send_types_to_server;
my_bool bind_param_done; /* input buffers were supplied */
my_bool bind_result_done; /* output buffers were supplied */
unsigned char bind_result_done; /* output buffers were supplied */
/* mysql_stmt_close() had to cancel this result */
my_bool unbuffered_fetch_cancelled;
/*
@ -704,7 +769,8 @@ void STDCALL mysql_close(MYSQL *sock);
/* status return codes */
#define MYSQL_NO_DATA 100
#define MYSQL_NO_DATA 100
#define MYSQL_DATA_TRUNCATED 101
#define mysql_reload(mysql) mysql_refresh((mysql),REFRESH_GRANT)

View file

@ -1,416 +0,0 @@
/* Copyright (C) 2000 MySQL AB
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; either version 2 of the License, or
(at your option) any later version.
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 Placeo Suite 330, Boston, MA 02111-1307 USA */
/* Definefile for error messagenumbers */
#define ER_HASHCHK 1000
#define ER_NISAMCHK 1001
#define ER_NO 1002
#define ER_YES 1003
#define ER_CANT_CREATE_FILE 1004
#define ER_CANT_CREATE_TABLE 1005
#define ER_CANT_CREATE_DB 1006
#define ER_DB_CREATE_EXISTS 1007
#define ER_DB_DROP_EXISTS 1008
#define ER_DB_DROP_DELETE 1009
#define ER_DB_DROP_RMDIR 1010
#define ER_CANT_DELETE_FILE 1011
#define ER_CANT_FIND_SYSTEM_REC 1012
#define ER_CANT_GET_STAT 1013
#define ER_CANT_GET_WD 1014
#define ER_CANT_LOCK 1015
#define ER_CANT_OPEN_FILE 1016
#define ER_FILE_NOT_FOUND 1017
#define ER_CANT_READ_DIR 1018
#define ER_CANT_SET_WD 1019
#define ER_CHECKREAD 1020
#define ER_DISK_FULL 1021
#define ER_DUP_KEY 1022
#define ER_ERROR_ON_CLOSE 1023
#define ER_ERROR_ON_READ 1024
#define ER_ERROR_ON_RENAME 1025
#define ER_ERROR_ON_WRITE 1026
#define ER_FILE_USED 1027
#define ER_FILSORT_ABORT 1028
#define ER_FORM_NOT_FOUND 1029
#define ER_GET_ERRNO 1030
#define ER_ILLEGAL_HA 1031
#define ER_KEY_NOT_FOUND 1032
#define ER_NOT_FORM_FILE 1033
#define ER_NOT_KEYFILE 1034
#define ER_OLD_KEYFILE 1035
#define ER_OPEN_AS_READONLY 1036
#define ER_OUTOFMEMORY 1037
#define ER_OUT_OF_SORTMEMORY 1038
#define ER_UNEXPECTED_EOF 1039
#define ER_CON_COUNT_ERROR 1040
#define ER_OUT_OF_RESOURCES 1041
#define ER_BAD_HOST_ERROR 1042
#define ER_HANDSHAKE_ERROR 1043
#define ER_DBACCESS_DENIED_ERROR 1044
#define ER_ACCESS_DENIED_ERROR 1045
#define ER_NO_DB_ERROR 1046
#define ER_UNKNOWN_COM_ERROR 1047
#define ER_BAD_NULL_ERROR 1048
#define ER_BAD_DB_ERROR 1049
#define ER_TABLE_EXISTS_ERROR 1050
#define ER_BAD_TABLE_ERROR 1051
#define ER_NON_UNIQ_ERROR 1052
#define ER_SERVER_SHUTDOWN 1053
#define ER_BAD_FIELD_ERROR 1054
#define ER_WRONG_FIELD_WITH_GROUP 1055
#define ER_WRONG_GROUP_FIELD 1056
#define ER_WRONG_SUM_SELECT 1057
#define ER_WRONG_VALUE_COUNT 1058
#define ER_TOO_LONG_IDENT 1059
#define ER_DUP_FIELDNAME 1060
#define ER_DUP_KEYNAME 1061
#define ER_DUP_ENTRY 1062
#define ER_WRONG_FIELD_SPEC 1063
#define ER_PARSE_ERROR 1064
#define ER_EMPTY_QUERY 1065
#define ER_NONUNIQ_TABLE 1066
#define ER_INVALID_DEFAULT 1067
#define ER_MULTIPLE_PRI_KEY 1068
#define ER_TOO_MANY_KEYS 1069
#define ER_TOO_MANY_KEY_PARTS 1070
#define ER_TOO_LONG_KEY 1071
#define ER_KEY_COLUMN_DOES_NOT_EXITS 1072
#define ER_BLOB_USED_AS_KEY 1073
#define ER_TOO_BIG_FIELDLENGTH 1074
#define ER_WRONG_AUTO_KEY 1075
#define ER_READY 1076
#define ER_NORMAL_SHUTDOWN 1077
#define ER_GOT_SIGNAL 1078
#define ER_SHUTDOWN_COMPLETE 1079
#define ER_FORCING_CLOSE 1080
#define ER_IPSOCK_ERROR 1081
#define ER_NO_SUCH_INDEX 1082
#define ER_WRONG_FIELD_TERMINATORS 1083
#define ER_BLOBS_AND_NO_TERMINATED 1084
#define ER_TEXTFILE_NOT_READABLE 1085
#define ER_FILE_EXISTS_ERROR 1086
#define ER_LOAD_INFO 1087
#define ER_ALTER_INFO 1088
#define ER_WRONG_SUB_KEY 1089
#define ER_CANT_REMOVE_ALL_FIELDS 1090
#define ER_CANT_DROP_FIELD_OR_KEY 1091
#define ER_INSERT_INFO 1092
#define ER_UPDATE_TABLE_USED 1093
#define ER_NO_SUCH_THREAD 1094
#define ER_KILL_DENIED_ERROR 1095
#define ER_NO_TABLES_USED 1096
#define ER_TOO_BIG_SET 1097
#define ER_NO_UNIQUE_LOGFILE 1098
#define ER_TABLE_NOT_LOCKED_FOR_WRITE 1099
#define ER_TABLE_NOT_LOCKED 1100
#define ER_BLOB_CANT_HAVE_DEFAULT 1101
#define ER_WRONG_DB_NAME 1102
#define ER_WRONG_TABLE_NAME 1103
#define ER_TOO_BIG_SELECT 1104
#define ER_UNKNOWN_ERROR 1105
#define ER_UNKNOWN_PROCEDURE 1106
#define ER_WRONG_PARAMCOUNT_TO_PROCEDURE 1107
#define ER_WRONG_PARAMETERS_TO_PROCEDURE 1108
#define ER_UNKNOWN_TABLE 1109
#define ER_FIELD_SPECIFIED_TWICE 1110
#define ER_INVALID_GROUP_FUNC_USE 1111
#define ER_UNSUPPORTED_EXTENSION 1112
#define ER_TABLE_MUST_HAVE_COLUMNS 1113
#define ER_RECORD_FILE_FULL 1114
#define ER_UNKNOWN_CHARACTER_SET 1115
#define ER_TOO_MANY_TABLES 1116
#define ER_TOO_MANY_FIELDS 1117
#define ER_TOO_BIG_ROWSIZE 1118
#define ER_STACK_OVERRUN 1119
#define ER_WRONG_OUTER_JOIN 1120
#define ER_NULL_COLUMN_IN_INDEX 1121
#define ER_CANT_FIND_UDF 1122
#define ER_CANT_INITIALIZE_UDF 1123
#define ER_UDF_NO_PATHS 1124
#define ER_UDF_EXISTS 1125
#define ER_CANT_OPEN_LIBRARY 1126
#define ER_CANT_FIND_DL_ENTRY 1127
#define ER_FUNCTION_NOT_DEFINED 1128
#define ER_HOST_IS_BLOCKED 1129
#define ER_HOST_NOT_PRIVILEGED 1130
#define ER_PASSWORD_ANONYMOUS_USER 1131
#define ER_PASSWORD_NOT_ALLOWED 1132
#define ER_PASSWORD_NO_MATCH 1133
#define ER_UPDATE_INFO 1134
#define ER_CANT_CREATE_THREAD 1135
#define ER_WRONG_VALUE_COUNT_ON_ROW 1136
#define ER_CANT_REOPEN_TABLE 1137
#define ER_INVALID_USE_OF_NULL 1138
#define ER_REGEXP_ERROR 1139
#define ER_MIX_OF_GROUP_FUNC_AND_FIELDS 1140
#define ER_NONEXISTING_GRANT 1141
#define ER_TABLEACCESS_DENIED_ERROR 1142
#define ER_COLUMNACCESS_DENIED_ERROR 1143
#define ER_ILLEGAL_GRANT_FOR_TABLE 1144
#define ER_GRANT_WRONG_HOST_OR_USER 1145
#define ER_NO_SUCH_TABLE 1146
#define ER_NONEXISTING_TABLE_GRANT 1147
#define ER_NOT_ALLOWED_COMMAND 1148
#define ER_SYNTAX_ERROR 1149
#define ER_DELAYED_CANT_CHANGE_LOCK 1150
#define ER_TOO_MANY_DELAYED_THREADS 1151
#define ER_ABORTING_CONNECTION 1152
#define ER_NET_PACKET_TOO_LARGE 1153
#define ER_NET_READ_ERROR_FROM_PIPE 1154
#define ER_NET_FCNTL_ERROR 1155
#define ER_NET_PACKETS_OUT_OF_ORDER 1156
#define ER_NET_UNCOMPRESS_ERROR 1157
#define ER_NET_READ_ERROR 1158
#define ER_NET_READ_INTERRUPTED 1159
#define ER_NET_ERROR_ON_WRITE 1160
#define ER_NET_WRITE_INTERRUPTED 1161
#define ER_TOO_LONG_STRING 1162
#define ER_TABLE_CANT_HANDLE_BLOB 1163
#define ER_TABLE_CANT_HANDLE_AUTO_INCREMENT 1164
#define ER_DELAYED_INSERT_TABLE_LOCKED 1165
#define ER_WRONG_COLUMN_NAME 1166
#define ER_WRONG_KEY_COLUMN 1167
#define ER_WRONG_MRG_TABLE 1168
#define ER_DUP_UNIQUE 1169
#define ER_BLOB_KEY_WITHOUT_LENGTH 1170
#define ER_PRIMARY_CANT_HAVE_NULL 1171
#define ER_TOO_MANY_ROWS 1172
#define ER_REQUIRES_PRIMARY_KEY 1173
#define ER_NO_RAID_COMPILED 1174
#define ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE 1175
#define ER_KEY_DOES_NOT_EXITS 1176
#define ER_CHECK_NO_SUCH_TABLE 1177
#define ER_CHECK_NOT_IMPLEMENTED 1178
#define ER_CANT_DO_THIS_DURING_AN_TRANSACTION 1179
#define ER_ERROR_DURING_COMMIT 1180
#define ER_ERROR_DURING_ROLLBACK 1181
#define ER_ERROR_DURING_FLUSH_LOGS 1182
#define ER_ERROR_DURING_CHECKPOINT 1183
#define ER_NEW_ABORTING_CONNECTION 1184
#define ER_DUMP_NOT_IMPLEMENTED 1185
#define ER_FLUSH_MASTER_BINLOG_CLOSED 1186
#define ER_INDEX_REBUILD 1187
#define ER_MASTER 1188
#define ER_MASTER_NET_READ 1189
#define ER_MASTER_NET_WRITE 1190
#define ER_FT_MATCHING_KEY_NOT_FOUND 1191
#define ER_LOCK_OR_ACTIVE_TRANSACTION 1192
#define ER_UNKNOWN_SYSTEM_VARIABLE 1193
#define ER_CRASHED_ON_USAGE 1194
#define ER_CRASHED_ON_REPAIR 1195
#define ER_WARNING_NOT_COMPLETE_ROLLBACK 1196
#define ER_TRANS_CACHE_FULL 1197
#define ER_SLAVE_MUST_STOP 1198
#define ER_SLAVE_NOT_RUNNING 1199
#define ER_BAD_SLAVE 1200
#define ER_MASTER_INFO 1201
#define ER_SLAVE_THREAD 1202
#define ER_TOO_MANY_USER_CONNECTIONS 1203
#define ER_SET_CONSTANTS_ONLY 1204
#define ER_LOCK_WAIT_TIMEOUT 1205
#define ER_LOCK_TABLE_FULL 1206
#define ER_READ_ONLY_TRANSACTION 1207
#define ER_DROP_DB_WITH_READ_LOCK 1208
#define ER_CREATE_DB_WITH_READ_LOCK 1209
#define ER_WRONG_ARGUMENTS 1210
#define ER_NO_PERMISSION_TO_CREATE_USER 1211
#define ER_UNION_TABLES_IN_DIFFERENT_DIR 1212
#define ER_LOCK_DEADLOCK 1213
#define ER_TABLE_CANT_HANDLE_FT 1214
#define ER_CANNOT_ADD_FOREIGN 1215
#define ER_NO_REFERENCED_ROW 1216
#define ER_ROW_IS_REFERENCED 1217
#define ER_CONNECT_TO_MASTER 1218
#define ER_QUERY_ON_MASTER 1219
#define ER_ERROR_WHEN_EXECUTING_COMMAND 1220
#define ER_WRONG_USAGE 1221
#define ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT 1222
#define ER_CANT_UPDATE_WITH_READLOCK 1223
#define ER_MIXING_NOT_ALLOWED 1224
#define ER_DUP_ARGUMENT 1225
#define ER_USER_LIMIT_REACHED 1226
#define ER_SPECIFIC_ACCESS_DENIED_ERROR 1227
#define ER_LOCAL_VARIABLE 1228
#define ER_GLOBAL_VARIABLE 1229
#define ER_NO_DEFAULT 1230
#define ER_WRONG_VALUE_FOR_VAR 1231
#define ER_WRONG_TYPE_FOR_VAR 1232
#define ER_VAR_CANT_BE_READ 1233
#define ER_CANT_USE_OPTION_HERE 1234
#define ER_NOT_SUPPORTED_YET 1235
#define ER_MASTER_FATAL_ERROR_READING_BINLOG 1236
#define ER_SLAVE_IGNORED_TABLE 1237
#define ER_INCORRECT_GLOBAL_LOCAL_VAR 1238
#define ER_WRONG_FK_DEF 1239
#define ER_KEY_REF_DO_NOT_MATCH_TABLE_REF 1240
#define ER_OPERAND_COLUMNS 1241
#define ER_SUBQUERY_NO_1_ROW 1242
#define ER_UNKNOWN_STMT_HANDLER 1243
#define ER_CORRUPT_HELP_DB 1244
#define ER_CYCLIC_REFERENCE 1245
#define ER_AUTO_CONVERT 1246
#define ER_ILLEGAL_REFERENCE 1247
#define ER_DERIVED_MUST_HAVE_ALIAS 1248
#define ER_SELECT_REDUCED 1249
#define ER_TABLENAME_NOT_ALLOWED_HERE 1250
#define ER_NOT_SUPPORTED_AUTH_MODE 1251
#define ER_SPATIAL_CANT_HAVE_NULL 1252
#define ER_COLLATION_CHARSET_MISMATCH 1253
#define ER_SLAVE_WAS_RUNNING 1254
#define ER_SLAVE_WAS_NOT_RUNNING 1255
#define ER_TOO_BIG_FOR_UNCOMPRESS 1256
#define ER_ZLIB_Z_MEM_ERROR 1257
#define ER_ZLIB_Z_BUF_ERROR 1258
#define ER_ZLIB_Z_DATA_ERROR 1259
#define ER_CUT_VALUE_GROUP_CONCAT 1260
#define ER_WARN_TOO_FEW_RECORDS 1261
#define ER_WARN_TOO_MANY_RECORDS 1262
#define ER_WARN_NULL_TO_NOTNULL 1263
#define ER_WARN_DATA_OUT_OF_RANGE 1264
#define ER_WARN_DATA_TRUNCATED 1265
#define ER_WARN_USING_OTHER_HANDLER 1266
#define ER_CANT_AGGREGATE_2COLLATIONS 1267
#define ER_DROP_USER 1268
#define ER_REVOKE_GRANTS 1269
#define ER_CANT_AGGREGATE_3COLLATIONS 1270
#define ER_CANT_AGGREGATE_NCOLLATIONS 1271
#define ER_VARIABLE_IS_NOT_STRUCT 1272
#define ER_UNKNOWN_COLLATION 1273
#define ER_SLAVE_IGNORED_SSL_PARAMS 1274
#define ER_SERVER_IS_IN_SECURE_AUTH_MODE 1275
#define ER_WARN_FIELD_RESOLVED 1276
#define ER_BAD_SLAVE_UNTIL_COND 1277
#define ER_MISSING_SKIP_SLAVE 1278
#define ER_UNTIL_COND_IGNORED 1279
#define ER_WRONG_NAME_FOR_INDEX 1280
#define ER_WRONG_NAME_FOR_CATALOG 1281
#define ER_WARN_QC_RESIZE 1282
#define ER_BAD_FT_COLUMN 1283
#define ER_UNKNOWN_KEY_CACHE 1284
#define ER_WARN_HOSTNAME_WONT_WORK 1285
#define ER_UNKNOWN_STORAGE_ENGINE 1286
#define ER_WARN_DEPRECATED_SYNTAX 1287
#define ER_NON_UPDATABLE_TABLE 1288
#define ER_FEATURE_DISABLED 1289
#define ER_OPTION_PREVENTS_STATEMENT 1290
#define ER_DUPLICATED_VALUE_IN_TYPE 1291
#define ER_TRUNCATED_WRONG_VALUE 1292
#define ER_TOO_MUCH_AUTO_TIMESTAMP_COLS 1293
#define ER_INVALID_ON_UPDATE 1294
#define ER_UNSUPPORTED_PS 1295
#define ER_GET_ERRMSG 1296
#define ER_GET_TEMPORARY_ERRMSG 1297
#define ER_UNKNOWN_TIME_ZONE 1298
#define ER_WARN_INVALID_TIMESTAMP 1299
#define ER_INVALID_CHARACTER_STRING 1300
#define ER_WARN_ALLOWED_PACKET_OVERFLOWED 1301
#define ER_CONFLICTING_DECLARATIONS 1302
#define ER_SP_NO_RECURSIVE_CREATE 1303
#define ER_SP_ALREADY_EXISTS 1304
#define ER_SP_DOES_NOT_EXIST 1305
#define ER_SP_DROP_FAILED 1306
#define ER_SP_STORE_FAILED 1307
#define ER_SP_LILABEL_MISMATCH 1308
#define ER_SP_LABEL_REDEFINE 1309
#define ER_SP_LABEL_MISMATCH 1310
#define ER_SP_UNINIT_VAR 1311
#define ER_SP_BADSELECT 1312
#define ER_SP_BADRETURN 1313
#define ER_SP_BADSTATEMENT 1314
#define ER_UPDATE_LOG_DEPRECATED_IGNORED 1315
#define ER_UPDATE_LOG_DEPRECATED_TRANSLATED 1316
#define ER_QUERY_INTERRUPTED 1317
#define ER_SP_WRONG_NO_OF_ARGS 1318
#define ER_SP_COND_MISMATCH 1319
#define ER_SP_NORETURN 1320
#define ER_SP_NORETURNEND 1321
#define ER_SP_BAD_CURSOR_QUERY 1322
#define ER_SP_BAD_CURSOR_SELECT 1323
#define ER_SP_CURSOR_MISMATCH 1324
#define ER_SP_CURSOR_ALREADY_OPEN 1325
#define ER_SP_CURSOR_NOT_OPEN 1326
#define ER_SP_UNDECLARED_VAR 1327
#define ER_SP_WRONG_NO_OF_FETCH_ARGS 1328
#define ER_SP_FETCH_NO_DATA 1329
#define ER_SP_DUP_PARAM 1330
#define ER_SP_DUP_VAR 1331
#define ER_SP_DUP_COND 1332
#define ER_SP_DUP_CURS 1333
#define ER_SP_CANT_ALTER 1334
#define ER_SP_SUBSELECT_NYI 1335
#define ER_SP_NO_USE 1336
#define ER_SP_VARCOND_AFTER_CURSHNDLR 1337
#define ER_SP_CURSOR_AFTER_HANDLER 1338
#define ER_SP_CASE_NOT_FOUND 1339
#define ER_FPARSER_TOO_BIG_FILE 1340
#define ER_FPARSER_BAD_HEADER 1341
#define ER_FPARSER_EOF_IN_COMMENT 1342
#define ER_FPARSER_ERROR_IN_PARAMETER 1343
#define ER_FPARSER_EOF_IN_UNKNOWN_PARAMETER 1344
#define ER_VIEW_NO_EXPLAIN 1345
#define ER_FRM_UNKNOWN_TYPE 1346
#define ER_WRONG_OBJECT 1347
#define ER_NONUPDATEABLE_COLUMN 1348
#define ER_VIEW_SELECT_DERIVED 1349
#define ER_VIEW_SELECT_CLAUSE 1350
#define ER_VIEW_SELECT_VARIABLE 1351
#define ER_VIEW_SELECT_TMPTABLE 1352
#define ER_VIEW_WRONG_LIST 1353
#define ER_WARN_VIEW_MERGE 1354
#define ER_WARN_VIEW_WITHOUT_KEY 1355
#define ER_VIEW_INVALID 1356
#define ER_SP_NO_DROP_SP 1357
#define ER_SP_GOTO_IN_HNDLR 1358
#define ER_TRG_ALREADY_EXISTS 1359
#define ER_TRG_DOES_NOT_EXIST 1360
#define ER_TRG_ON_VIEW_OR_TEMP_TABLE 1361
#define ER_TRG_CANT_CHANGE_ROW 1362
#define ER_TRG_NO_SUCH_ROW_IN_TRG 1363
#define ER_NO_DEFAULT_FOR_FIELD 1364
#define ER_DIVISION_BY_ZERO 1365
#define ER_TRUNCATED_WRONG_VALUE_FOR_FIELD 1366
#define ER_ILLEGAL_VALUE_FOR_TYPE 1367
#define ER_VIEW_NONUPD_CHECK 1368
#define ER_VIEW_CHECK_FAILED 1369
#define ER_SP_ACCESS_DENIED_ERROR 1370
#define ER_RELAY_LOG_FAIL 1371
#define ER_PASSWD_LENGTH 1372
#define ER_UNKNOWN_TARGET_BINLOG 1373
#define ER_IO_ERR_LOG_INDEX_READ 1374
#define ER_BINLOG_PURGE_PROHIBITED 1375
#define ER_FSEEK_FAIL 1376
#define ER_BINLOG_PURGE_FATAL_ERR 1377
#define ER_LOG_IN_USE 1378
#define ER_LOG_PURGE_UNKNOWN_ERR 1379
#define ER_RELAY_LOG_INIT 1380
#define ER_NO_BINARY_LOGGING 1381
#define ER_RESERVED_SYNTAX 1382
#define ER_WSAS_FAILED 1383
#define ER_DIFF_GROUPS_PROC 1384
#define ER_NO_GROUP_FOR_PROC 1385
#define ER_ORDER_WITH_PROC 1386
#define ER_LOGING_PROHIBIT_CHANGING_OF 1387
#define ER_NO_FILE_MAPPING 1388
#define ER_WRONG_MAGIC 1389
#define ER_PS_MANY_PARAM 1390
#define ER_KEY_PART_0 1391
#define ER_VIEW_CHECKSUM 1392
#define ER_VIEW_MULTIUPDATE 1393
#define ER_VIEW_NO_INSERT_FIELD_LIST 1394
#define ER_VIEW_DELETE_MERGE_VIEW 1395
#define ER_CANNOT_USER 1396
#define ER_ERROR_MESSAGES 397

View file

@ -1,206 +0,0 @@
/* Copyright (C) 2000-2003 MySQL AB
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; either version 2 of the License, or
(at your option) any later version.
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 */
/*
This file includes a mapping from mysql_errno.h to sql_state (as used by
MyODBC) and jdbc_state.
It's suitable to include into a C struct for further processing
The first column is the mysqld server error (declared in mysqld_error.h),
the second column is the ODBC state (which the 4.1 server sends out by
default) and the last is the state used by the JDBC driver.
If the last column is "" then it means that the JDBC driver is using the
ODBC state.
The errors in this file are sorted in the same order as in mysqld_error.h
to allow one to do binary searches for the sqlstate.
*/
ER_DUP_KEY, "23000", "",
ER_OUTOFMEMORY, "HY001", "S1001",
ER_OUT_OF_SORTMEMORY, "HY001", "S1001",
ER_CON_COUNT_ERROR, "08004", "",
ER_BAD_HOST_ERROR, "08S01", "",
ER_HANDSHAKE_ERROR, "08S01", "",
ER_DBACCESS_DENIED_ERROR, "42000", "",
ER_ACCESS_DENIED_ERROR, "28000", "",
ER_NO_DB_ERROR, "3D000", "",
ER_UNKNOWN_COM_ERROR, "08S01", "",
ER_BAD_NULL_ERROR, "23000", "",
ER_BAD_DB_ERROR, "42000", "",
ER_TABLE_EXISTS_ERROR, "42S01", "",
ER_BAD_TABLE_ERROR, "42S02", "",
ER_NON_UNIQ_ERROR, "23000", "",
ER_SERVER_SHUTDOWN, "08S01", "",
ER_BAD_FIELD_ERROR, "42S22", "S0022",
ER_WRONG_FIELD_WITH_GROUP, "42000", "S1009",
ER_WRONG_GROUP_FIELD, "42000", "S1009",
ER_WRONG_SUM_SELECT, "42000", "S1009",
ER_WRONG_VALUE_COUNT, "21S01", "",
ER_TOO_LONG_IDENT, "42000", "S1009",
ER_DUP_FIELDNAME, "42S21", "S1009",
ER_DUP_KEYNAME, "42000", "S1009",
ER_DUP_ENTRY, "23000", "S1009",
ER_WRONG_FIELD_SPEC, "42000", "S1009",
ER_PARSE_ERROR, "42000", "",
ER_EMPTY_QUERY, "42000" , "",
ER_NONUNIQ_TABLE, "42000", "S1009",
ER_INVALID_DEFAULT, "42000", "S1009",
ER_MULTIPLE_PRI_KEY, "42000", "S1009",
ER_TOO_MANY_KEYS, "42000", "S1009",
ER_TOO_MANY_KEY_PARTS, "42000", "S1009",
ER_TOO_LONG_KEY, "42000", "S1009",
ER_KEY_COLUMN_DOES_NOT_EXITS, "42000", "S1009",
ER_BLOB_USED_AS_KEY, "42000", "S1009",
ER_TOO_BIG_FIELDLENGTH, "42000", "S1009",
ER_WRONG_AUTO_KEY, "42000", "S1009",
ER_FORCING_CLOSE, "08S01", "",
ER_IPSOCK_ERROR, "08S01", "",
ER_NO_SUCH_INDEX, "42S12", "S1009",
ER_WRONG_FIELD_TERMINATORS, "42000", "S1009",
ER_BLOBS_AND_NO_TERMINATED, "42000", "S1009",
ER_CANT_REMOVE_ALL_FIELDS, "42000", "",
ER_CANT_DROP_FIELD_OR_KEY, "42000", "",
ER_BLOB_CANT_HAVE_DEFAULT, "42000", "",
ER_WRONG_DB_NAME, "42000", "",
ER_WRONG_TABLE_NAME, "42000", "",
ER_TOO_BIG_SELECT, "42000", "",
ER_UNKNOWN_PROCEDURE, "42000", "",
ER_WRONG_PARAMCOUNT_TO_PROCEDURE, "42000", "",
ER_UNKNOWN_TABLE, "42S02", "",
ER_FIELD_SPECIFIED_TWICE, "42000", "",
ER_UNSUPPORTED_EXTENSION, "42000", "",
ER_TABLE_MUST_HAVE_COLUMNS, "42000", "",
ER_UNKNOWN_CHARACTER_SET, "42000", "",
ER_TOO_BIG_ROWSIZE, "42000", "",
ER_WRONG_OUTER_JOIN, "42000", "",
ER_NULL_COLUMN_IN_INDEX, "42000", "",
ER_PASSWORD_ANONYMOUS_USER, "42000", "",
ER_PASSWORD_NOT_ALLOWED, "42000", "",
ER_PASSWORD_NO_MATCH, "42000", "",
ER_WRONG_VALUE_COUNT_ON_ROW, "21S01", "",
ER_INVALID_USE_OF_NULL, "22004", "",
ER_REGEXP_ERROR, "42000", "",
ER_MIX_OF_GROUP_FUNC_AND_FIELDS,"42000", "",
ER_NONEXISTING_GRANT, "42000", "",
ER_TABLEACCESS_DENIED_ERROR, "42000", "",
ER_COLUMNACCESS_DENIED_ERROR, "42000", "",
ER_ILLEGAL_GRANT_FOR_TABLE, "42000", "",
ER_GRANT_WRONG_HOST_OR_USER, "42000", "",
ER_NO_SUCH_TABLE, "42S02", "",
ER_NONEXISTING_TABLE_GRANT, "42000", "",
ER_NOT_ALLOWED_COMMAND, "42000", "",
ER_SYNTAX_ERROR, "42000", "",
ER_ABORTING_CONNECTION, "08S01", "",
ER_NET_PACKET_TOO_LARGE, "08S01", "",
ER_NET_READ_ERROR_FROM_PIPE, "08S01", "",
ER_NET_FCNTL_ERROR, "08S01", "",
ER_NET_PACKETS_OUT_OF_ORDER, "08S01", "",
ER_NET_UNCOMPRESS_ERROR, "08S01", "",
ER_NET_READ_ERROR, "08S01", "",
ER_NET_READ_INTERRUPTED, "08S01", "",
ER_NET_ERROR_ON_WRITE, "08S01", "",
ER_NET_WRITE_INTERRUPTED, "08S01", "",
ER_TOO_LONG_STRING, "42000", "",
ER_TABLE_CANT_HANDLE_BLOB, "42000", "",
ER_TABLE_CANT_HANDLE_AUTO_INCREMENT, "42000", "",
ER_WRONG_COLUMN_NAME, "42000", "",
ER_WRONG_KEY_COLUMN, "42000", "",
ER_DUP_UNIQUE, "23000", "",
ER_BLOB_KEY_WITHOUT_LENGTH, "42000", "",
ER_PRIMARY_CANT_HAVE_NULL, "42000", "",
ER_TOO_MANY_ROWS, "42000", "",
ER_REQUIRES_PRIMARY_KEY, "42000", "",
ER_CHECK_NO_SUCH_TABLE, "42000", "",
ER_CHECK_NOT_IMPLEMENTED, "42000", "",
ER_CANT_DO_THIS_DURING_AN_TRANSACTION, "25000", "",
ER_NEW_ABORTING_CONNECTION, "08S01", "",
ER_MASTER_NET_READ, "08S01", "",
ER_MASTER_NET_WRITE, "08S01", "",
ER_TOO_MANY_USER_CONNECTIONS, "42000", "",
ER_READ_ONLY_TRANSACTION, "25000", "",
ER_NO_PERMISSION_TO_CREATE_USER,"42000", "",
ER_LOCK_DEADLOCK, "40001", "",
ER_NO_REFERENCED_ROW, "23000", "",
ER_ROW_IS_REFERENCED, "23000", "",
ER_CONNECT_TO_MASTER, "08S01", "",
ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT,"21000", "",
ER_USER_LIMIT_REACHED, "42000", "",
ER_NO_DEFAULT, "42000", "",
ER_WRONG_VALUE_FOR_VAR, "42000", "",
ER_WRONG_TYPE_FOR_VAR, "42000", "",
ER_CANT_USE_OPTION_HERE, "42000", "",
ER_NOT_SUPPORTED_YET, "42000", "",
ER_WRONG_FK_DEF, "42000", "",
ER_OPERAND_COLUMNS, "21000", "",
ER_SUBQUERY_NO_1_ROW, "21000", "",
ER_ILLEGAL_REFERENCE, "42S22", "",
ER_DERIVED_MUST_HAVE_ALIAS, "42000", "",
ER_SELECT_REDUCED, "01000", "",
ER_TABLENAME_NOT_ALLOWED_HERE, "42000", "",
ER_NOT_SUPPORTED_AUTH_MODE, "08004", "",
ER_SPATIAL_CANT_HAVE_NULL, "42000", "",
ER_COLLATION_CHARSET_MISMATCH, "42000", "",
ER_WARN_TOO_FEW_RECORDS, "01000", "",
ER_WARN_TOO_MANY_RECORDS, "01000", "",
ER_WARN_NULL_TO_NOTNULL, "22004", "",
ER_WARN_DATA_OUT_OF_RANGE, "22003", "",
ER_WARN_DATA_TRUNCATED, "01000", "",
ER_WRONG_NAME_FOR_INDEX, "42000", "",
ER_WRONG_NAME_FOR_CATALOG, "42000", "",
ER_UNKNOWN_STORAGE_ENGINE, "42000", "",
ER_TRUNCATED_WRONG_VALUE, "22007", "",
/* 5.0 */
ER_SP_NO_RECURSIVE_CREATE, "2F003", "",
ER_SP_ALREADY_EXISTS, "42000", "",
ER_SP_DOES_NOT_EXIST, "42000", "",
/*ER_SP_DROP_FAILED*/
/*ER_SP_STORE_FAILED*/
ER_SP_LILABEL_MISMATCH, "42000", "",
ER_SP_LABEL_REDEFINE, "42000", "",
ER_SP_LABEL_MISMATCH, "42000", "",
ER_SP_UNINIT_VAR, "01000", "",
ER_SP_BADSELECT, "0A000", "",
ER_SP_BADRETURN, "42000", "",
ER_SP_BADSTATEMENT, "0A000", "",
ER_UPDATE_LOG_DEPRECATED_IGNORED, "42000", "",
ER_UPDATE_LOG_DEPRECATED_TRANSLATED, "42000", "",
ER_QUERY_INTERRUPTED, "70100", "",
ER_SP_WRONG_NO_OF_ARGS, "42000", "",
ER_SP_COND_MISMATCH, "42000", "",
ER_SP_NORETURN, "42000", "",
ER_SP_NORETURNEND, "2F005", "",
ER_SP_BAD_CURSOR_QUERY, "42000", "",
ER_SP_BAD_CURSOR_SELECT, "42000", "",
ER_SP_CURSOR_MISMATCH, "42000", "",
ER_SP_CURSOR_ALREADY_OPEN, "24000", "",
ER_SP_CURSOR_NOT_OPEN, "24000", "",
ER_SP_UNDECLARED_VAR, "42000", "",
/*ER_SP_WRONG_NO_OF_FETCH_ARGS*/
ER_SP_FETCH_NO_DATA, "02000", "",
ER_SP_DUP_PARAM, "42000", "",
ER_SP_DUP_VAR, "42000", "",
ER_SP_DUP_COND, "42000", "",
ER_SP_DUP_CURS, "42000", "",
/*ER_SP_CANT_ALTER*/
ER_SP_SUBSELECT_NYI, "0A000", "",
ER_SP_NO_USE, "42000", "",
ER_SP_VARCOND_AFTER_CURSHNDLR, "42000", "",
ER_SP_CURSOR_AFTER_HANDLER, "42000", "",
ER_SP_CASE_NOT_FOUND, "20000", "",
ER_DIVISION_BY_ZERO, "22012", "",
ER_ILLEGAL_VALUE_FOR_TYPE, "22007", "",
ER_SP_ACCESS_DENIED_ERROR, "42000", "",

View file

@ -23,7 +23,8 @@
target = libmysqlclient.la
target_defs = -DUNDEF_THREADS_HACK -DDONT_USE_RAID @LIB_EXTRA_CCFLAGS@
LIBS = @CLIENT_LIBS@
INCLUDES = -I$(top_srcdir)/include $(openssl_includes) @ZLIB_INCLUDES@
INCLUDES = -I$(top_srcdir)/include $(openssl_includes) @ZLIB_INCLUDES@ \
-I$(top_srcdir)/extra
include $(srcdir)/Makefile.shared

View file

@ -1737,6 +1737,7 @@ static int stmt_read_row_no_data(MYSQL_STMT *stmt, unsigned char **row);
STMT_ATTR_UPDATE_MAX_LENGTH attribute is set.
*/
static void stmt_update_metadata(MYSQL_STMT *stmt, MYSQL_ROWS *data);
static bool setup_one_fetch_function(MYSQL_BIND *bind, MYSQL_FIELD *field);
/*
Maximum sizes of MYSQL_TYPE_DATE, MYSQL_TYPE_TIME, MYSQL_TYPE_DATETIME
@ -1760,6 +1761,20 @@ static void stmt_update_metadata(MYSQL_STMT *stmt, MYSQL_ROWS *data);
#define MAX_DOUBLE_STRING_REP_LENGTH 331
/* A macro to check truncation errors */
#define IS_TRUNCATED(value, is_unsigned, min, max, umax) \
((is_unsigned) ? (((value) > (umax) || (value) < 0) ? 1 : 0) : \
(((value) > (max) || (value) < (min)) ? 1 : 0))
#define BIND_RESULT_DONE 1
/*
We report truncations only if at least one of MYSQL_BIND::error
pointers is set. In this case stmt->bind_result_done |-ed with
this flag.
*/
#define REPORT_DATA_TRUNCATION 2
/**************** Misc utility functions ****************************/
/*
@ -2121,6 +2136,7 @@ static void update_stmt_fields(MYSQL_STMT *stmt)
MYSQL_FIELD *field= stmt->mysql->fields;
MYSQL_FIELD *field_end= field + stmt->field_count;
MYSQL_FIELD *stmt_field= stmt->fields;
MYSQL_BIND *bind= stmt->bind_result_done ? stmt->bind : 0;
DBUG_ASSERT(stmt->field_count == stmt->mysql->field_count);
@ -2131,6 +2147,11 @@ static void update_stmt_fields(MYSQL_STMT *stmt)
stmt_field->type = field->type;
stmt_field->flags = field->flags;
stmt_field->decimals = field->decimals;
if (bind)
{
/* Ignore return value: it should be 0 if bind_result succeeded. */
(void) setup_one_fetch_function(bind++, stmt_field);
}
}
}
@ -3407,6 +3428,7 @@ static void fetch_string_with_conversion(MYSQL_BIND *param, char *value,
{
char *buffer= (char *)param->buffer;
int err= 0;
char *endptr;
/*
This function should support all target buffer types: the rest
@ -3417,42 +3439,54 @@ static void fetch_string_with_conversion(MYSQL_BIND *param, char *value,
break;
case MYSQL_TYPE_TINY:
{
uchar data= (uchar) my_strntol(&my_charset_latin1, value, length, 10,
NULL, &err);
*buffer= data;
longlong data= my_strntoll(&my_charset_latin1, value, length, 10,
&endptr, &err);
*param->error= (IS_TRUNCATED(data, param->is_unsigned,
INT_MIN8, INT_MAX8, UINT_MAX8) |
test(err));
*buffer= (uchar) data;
break;
}
case MYSQL_TYPE_SHORT:
{
short data= (short) my_strntol(&my_charset_latin1, value, length, 10,
NULL, &err);
shortstore(buffer, data);
longlong data= my_strntoll(&my_charset_latin1, value, length, 10,
&endptr, &err);
*param->error= (IS_TRUNCATED(data, param->is_unsigned,
INT_MIN16, INT_MAX16, UINT_MAX16) |
test(err));
shortstore(buffer, (short) data);
break;
}
case MYSQL_TYPE_LONG:
{
int32 data= (int32)my_strntol(&my_charset_latin1, value, length, 10,
NULL, &err);
longstore(buffer, data);
longlong data= my_strntoll(&my_charset_latin1, value, length, 10,
&endptr, &err);
*param->error= (IS_TRUNCATED(data, param->is_unsigned,
INT_MIN32, INT_MAX32, UINT_MAX32) |
test(err));
longstore(buffer, (int32) data);
break;
}
case MYSQL_TYPE_LONGLONG:
{
longlong data= my_strntoll(&my_charset_latin1, value, length, 10,
NULL, &err);
&endptr, &err);
*param->error= test(err);
longlongstore(buffer, data);
break;
}
case MYSQL_TYPE_FLOAT:
{
float data = (float) my_strntod(&my_charset_latin1, value, length,
NULL, &err);
floatstore(buffer, data);
double data= my_strntod(&my_charset_latin1, value, length, &endptr, &err);
float fdata= (float) data;
*param->error= (fdata != data) | test(err);
floatstore(buffer, fdata);
break;
}
case MYSQL_TYPE_DOUBLE:
{
double data= my_strntod(&my_charset_latin1, value, length, NULL, &err);
double data= my_strntod(&my_charset_latin1, value, length, &endptr, &err);
*param->error= test(err);
doublestore(buffer, data);
break;
}
@ -3460,6 +3494,7 @@ static void fetch_string_with_conversion(MYSQL_BIND *param, char *value,
{
MYSQL_TIME *tm= (MYSQL_TIME *)buffer;
str_to_time(value, length, tm, &err);
*param->error= test(err);
break;
}
case MYSQL_TYPE_DATE:
@ -3467,7 +3502,9 @@ static void fetch_string_with_conversion(MYSQL_BIND *param, char *value,
case MYSQL_TYPE_TIMESTAMP:
{
MYSQL_TIME *tm= (MYSQL_TIME *)buffer;
str_to_datetime(value, length, tm, 0, &err);
(void) str_to_datetime(value, length, tm, 0, &err);
*param->error= test(err) && (param->buffer_type == MYSQL_TYPE_DATE &&
tm->time_type != MYSQL_TIMESTAMP_DATE);
break;
}
case MYSQL_TYPE_TINY_BLOB:
@ -3494,6 +3531,7 @@ static void fetch_string_with_conversion(MYSQL_BIND *param, char *value,
copy_length= 0;
if (copy_length < param->buffer_length)
buffer[copy_length]= '\0';
*param->error= copy_length > param->buffer_length;
/*
param->length will always contain length of entire column;
number of copied bytes may be way different:
@ -3525,31 +3563,66 @@ static void fetch_long_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
case MYSQL_TYPE_NULL: /* do nothing */
break;
case MYSQL_TYPE_TINY:
*param->error= IS_TRUNCATED(value, param->is_unsigned,
INT_MIN8, INT_MAX8, UINT_MAX8);
*(uchar *)param->buffer= (uchar) value;
break;
case MYSQL_TYPE_SHORT:
shortstore(buffer, value);
*param->error= IS_TRUNCATED(value, param->is_unsigned,
INT_MIN16, INT_MAX16, UINT_MAX16);
shortstore(buffer, (short) value);
break;
case MYSQL_TYPE_LONG:
longstore(buffer, value);
*param->error= IS_TRUNCATED(value, param->is_unsigned,
INT_MIN32, INT_MAX32, UINT_MAX32);
longstore(buffer, (int32) value);
break;
case MYSQL_TYPE_LONGLONG:
longlongstore(buffer, value);
break;
case MYSQL_TYPE_FLOAT:
{
float data= field_is_unsigned ? (float) ulonglong2double(value) :
(float) value;
float data;
if (field_is_unsigned)
{
data= (float) ulonglong2double(value);
*param->error= (ulonglong) data != (ulonglong) value;
}
else
{
data= (float) value;
/* printf("%lld, %f\n", value, data); */
*param->error= value != ((longlong) data);
}
floatstore(buffer, data);
break;
}
case MYSQL_TYPE_DOUBLE:
{
double data= field_is_unsigned ? ulonglong2double(value) :
(double) value;
double data;
if (field_is_unsigned)
{
data= ulonglong2double(value);
*param->error= (ulonglong) data != (ulonglong) value;
}
else
{
data= value;
*param->error= (longlong) data != value;
}
doublestore(buffer, data);
break;
}
case MYSQL_TYPE_TIME:
case MYSQL_TYPE_DATE:
case MYSQL_TYPE_TIMESTAMP:
case MYSQL_TYPE_DATETIME:
{
int error;
value= number_to_datetime(value, (MYSQL_TIME *) buffer, 1, &error);
*param->error= test(error);
break;
}
default:
{
char buff[22]; /* Enough for longlong */
@ -3592,23 +3665,73 @@ static void fetch_float_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
case MYSQL_TYPE_NULL: /* do nothing */
break;
case MYSQL_TYPE_TINY:
*buffer= (uchar)value;
{
if (param->is_unsigned)
{
int8 data= (int8) value;
*param->error= (double) data != value;
*buffer= (uchar) data;
}
else
{
uchar data= (uchar) value;
*param->error= (double) data != value;
*buffer= data;
}
break;
}
case MYSQL_TYPE_SHORT:
shortstore(buffer, (short)value);
{
if (param->is_unsigned)
{
ushort data= (ushort) value;
*param->error= (double) data != value;
shortstore(buffer, data);
}
else
{
short data= (short) value;
*param->error= (double) data != value;
shortstore(buffer, data);
}
break;
}
case MYSQL_TYPE_LONG:
longstore(buffer, (long)value);
{
if (param->is_unsigned)
{
uint32 data= (uint32) value;
*param->error= (double) data != value;
longstore(buffer, data);
}
else
{
int32 data= (int32) value;
*param->error= (double) data != value;
longstore(buffer, data);
}
break;
}
case MYSQL_TYPE_LONGLONG:
{
longlong val= (longlong) value;
longlongstore(buffer, val);
if (param->is_unsigned)
{
ulonglong data= (ulonglong) value;
*param->error= (double) data != value;
longlongstore(buffer, data);
}
else
{
longlong data= (longlong) value;
*param->error= (double) data != value;
longlongstore(buffer, data);
}
break;
}
case MYSQL_TYPE_FLOAT:
{
float data= (float) value;
*param->error= data != value;
floatstore(buffer, data);
break;
}
@ -3663,18 +3786,45 @@ static void fetch_float_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
*/
static void fetch_datetime_with_conversion(MYSQL_BIND *param,
MYSQL_FIELD *field,
MYSQL_TIME *time)
{
switch (param->buffer_type) {
case MYSQL_TYPE_NULL: /* do nothing */
break;
case MYSQL_TYPE_DATE:
*(MYSQL_TIME *)(param->buffer)= *time;
*param->error= time->time_type != MYSQL_TIMESTAMP_DATE;
break;
case MYSQL_TYPE_TIME:
*(MYSQL_TIME *)(param->buffer)= *time;
*param->error= time->time_type != MYSQL_TIMESTAMP_TIME;
break;
case MYSQL_TYPE_DATETIME:
case MYSQL_TYPE_TIMESTAMP:
/* XXX: should we copy only relevant members here? */
*(MYSQL_TIME *)(param->buffer)= *time;
/* No error: time and date are compatible with datetime */
break;
case MYSQL_TYPE_YEAR:
shortstore(param->buffer, time->year);
*param->error= 1;
break;
case MYSQL_TYPE_FLOAT:
case MYSQL_TYPE_DOUBLE:
{
ulonglong value= TIME_to_ulonglong(time);
return fetch_float_with_conversion(param, field,
ulonglong2double(value), DBL_DIG);
}
case MYSQL_TYPE_TINY:
case MYSQL_TYPE_SHORT:
case MYSQL_TYPE_INT24:
case MYSQL_TYPE_LONG:
case MYSQL_TYPE_LONGLONG:
{
longlong value= (longlong) TIME_to_ulonglong(time);
return fetch_long_with_conversion(param, field, value);
}
default:
{
/*
@ -3772,7 +3922,7 @@ static void fetch_result_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
MYSQL_TIME tm;
read_binary_date(&tm, row);
fetch_datetime_with_conversion(param, &tm);
fetch_datetime_with_conversion(param, field, &tm);
break;
}
case MYSQL_TYPE_TIME:
@ -3780,7 +3930,7 @@ static void fetch_result_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
MYSQL_TIME tm;
read_binary_time(&tm, row);
fetch_datetime_with_conversion(param, &tm);
fetch_datetime_with_conversion(param, field, &tm);
break;
}
case MYSQL_TYPE_DATETIME:
@ -3789,7 +3939,7 @@ static void fetch_result_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
MYSQL_TIME tm;
read_binary_datetime(&tm, row);
fetch_datetime_with_conversion(param, &tm);
fetch_datetime_with_conversion(param, field, &tm);
break;
}
default:
@ -3822,34 +3972,51 @@ static void fetch_result_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
none
*/
static void fetch_result_tinyint(MYSQL_BIND *param, uchar **row)
static void fetch_result_tinyint(MYSQL_BIND *param, MYSQL_FIELD *field,
uchar **row)
{
*(uchar *)param->buffer= **row;
my_bool field_is_unsigned= test(field->flags & UNSIGNED_FLAG);
uchar data= **row;
*(uchar *)param->buffer= data;
*param->error= param->is_unsigned != field_is_unsigned && data > INT_MAX8;
(*row)++;
}
static void fetch_result_short(MYSQL_BIND *param, uchar **row)
static void fetch_result_short(MYSQL_BIND *param, MYSQL_FIELD *field,
uchar **row)
{
short value = (short)sint2korr(*row);
shortstore(param->buffer, value);
my_bool field_is_unsigned= test(field->flags & UNSIGNED_FLAG);
ushort data= (ushort) sint2korr(*row);
shortstore(param->buffer, data);
*param->error= param->is_unsigned != field_is_unsigned && data > INT_MAX16;
*row+= 2;
}
static void fetch_result_int32(MYSQL_BIND *param, uchar **row)
static void fetch_result_int32(MYSQL_BIND *param,
MYSQL_FIELD *field __attribute__((unused)),
uchar **row)
{
int32 value= (int32)sint4korr(*row);
longstore(param->buffer, value);
my_bool field_is_unsigned= test(field->flags & UNSIGNED_FLAG);
uint32 data= (uint32) sint4korr(*row);
longstore(param->buffer, data);
*param->error= param->is_unsigned != field_is_unsigned && data > INT_MAX32;
*row+= 4;
}
static void fetch_result_int64(MYSQL_BIND *param, uchar **row)
static void fetch_result_int64(MYSQL_BIND *param,
MYSQL_FIELD *field __attribute__((unused)),
uchar **row)
{
longlong value= (longlong)sint8korr(*row);
longlongstore(param->buffer, value);
my_bool field_is_unsigned= test(field->flags & UNSIGNED_FLAG);
ulonglong data= (ulonglong) sint8korr(*row);
*param->error= param->is_unsigned != field_is_unsigned && data > LONGLONG_MAX;
longlongstore(param->buffer, data);
*row+= 8;
}
static void fetch_result_float(MYSQL_BIND *param, uchar **row)
static void fetch_result_float(MYSQL_BIND *param,
MYSQL_FIELD *field __attribute__((unused)),
uchar **row)
{
float value;
float4get(value,*row);
@ -3857,7 +4024,9 @@ static void fetch_result_float(MYSQL_BIND *param, uchar **row)
*row+= 4;
}
static void fetch_result_double(MYSQL_BIND *param, uchar **row)
static void fetch_result_double(MYSQL_BIND *param,
MYSQL_FIELD *field __attribute__((unused)),
uchar **row)
{
double value;
float8get(value,*row);
@ -3865,34 +4034,45 @@ static void fetch_result_double(MYSQL_BIND *param, uchar **row)
*row+= 8;
}
static void fetch_result_time(MYSQL_BIND *param, uchar **row)
static void fetch_result_time(MYSQL_BIND *param,
MYSQL_FIELD *field __attribute__((unused)),
uchar **row)
{
MYSQL_TIME *tm= (MYSQL_TIME *)param->buffer;
read_binary_time(tm, row);
}
static void fetch_result_date(MYSQL_BIND *param, uchar **row)
static void fetch_result_date(MYSQL_BIND *param,
MYSQL_FIELD *field __attribute__((unused)),
uchar **row)
{
MYSQL_TIME *tm= (MYSQL_TIME *)param->buffer;
read_binary_date(tm, row);
}
static void fetch_result_datetime(MYSQL_BIND *param, uchar **row)
static void fetch_result_datetime(MYSQL_BIND *param,
MYSQL_FIELD *field __attribute__((unused)),
uchar **row)
{
MYSQL_TIME *tm= (MYSQL_TIME *)param->buffer;
read_binary_datetime(tm, row);
}
static void fetch_result_bin(MYSQL_BIND *param, uchar **row)
static void fetch_result_bin(MYSQL_BIND *param,
MYSQL_FIELD *field __attribute__((unused)),
uchar **row)
{
ulong length= net_field_length(row);
ulong copy_length= min(length, param->buffer_length);
memcpy(param->buffer, (char *)*row, copy_length);
*param->length= length;
*param->error= copy_length < length;
*row+= length;
}
static void fetch_result_str(MYSQL_BIND *param, uchar **row)
static void fetch_result_str(MYSQL_BIND *param,
MYSQL_FIELD *field __attribute__((unused)),
uchar **row)
{
ulong length= net_field_length(row);
ulong copy_length= min(length, param->buffer_length);
@ -3901,6 +4081,7 @@ static void fetch_result_str(MYSQL_BIND *param, uchar **row)
if (copy_length != param->buffer_length)
((uchar *)param->buffer)[copy_length]= '\0';
*param->length= length; /* return total length */
*param->error= copy_length < length;
*row+= length;
}
@ -3941,6 +4122,214 @@ static void skip_result_string(MYSQL_BIND *param __attribute__((unused)),
}
/*
Check that two field types are binary compatible i. e.
have equal representation in the binary protocol and
require client-side buffers of the same type.
SYNOPSIS
is_binary_compatible()
type1 parameter type supplied by user
type2 field type, obtained from result set metadata
RETURN
TRUE or FALSE
*/
static my_bool is_binary_compatible(enum enum_field_types type1,
enum enum_field_types type2)
{
static const enum enum_field_types
range1[]= { MYSQL_TYPE_SHORT, MYSQL_TYPE_YEAR, 0 },
range2[]= { MYSQL_TYPE_INT24, MYSQL_TYPE_LONG, 0 },
range3[]= { MYSQL_TYPE_DATETIME, MYSQL_TYPE_TIMESTAMP, 0 },
range4[]= { MYSQL_TYPE_ENUM, MYSQL_TYPE_SET, MYSQL_TYPE_TINY_BLOB,
MYSQL_TYPE_MEDIUM_BLOB, MYSQL_TYPE_LONG_BLOB, MYSQL_TYPE_BLOB,
MYSQL_TYPE_VAR_STRING, MYSQL_TYPE_STRING, MYSQL_TYPE_GEOMETRY,
MYSQL_TYPE_DECIMAL, 0 },
*range_list[]= { range1, range2, range3, range4 },
**range_list_end= range_list + sizeof(range_list)/sizeof(*range_list);
const enum enum_field_types **range, *type;
if (type1 == type2)
return TRUE;
for (range= range_list; range != range_list_end; ++range)
{
/* check that both type1 and type2 are in the same range */
bool type1_found= FALSE, type2_found= FALSE;
for (type= *range; *type; type++)
{
type1_found|= type1 == *type;
type2_found|= type2 == *type;
}
if (type1_found || type2_found)
return type1_found && type2_found;
}
return FALSE;
}
/*
Setup a fetch function for one column of a result set.
SYNOPSIS
setup_one_fetch_function()
param output buffer descriptor
field column descriptor
DESCRIPTION
When user binds result set buffers or when result set
metadata is changed, we need to setup fetch (and possibly
conversion) functions for all columns of the result set.
In addition to that here we set up skip_result function, used
to update result set metadata in case when
STMT_ATTR_UPDATE_MAX_LENGTH attribute is set.
Notice that while fetch_result is chosen depending on both
field->type and param->type, skip_result depends on field->type
only.
RETURN
TRUE fetch function for this typecode was not found (typecode
is not supported by the client library)
FALSE success
*/
static my_bool setup_one_fetch_function(MYSQL_BIND *param, MYSQL_FIELD *field)
{
/* Setup data copy functions for the different supported types */
switch (param->buffer_type) {
case MYSQL_TYPE_NULL: /* for dummy binds */
/*
It's not binary compatible with anything the server can return:
no need to setup fetch_result, as it'll be reset anyway
*/
*param->length= 0;
break;
case MYSQL_TYPE_TINY:
param->fetch_result= fetch_result_tinyint;
*param->length= 1;
break;
case MYSQL_TYPE_SHORT:
case MYSQL_TYPE_YEAR:
param->fetch_result= fetch_result_short;
*param->length= 2;
break;
case MYSQL_TYPE_INT24:
case MYSQL_TYPE_LONG:
param->fetch_result= fetch_result_int32;
*param->length= 4;
break;
case MYSQL_TYPE_LONGLONG:
param->fetch_result= fetch_result_int64;
*param->length= 8;
break;
case MYSQL_TYPE_FLOAT:
param->fetch_result= fetch_result_float;
*param->length= 4;
break;
case MYSQL_TYPE_DOUBLE:
param->fetch_result= fetch_result_double;
*param->length= 8;
break;
case MYSQL_TYPE_TIME:
param->fetch_result= fetch_result_time;
*param->length= sizeof(MYSQL_TIME);
break;
case MYSQL_TYPE_DATE:
param->fetch_result= fetch_result_date;
*param->length= sizeof(MYSQL_TIME);
break;
case MYSQL_TYPE_DATETIME:
case MYSQL_TYPE_TIMESTAMP:
param->fetch_result= fetch_result_datetime;
*param->length= sizeof(MYSQL_TIME);
break;
case MYSQL_TYPE_TINY_BLOB:
case MYSQL_TYPE_MEDIUM_BLOB:
case MYSQL_TYPE_LONG_BLOB:
case MYSQL_TYPE_BLOB:
DBUG_ASSERT(param->buffer_length != 0);
param->fetch_result= fetch_result_bin;
break;
case MYSQL_TYPE_VAR_STRING:
case MYSQL_TYPE_STRING:
DBUG_ASSERT(param->buffer_length != 0);
param->fetch_result= fetch_result_str;
break;
default:
return TRUE;
}
if (! is_binary_compatible(param->buffer_type, field->type))
param->fetch_result= fetch_result_with_conversion;
/* Setup skip_result functions (to calculate max_length) */
param->skip_result= skip_result_fixed;
switch (field->type) {
case MYSQL_TYPE_NULL: /* for dummy binds */
param->pack_length= 0;
field->max_length= 0;
break;
case MYSQL_TYPE_TINY:
param->pack_length= 1;
field->max_length= 4; /* as in '-127' */
break;
case MYSQL_TYPE_YEAR:
case MYSQL_TYPE_SHORT:
param->pack_length= 2;
field->max_length= 6; /* as in '-32767' */
break;
case MYSQL_TYPE_INT24:
field->max_length= 9; /* as in '16777216' or in '-8388607' */
param->pack_length= 4;
break;
case MYSQL_TYPE_LONG:
field->max_length= 11; /* '-2147483647' */
param->pack_length= 4;
break;
case MYSQL_TYPE_LONGLONG:
field->max_length= 21; /* '18446744073709551616' */
param->pack_length= 8;
break;
case MYSQL_TYPE_FLOAT:
param->pack_length= 4;
field->max_length= MAX_DOUBLE_STRING_REP_LENGTH;
break;
case MYSQL_TYPE_DOUBLE:
param->pack_length= 8;
field->max_length= MAX_DOUBLE_STRING_REP_LENGTH;
break;
case MYSQL_TYPE_TIME:
field->max_length= 15; /* 19:23:48.123456 */
param->skip_result= skip_result_with_length;
case MYSQL_TYPE_DATE:
field->max_length= 10; /* 2003-11-11 */
param->skip_result= skip_result_with_length;
break;
break;
case MYSQL_TYPE_DATETIME:
case MYSQL_TYPE_TIMESTAMP:
param->skip_result= skip_result_with_length;
field->max_length= MAX_DATE_STRING_REP_LENGTH;
break;
case MYSQL_TYPE_DECIMAL:
case MYSQL_TYPE_ENUM:
case MYSQL_TYPE_SET:
case MYSQL_TYPE_GEOMETRY:
case MYSQL_TYPE_TINY_BLOB:
case MYSQL_TYPE_MEDIUM_BLOB:
case MYSQL_TYPE_LONG_BLOB:
case MYSQL_TYPE_BLOB:
case MYSQL_TYPE_VAR_STRING:
case MYSQL_TYPE_STRING:
param->skip_result= skip_result_string;
break;
default:
return TRUE;
}
return FALSE;
}
/*
Setup the bind buffers for resultset processing
*/
@ -3951,6 +4340,7 @@ my_bool STDCALL mysql_stmt_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind)
MYSQL_FIELD *field;
ulong bind_count= stmt->field_count;
uint param_count= 0;
uchar report_data_truncation= 0;
DBUG_ENTER("mysql_stmt_bind_result");
DBUG_PRINT("enter",("field_count: %d", bind_count));
@ -3981,144 +4371,29 @@ my_bool STDCALL mysql_stmt_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind)
This is to make the execute code easier
*/
if (!param->is_null)
param->is_null= &param->internal_is_null;
param->is_null= &param->is_null_value;
if (!param->length)
param->length= &param->internal_length;
param->length= &param->length_value;
if (!param->error)
param->error= &param->error_value;
else
report_data_truncation= REPORT_DATA_TRUNCATION;
param->param_number= param_count++;
param->offset= 0;
/* Setup data copy functions for the different supported types */
switch (param->buffer_type) {
case MYSQL_TYPE_NULL: /* for dummy binds */
*param->length= 0;
break;
case MYSQL_TYPE_TINY:
param->fetch_result= fetch_result_tinyint;
*param->length= 1;
break;
case MYSQL_TYPE_SHORT:
case MYSQL_TYPE_YEAR:
param->fetch_result= fetch_result_short;
*param->length= 2;
break;
case MYSQL_TYPE_INT24:
case MYSQL_TYPE_LONG:
param->fetch_result= fetch_result_int32;
*param->length= 4;
break;
case MYSQL_TYPE_LONGLONG:
param->fetch_result= fetch_result_int64;
*param->length= 8;
break;
case MYSQL_TYPE_FLOAT:
param->fetch_result= fetch_result_float;
*param->length= 4;
break;
case MYSQL_TYPE_DOUBLE:
param->fetch_result= fetch_result_double;
*param->length= 8;
break;
case MYSQL_TYPE_TIME:
param->fetch_result= fetch_result_time;
*param->length= sizeof(MYSQL_TIME);
break;
case MYSQL_TYPE_DATE:
param->fetch_result= fetch_result_date;
*param->length= sizeof(MYSQL_TIME);
break;
case MYSQL_TYPE_DATETIME:
case MYSQL_TYPE_TIMESTAMP:
param->fetch_result= fetch_result_datetime;
*param->length= sizeof(MYSQL_TIME);
break;
case MYSQL_TYPE_TINY_BLOB:
case MYSQL_TYPE_MEDIUM_BLOB:
case MYSQL_TYPE_LONG_BLOB:
case MYSQL_TYPE_BLOB:
DBUG_ASSERT(param->buffer_length != 0);
param->fetch_result= fetch_result_bin;
break;
case MYSQL_TYPE_VARCHAR:
case MYSQL_TYPE_VAR_STRING:
case MYSQL_TYPE_STRING:
DBUG_ASSERT(param->buffer_length != 0);
param->fetch_result= fetch_result_str;
break;
default:
if (setup_one_fetch_function(param, field))
{
strmov(stmt->sqlstate, unknown_sqlstate);
sprintf(stmt->last_error,
ER(stmt->last_errno= CR_UNSUPPORTED_PARAM_TYPE),
param->buffer_type, param_count);
DBUG_RETURN(1);
}
/* Setup skip_result functions (to calculate max_length) */
param->skip_result= skip_result_fixed;
switch (field->type) {
case MYSQL_TYPE_NULL: /* for dummy binds */
param->pack_length= 0;
field->max_length= 0;
break;
case MYSQL_TYPE_TINY:
param->pack_length= 1;
field->max_length= 4; /* as in '-127' */
break;
case MYSQL_TYPE_YEAR:
case MYSQL_TYPE_SHORT:
param->pack_length= 2;
field->max_length= 6; /* as in '-32767' */
break;
case MYSQL_TYPE_INT24:
field->max_length= 9; /* as in '16777216' or in '-8388607' */
param->pack_length= 4;
break;
case MYSQL_TYPE_LONG:
field->max_length= 11; /* '-2147483647' */
param->pack_length= 4;
break;
case MYSQL_TYPE_LONGLONG:
field->max_length= 21; /* '18446744073709551616' */
param->pack_length= 8;
break;
case MYSQL_TYPE_FLOAT:
param->pack_length= 4;
field->max_length= MAX_DOUBLE_STRING_REP_LENGTH;
break;
case MYSQL_TYPE_DOUBLE:
param->pack_length= 8;
field->max_length= MAX_DOUBLE_STRING_REP_LENGTH;
break;
case MYSQL_TYPE_TIME:
case MYSQL_TYPE_DATE:
case MYSQL_TYPE_DATETIME:
case MYSQL_TYPE_TIMESTAMP:
param->skip_result= skip_result_with_length;
field->max_length= MAX_DATE_STRING_REP_LENGTH;
break;
case MYSQL_TYPE_DECIMAL:
case MYSQL_TYPE_ENUM:
case MYSQL_TYPE_SET:
case MYSQL_TYPE_GEOMETRY:
case MYSQL_TYPE_TINY_BLOB:
case MYSQL_TYPE_MEDIUM_BLOB:
case MYSQL_TYPE_LONG_BLOB:
case MYSQL_TYPE_BLOB:
case MYSQL_TYPE_VARCHAR:
case MYSQL_TYPE_VAR_STRING:
case MYSQL_TYPE_STRING:
param->skip_result= skip_result_string;
break;
default:
strmov(stmt->sqlstate, unknown_sqlstate);
sprintf(stmt->last_error,
ER(stmt->last_errno= CR_UNSUPPORTED_PARAM_TYPE),
field->type, param_count);
ER(stmt->last_errno= CR_UNSUPPORTED_PARAM_TYPE),
field->type, param_count);
DBUG_RETURN(1);
}
}
stmt->bind_result_done= TRUE;
stmt->bind_result_done= BIND_RESULT_DONE | report_data_truncation;
DBUG_RETURN(0);
}
@ -4132,6 +4407,7 @@ static int stmt_fetch_row(MYSQL_STMT *stmt, uchar *row)
MYSQL_BIND *bind, *end;
MYSQL_FIELD *field;
uchar *null_ptr, bit;
int truncation_count= 0;
/*
Precondition: if stmt->field_count is zero or row is NULL, read_row_*
function must return no data.
@ -4154,26 +4430,25 @@ static int stmt_fetch_row(MYSQL_STMT *stmt, uchar *row)
bind < end ;
bind++, field++)
{
*bind->error= 0;
if (*null_ptr & bit)
{
/*
We should set both inter_buffer and is_null to be able to see
We should set both row_ptr and is_null to be able to see
nulls in mysql_stmt_fetch_column. This is because is_null may point
to user data which can be overwritten between mysql_stmt_fetch and
mysql_stmt_fetch_column, and in this case nullness of column will be
lost. See mysql_stmt_fetch_column for details.
*/
bind->inter_buffer= NULL;
bind->row_ptr= NULL;
*bind->is_null= 1;
}
else
{
*bind->is_null= 0;
bind->inter_buffer= row;
if (field->type == bind->buffer_type)
(*bind->fetch_result)(bind, &row);
else
fetch_result_with_conversion(bind, field, &row);
bind->row_ptr= row;
(*bind->fetch_result)(bind, field, &row);
truncation_count+= *bind->error;
}
if (!((bit<<=1) & 255))
{
@ -4181,6 +4456,8 @@ static int stmt_fetch_row(MYSQL_STMT *stmt, uchar *row)
null_ptr++;
}
}
if (truncation_count && (stmt->bind_result_done & REPORT_DATA_TRUNCATION))
return MYSQL_DATA_TRUNCATED;
return 0;
}
@ -4207,7 +4484,7 @@ int STDCALL mysql_stmt_fetch(MYSQL_STMT *stmt)
DBUG_ENTER("mysql_stmt_fetch");
if ((rc= (*stmt->read_row_func)(stmt, &row)) ||
(rc= stmt_fetch_row(stmt, row)))
((rc= stmt_fetch_row(stmt, row)) && rc != MYSQL_DATA_TRUNCATED))
{
stmt->state= MYSQL_STMT_PREPARE_DONE; /* XXX: this is buggy */
stmt->read_row_func= stmt_read_row_no_data;
@ -4254,17 +4531,20 @@ int STDCALL mysql_stmt_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *bind,
DBUG_RETURN(1);
}
if (param->inter_buffer)
if (!bind->error)
bind->error= &bind->error_value;
*bind->error= 0;
if (param->row_ptr)
{
MYSQL_FIELD *field= stmt->fields+column;
uchar *row= param->inter_buffer;
uchar *row= param->row_ptr;
bind->offset= offset;
if (bind->is_null)
*bind->is_null= 0;
if (bind->length) /* Set the length if non char/binary types */
*bind->length= *param->length;
else
bind->length= &param->internal_length; /* Needed for fetch_result() */
bind->length= &param->length_value; /* Needed for fetch_result() */
fetch_result_with_conversion(bind, field, &row);
}
else

View file

@ -25,8 +25,8 @@ target_defs = -DDONT_USE_RAID -DMYSQL_CLIENT @LIB_EXTRA_CCFLAGS@
LIBS = @LIBS@ @openssl_libs@
INCLUDES = @MT_INCLUDES@ \
-I$(top_srcdir)/include $(openssl_includes) @ZLIB_INCLUDES@
-I$(top_srcdir)/include $(openssl_includes) @ZLIB_INCLUDES@ \
-I$(top_srcdir)/extra
## automake barfs if you don't use $(srcdir) or $(top_srcdir) in include
include $(top_srcdir)/libmysql/Makefile.shared

View file

@ -26,7 +26,9 @@ DEFS = -DEMBEDDED_LIBRARY -DMYSQL_SERVER \
-DDATADIR="\"$(MYSQLDATAdir)\"" \
-DSHAREDIR="\"$(MYSQLSHAREdir)\""
INCLUDES= @MT_INCLUDES@ @bdb_includes@ -I$(top_srcdir)/include \
-I$(top_srcdir)/sql -I$(top_srcdir)/sql/examples -I$(top_srcdir)/regex \
-I$(top_srcdir)/sql -I$(top_srcdir)/sql/examples \
-I$(top_srcdir)/regex \
-I$(top_srcdir)/extra \
$(openssl_includes) @ZLIB_INCLUDES@
noinst_LIBRARIES = libmysqld_int.a

View file

@ -15,7 +15,7 @@ link_sources:
DEFS = -DEMBEDDED_LIBRARY
INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include -I$(srcdir) \
-I$(top_srcdir) -I$(top_srcdir)/client -I$(top_srcdir)/regex \
$(openssl_includes)
-I$(top_srcdir)/extra $(openssl_includes)
LIBS = @LIBS@ @WRAPLIBS@ @CLIENT_LIBS@
LDADD = @CLIENT_EXTRA_LDFLAGS@ ../libmysqld.a @innodb_system_libs@ @LIBDL@ $(CXXLDFLAGS)

View file

@ -129,7 +129,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index
show status like 'Last_query_cost';
Variable_name Value
Last_query_cost 821.838037
Last_query_cost 821.837037
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c12 = t2.c21 and t2.c22 = t3.c31 and t3.c32 = t4.c41 and t4.c42 = t5.c51 and t5.c52 = t6.c61 and t6.c62 = t7.c71;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
@ -141,7 +141,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t6.c62 1 Using index
show status like 'Last_query_cost';
Variable_name Value
Last_query_cost 821.838037
Last_query_cost 821.837037
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3
@ -153,7 +153,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index
show status like 'Last_query_cost';
Variable_name Value
Last_query_cost 794.838037
Last_query_cost 794.837037
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3
@ -165,7 +165,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using index
show status like 'Last_query_cost';
Variable_name Value
Last_query_cost 794.838037
Last_query_cost 794.837037
explain select t1.c11 from t1, t2, t3, t4, t5, t6, t7 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3
@ -177,7 +177,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where
show status like 'Last_query_cost';
Variable_name Value
Last_query_cost 794.838037
Last_query_cost 794.837037
explain select t1.c11 from t7, t6, t5, t4, t3, t2, t1 where t1.c11 = t2.c21 and t1.c12 = t3.c31 and t1.c13 = t4.c41 and t1.c14 = t5.c51 and t1.c15 = t6.c61 and t1.c16 = t7.c71 and t2.c22 = t3.c32 and t2.c23 = t4.c42 and t2.c24 = t5.c52 and t2.c25 = t6.c62 and t2.c26 = t7.c72 and t3.c33 = t4.c43 and t3.c34 = t5.c53 and t3.c35 = t6.c63 and t3.c36 = t7.c73 and t4.c42 = t5.c54 and t4.c43 = t6.c64 and t4.c44 = t7.c74 and t5.c52 = t6.c65 and t5.c53 = t7.c75 and t6.c62 = t7.c76;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 3
@ -189,7 +189,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t7 eq_ref PRIMARY PRIMARY 4 test.t1.c16 1 Using where
show status like 'Last_query_cost';
Variable_name Value
Last_query_cost 794.838037
Last_query_cost 794.837037
set optimizer_prune_level=0;
select @@optimizer_prune_level;
@@optimizer_prune_level

View file

@ -156,14 +156,14 @@ drop tables testtets.t4, testtets.t1, t2, t3;
drop database testtets;
select * from information_schema.CHARACTER_SETS
where CHARACTER_SET_NAME like 'latin1%';
CHARACTER_SET_NAME DESCRIPTION DEFAULT_COLLATE_NAME MAXLEN
latin1 ISO 8859-1 West European latin1_swedish_ci 1
CHARACTER_SET_NAME DEFAULT_COLLATE_NAME DESCRIPTION MAXLEN
latin1 latin1_swedish_ci ISO 8859-1 West European 1
SHOW CHARACTER SET LIKE 'latin1%';
Charset Description Default collation Maxlen
latin1 ISO 8859-1 West European latin1_swedish_ci 1
SHOW CHARACTER SET * LIKE 'latin1%';
CHARACTER_SET_NAME DESCRIPTION DEFAULT_COLLATE_NAME MAXLEN
latin1 ISO 8859-1 West European latin1_swedish_ci 1
CHARACTER_SET_NAME DEFAULT_COLLATE_NAME DESCRIPTION MAXLEN
latin1 latin1_swedish_ci ISO 8859-1 West European 1
SHOW CHARACTER SET WHERE CHARACTER_SET_NAME like 'latin1%';
Charset Description Default collation Maxlen
latin1 ISO 8859-1 West European latin1_swedish_ci 1
@ -171,8 +171,8 @@ SHOW CHARACTER SET CHARACTER_SET_NAME WHERE CHARACTER_SET_NAME like 'latin1%';
CHARACTER_SET_NAME
latin1
SHOW CHARACTER SET * WHERE CHARACTER_SET_NAME like 'latin1%';
CHARACTER_SET_NAME DESCRIPTION DEFAULT_COLLATE_NAME MAXLEN
latin1 ISO 8859-1 West European latin1_swedish_ci 1
CHARACTER_SET_NAME DEFAULT_COLLATE_NAME DESCRIPTION MAXLEN
latin1 latin1_swedish_ci ISO 8859-1 West European 1
select * from information_schema.COLLATIONS
where COLLATION_NAME like 'latin1%';
COLLATION_NAME CHARSET ID DEFAULT COMPILED SORTLEN
@ -252,6 +252,11 @@ begin
select * from t1;
select * from t2;
end|
select parameter_style, sql_data_access, dtd_identifier
from information_schema.routines;
parameter_style sql_data_access dtd_identifier
SQL CONTAINS SQL NULL
SQL CONTAINS SQL int
show procedure status;
Db Name Type Definer Modified Created Security_type Comment
test sel2 PROCEDURE root@localhost # # DEFINER
@ -385,11 +390,11 @@ NULL test key_1 test t1 UNIQUE
NULL test key_2 test t1 UNIQUE
select * from information_schema.KEY_COLUMN_USAGE where
TABLE_SCHEMA= "test";
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION POSITION_IN_UNIQUE_CONSTRAINT REFERENCED_TABLE_SCHEMA REFERENCED_TABLE_NAME REFERENCED_COLUMN_NAME
NULL test PRIMARY NULL test t1 a 1 NULL NULL NULL NULL
NULL test constraint_1 NULL test t1 a 1 NULL NULL NULL NULL
NULL test key_1 NULL test t1 a 1 NULL NULL NULL NULL
NULL test key_2 NULL test t1 a 1 NULL NULL NULL NULL
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION POSITION_IN_UNIQUE_CONSTRAINT
NULL test PRIMARY NULL test t1 a 1 NULL
NULL test constraint_1 NULL test t1 a 1 NULL
NULL test key_1 NULL test t1 a 1 NULL
NULL test key_2 NULL test t1 a 1 NULL
select table_name from information_schema.TABLES where table_schema like "test%";
table_name
t1
@ -410,9 +415,9 @@ create view v2 (c) as select a from t1 WITH LOCAL CHECK OPTION;
create view v3 (c) as select a from t1 WITH CASCADED CHECK OPTION;
select * from information_schema.views;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE
NULL test v1 select `test`.`t1`.`a` AS `c` from `test`.`t1` WITH CASCADED CHECK OPTION YES
NULL test v2 select `test`.`t1`.`a` AS `c` from `test`.`t1` WITH LOCAL CHECK OPTION YES
NULL test v3 select `test`.`t1`.`a` AS `c` from `test`.`t1` WITH CASCADED CHECK OPTION YES
NULL test v1 select `test`.`t1`.`a` AS `c` from `test`.`t1` CASCADED YES
NULL test v2 select `test`.`t1`.`a` AS `c` from `test`.`t1` LOCAL YES
NULL test v3 select `test`.`t1`.`a` AS `c` from `test`.`t1` CASCADED YES
grant select (a) on test.t1 to joe@localhost with grant option;
select * from INFORMATION_SCHEMA.COLUMN_PRIVILEGES;
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME PRIVILEGE_TYPE IS_GRANTABLE
@ -466,8 +471,8 @@ SHOW CREATE TABLE INFORMATION_SCHEMA.character_sets;
Table Create Table
character_sets CREATE TEMPORARY TABLE `character_sets` (
`CHARACTER_SET_NAME` varchar(30) NOT NULL default '',
`DESCRIPTION` varchar(60) NOT NULL default '',
`DEFAULT_COLLATE_NAME` varchar(60) NOT NULL default '',
`DESCRIPTION` varchar(60) NOT NULL default '',
`MAXLEN` bigint(3) NOT NULL default '0'
) ENGINE=HEAP DEFAULT CHARSET=utf8 MAX_ROWS=2252
set names latin2;
@ -475,23 +480,23 @@ SHOW CREATE TABLE INFORMATION_SCHEMA.character_sets;
Table Create Table
character_sets CREATE TEMPORARY TABLE `character_sets` (
`CHARACTER_SET_NAME` varchar(30) NOT NULL default '',
`DESCRIPTION` varchar(60) NOT NULL default '',
`DEFAULT_COLLATE_NAME` varchar(60) NOT NULL default '',
`DESCRIPTION` varchar(60) NOT NULL default '',
`MAXLEN` bigint(3) NOT NULL default '0'
) ENGINE=HEAP DEFAULT CHARSET=utf8 MAX_ROWS=2252
set names latin1;
create table t1 select * from information_schema.CHARACTER_SETS
where CHARACTER_SET_NAME like "latin1";
select * from t1;
CHARACTER_SET_NAME DESCRIPTION DEFAULT_COLLATE_NAME MAXLEN
latin1 ISO 8859-1 West European latin1_swedish_ci 1
CHARACTER_SET_NAME DEFAULT_COLLATE_NAME DESCRIPTION MAXLEN
latin1 latin1_swedish_ci ISO 8859-1 West European 1
alter table t1 default character set utf8;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`CHARACTER_SET_NAME` varchar(30) NOT NULL default '',
`DESCRIPTION` varchar(60) NOT NULL default '',
`DEFAULT_COLLATE_NAME` varchar(60) NOT NULL default '',
`DESCRIPTION` varchar(60) NOT NULL default '',
`MAXLEN` bigint(3) NOT NULL default '0'
) ENGINE=MyISAM DEFAULT CHARSET=utf8
drop table t1;
@ -554,7 +559,7 @@ TABLE_NAME= "vo";
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_SCHEMA TABLE_NAME CONSTRAINT_TYPE
select * from information_schema.KEY_COLUMN_USAGE where
TABLE_NAME= "vo";
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION POSITION_IN_UNIQUE_CONSTRAINT REFERENCED_TABLE_SCHEMA REFERENCED_TABLE_NAME REFERENCED_COLUMN_NAME
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION POSITION_IN_UNIQUE_CONSTRAINT
drop view vo;
select TABLE_NAME,TABLE_TYPE,ENGINE
from information_schema.tables
@ -585,3 +590,40 @@ TABLES
TABLE_PRIVILEGES
TABLE_CONSTRAINTS
TABLE_NAMES
use test;
create function sub1(i int) returns int
return i+1;
create table t1(f1 int);
create view t2 (c) as select f1 from t1;
create view t3 (c) as select sub1(1);
create table t4(f1 int, KEY f1_key (f1));
drop table t1;
drop function sub1;
select table_name from information_schema.views
where table_schema='test';
table_name
Warnings:
Warning 1356 View 'test.t2' references invalid table(s) or column(s) or function(s)
Warning 1356 View 'test.t3' references invalid table(s) or column(s) or function(s)
select table_name from information_schema.views
where table_schema='test';
table_name
Warnings:
Warning 1356 View 'test.t2' references invalid table(s) or column(s) or function(s)
Warning 1356 View 'test.t3' references invalid table(s) or column(s) or function(s)
select column_name from information_schema.columns
where table_schema='test';
column_name
f1
Warnings:
Warning 1356 View 'test.t2' references invalid table(s) or column(s) or function(s)
Warning 1356 View 'test.t3' references invalid table(s) or column(s) or function(s)
select index_name from information_schema.statistics where table_schema='test';
index_name
f1_key
select constraint_name from information_schema.table_constraints
where table_schema='test';
constraint_name
drop view t2;
drop view t3;
drop table t4;

View file

@ -11,9 +11,9 @@ NULL test t2_ibfk_1 test t2 FOREIGN KEY
NULL test t2_ibfk_2 test t2 FOREIGN KEY
select * from information_schema.KEY_COLUMN_USAGE where
TABLE_SCHEMA= "test";
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION POSITION_IN_UNIQUE_CONSTRAINT REFERENCED_TABLE_SCHEMA REFERENCED_TABLE_NAME REFERENCED_COLUMN_NAME
NULL test PRIMARY NULL test t1 id 1 NULL NULL NULL NULL
NULL test PRIMARY NULL test t2 id 1 NULL NULL NULL NULL
NULL test t2_ibfk_1 NULL test t2 t1_id 1 1 test t1 id
NULL test t2_ibfk_2 NULL test t2 t1_id 1 1 test t1 id
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION POSITION_IN_UNIQUE_CONSTRAINT
NULL test PRIMARY NULL test t1 id 1 NULL
NULL test PRIMARY NULL test t2 id 1 NULL
NULL test t2_ibfk_1 NULL test t2 t1_id 1 1
NULL test t2_ibfk_2 NULL test t2 t1_id 1 1
drop table t2, t1;

View file

@ -12,7 +12,7 @@ set GLOBAL init_connect=DEFAULT;
select @a;
@a
NULL
set global init_connect="create table t1(a char(10));\
set global init_connect="drop table if exists t1; create table t1(a char(10));\
insert into t1 values ('\0');insert into t1 values('abc')";
select hex(a) from t1;
hex(a)

View file

@ -983,10 +983,10 @@ create view v1 as select * from t1;
drop table t1;
create table t1 (col1 char(5),newcol2 char(5));
insert into v1 values('a','aa');
ERROR HY000: View 'test.v1' references invalid table(s) or column(s)
ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s)
drop table t1;
select * from v1;
ERROR HY000: View 'test.v1' references invalid table(s) or column(s)
ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s)
drop view v1;
create view v1 (a,a) as select 'a','a';
ERROR 42S21: Duplicate column name 'a'
@ -1217,11 +1217,11 @@ create table t1 (s1 int);
create view v1 as select x1() from t1;
drop function x1;
select * from v1;
ERROR 42000: FUNCTION test.x1 does not exist
ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s)
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 MyISAM 9 Fixed 0 0 0 21474836479 1024 0 NULL # # NULL latin1_swedish_ci NULL
v1 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL # # NULL NULL NULL NULL FUNCTION test.x1 does not exist
v1 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL # # NULL NULL NULL NULL View 'test.v1' references invalid table(s) or column(s) or function(s)
drop view v1;
drop table t1;
create view v1 as select 99999999999999999999999999999999999999999999999999999 as col1;
@ -1655,7 +1655,7 @@ test.t1 check status OK
drop table t1;
check table v1;
Table Op Msg_type Msg_text
test.v1 check error View 'test.v1' references invalid table(s) or column(s)
test.v1 check error View 'test.v1' references invalid table(s) or column(s) or function(s)
drop view v1;
create table t1 (a int);
create table t2 (a int);

View file

@ -1 +1 @@
--debug=d,make_global_read_lock_block_commit_loop
--loose-debug=d,make_global_read_lock_block_commit_loop

View file

@ -92,6 +92,12 @@ begin
end|
delimiter ;|
#
# Bug#7222 information_schema: errors in "routines"
#
select parameter_style, sql_data_access, dtd_identifier
from information_schema.routines;
--replace_column 5 # 6 #
show procedure status;
--replace_column 5 # 6 #
@ -286,3 +292,29 @@ use test;
show tables;
use information_schema;
show tables like "T%";
#
# Bug#7212: information_schema: "Can't find file" errors if storage engine gone
# Bug#7211: information_schema: crash if bad view
#
use test;
create function sub1(i int) returns int
return i+1;
create table t1(f1 int);
create view t2 (c) as select f1 from t1;
create view t3 (c) as select sub1(1);
create table t4(f1 int, KEY f1_key (f1));
drop table t1;
drop function sub1;
select table_name from information_schema.views
where table_schema='test';
select table_name from information_schema.views
where table_schema='test';
select column_name from information_schema.columns
where table_schema='test';
select index_name from information_schema.statistics where table_schema='test';
select constraint_name from information_schema.table_constraints
where table_schema='test';
drop view t2;
drop view t3;
drop table t4;

View file

@ -19,7 +19,7 @@ connect (con3,localhost,user_1,,);
connection con3;
select @a;
connection con0;
set global init_connect="create table t1(a char(10));\
set global init_connect="drop table if exists t1; create table t1(a char(10));\
insert into t1 values ('\0');insert into t1 values('abc')";
connect (con4,localhost,user_1,,);
connection con4;

View file

@ -1169,7 +1169,7 @@ create function x1 () returns int return 5;
create table t1 (s1 int);
create view v1 as select x1() from t1;
drop function x1;
-- error 1305
-- error 1356
select * from v1;
--replace_column 12 # 13 #
--replace_result "2147483647 " "21474836479 "

View file

@ -17,3 +17,13 @@ dist-hook:
done; \
fi; \
done
windoze:
for i in `find . -name 'Makefile.am'`; do make -C `dirname $$i` windoze-dsp; done
windoze-dsp:
all-windoze-dsp: windoze
find . -name '*.dsp' | grep -v SCCS | xargs unix2dos
$(top_srcdir)/ndb/config/make-win-dsw.sh | unix2dos > ndb.dsw
tar cvfz ndb-win-dsp.tar.gz ndb.dsw `find . -name '*.dsp' | grep -v SCCS`

42
ndb/config/make-win-dsw.sh Executable file
View file

@ -0,0 +1,42 @@
cat <<EOF
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
EOF
for i in `find . -name '*.dsp' | grep -v SCCS`
do
name=`basename $i | sed 's/\.dsp//'`
cat<<EOF
Project: "$name"="`echo $i | sed 's/\//\\\/g'`" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
EOF
done
cat<<EOF
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################
EOF

8
ndb/config/win-includes Executable file
View file

@ -0,0 +1,8 @@
#!/bin/sh
dst=$1
shift
out=`echo $* | sed 's/-I\([^ ]*\)/\/I "\1"/g'`
sed -e "s!@includes@!$out!g" $dst > /tmp/$dst.$$
mv /tmp/$dst.$$ $dst

100
ndb/config/win-lib.am Normal file
View file

@ -0,0 +1,100 @@
# Microsoft Developer Studio Project File - Name="@name@" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=@name@ - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "@name@.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "@name@.mak" CFG="@name@ - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "@name@ - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "@name@ - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=xicl6.exe
RSC=rc.exe
!IF "$(CFG)" == "@name@ - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "release"
# PROP Intermediate_Dir "release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /G6 /MT /W3 /O2 /D "WIN32" /D "DBUG_OFF" /D "_WINDOWS" /D "NDEBUG" /FD /c
# ADD BASE CPP @includes@
# ADD CPP @includes@
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=xilink6.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:".\lib_release\@name@.lib"
@release_libs@
!ELSEIF "$(CFG)" == "@name@ - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "debug"
# PROP Intermediate_Dir "debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /Gf /D "WIN32" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "_WINDOWS" /FD /c
# ADD BASE CPP @includes@
# ADD CPP @includes@
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=xilink6.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:".\lib_debug\@name@.lib"
@debug_libs@
!ENDIF
# Begin Target
# Name "@name@ - Win32 Release"
# Name "@name@ - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
@sources@
# End Group
# End Target
# End Project

56
ndb/config/win-libraries Executable file
View file

@ -0,0 +1,56 @@
#!/bin/sh
dst=$1
shift
type=$1
shift
add_lib(){
echo `dirname $2`/$1/`basename $2 | sed "s/\.[l]*a/$3.lib/g"`
}
out_rel=
out_deb=
out_tls_rel=
out_tls_deb=
for i in $*
do
# mysql VC++ project files have for some unknown reason
# choosen NOT to put libdbug.lib in $(topdir)./dbug but rather in $(topdir)
# the same goes for mysys and strings
lib=$i
case $i in
*libdbug.a | *libmysys.a | *libmystrings.a)
lib=`echo $i | sed s'!dbug\/lib!!' | sed 's!mysys\/lib!!' | sed 's!strings\/libmy!!'`
echo "Changing from $i to $lib"
;;
esac
if [ `echo $i | grep -c gcc` -eq 0 ]
then
out_rel="${out_rel} `add_lib lib_release $lib`"
out_deb="${out_deb} `add_lib lib_debug $lib`"
out_tls_rel="${out_tls_rel} `add_lib lib_release $lib _tls`"
out_tls_deb="${out_tls_deb} `add_lib lib_debug $lib _tls`"
fi
done
fix(){
echo "# ADD BASE ${type}32 $*\n# ADD ${type}32 $*\n"
}
if [ "$out_rel" ]
then
out_rel=`fix $out_rel`
out_deb=`fix $out_deb`
out_tls_rel=`fix $out_tls_rel`
out_tls_deb=`fix $out_tls_deb`
fi
sed -e "s!@release_libs@!$out_rel!g" \
-e "s!@debug_libs@!$out_deb!g" \
-e "s!@tls_release_libs@!$out_tls_rel!g" \
-e "s!@tls_debug_libs@!$out_tls_deb!g" \
$dst > !tmp!$dst.$$
mv !tmp!$dst.$$ $dst

7
ndb/config/win-name Executable file
View file

@ -0,0 +1,7 @@
#!/bin/sh
dst=$1
shift
sed -e "s/@name@/`echo $1 | sed 's/\.[l]*a//g'`/g" $dst > /tmp/$dst.$$
mv /tmp/$dst.$$ $dst

98
ndb/config/win-prg.am Normal file
View file

@ -0,0 +1,98 @@
# Microsoft Developer Studio Project File - Name="mysqld" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=@name@ - Win32 Release
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "@name@.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "@name@.mak" CFG="@name@ - Win32 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "@name@ - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "@name@ - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=xicl6.exe
RSC=rc.exe
!IF "$(CFG)" == "@name@ - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "release"
# PROP Intermediate_Dir "release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "NDB_WIN32" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /G6 /MT /W3 /O2 /D "NDB_WIN32" /I "../zlib" /I "../include" /I "../regex" /D "NDEBUG" /D "DBUG_OFF" /D "HAVE_INNOBASE_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /FD /c
# ADD BASE CPP @includes@
# ADD CPP @includes@
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x410 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=xilink6.exe
@release_libs@
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib /nologo /subsystem:console /pdb:none /machine:I386 /out:"release/@name@-opt.exe"
# SUBTRACT LINK32 /debug
!ELSEIF "$(CFG)" == "@name@ - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "debug"
# PROP Intermediate_Dir "debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "NDB_WIN32" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /G6 /MTd /W3 /Z7 /Od /D "NDB_WIN32" /I "../bdb/build_win32" /I "../include" /I "../regex" /I "../zlib" /D "_DEBUG" /D "SAFEMALLOC" /D "SAFE_MUTEX" /D "HAVE_INNOBASE_DB" /D "HAVE_BERKELEY_DB" /D "MYSQL_SERVER" /D "_WINDOWS" /D "_CONSOLE" /D "_MBCS" /D "HAVE_DLOPEN" /FD /c
# ADD BASE CPP @includes@
# ADD CPP @includes@
# SUBTRACT CPP /Fr /YX
# ADD BASE RSC /l 0x410 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=xilink6.exe
@debug_libs@
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Wsock32.lib /nologo /subsystem:console /incremental:no /debug /machine:I386 /out:"debug/@name@.exe" /pdbtype:sept
!ENDIF
# Begin Target
# Name "@name@ - Win32 Release"
# Name "@name@ - Win32 Debug"
@sources@
# End Target
# End Project

8
ndb/config/win-sources Executable file
View file

@ -0,0 +1,8 @@
#!/bin/sh
dst=$1
shift
out=`echo $* | sed 's!\([^ ]*\)!# Begin Source File\\\nSOURCE=\1\\\n# End Source File\\\n!g'`
sed -e "s!@sources@!$out!g" $dst > /tmp/$dst.$$
mv /tmp/$dst.$$ $dst

View file

@ -100,3 +100,5 @@ odbcdoc: DUMMY
testdoc: DUMMY
mkdir -p $(OUTDIR)
cd $(top_srcdir)/ndb ; $(DOXYGEN) $(DOXYDIR)/Doxyfile.test
windoze-dsp:

View file

@ -41,3 +41,5 @@ portlib transporter util
dist-hook:
-rm -rf `find $(distdir) -type d -name SCCS`
windoze-dsp:

View file

@ -24,8 +24,8 @@
*/
class GrepError {
public:
enum Code {
NO_ERROR = 0,
enum GE_Code {
GE_NO_ERROR = 0,
SUBSCRIPTION_ID_NOMEM = 1,
SUBSCRIPTION_ID_NOT_FOUND = 2,
SUBSCRIPTION_ID_NOT_UNIQUE = 3,
@ -82,12 +82,12 @@ public:
};
struct ErrorDescription {
Code errCode;
GE_Code errCode;
const char * name;
};
static const ErrorDescription errorDescriptions[];
static const Uint32 noOfErrorDescs;
static const char * getErrorDesc(GrepError::Code err);
static const char * getErrorDesc(GrepError::GE_Code err);
};

View file

@ -30,7 +30,6 @@ private:
static void setArray(Uint32 &, Uint32 arraySize);
static void setOriginal(Uint32 &, Uint32 original);
static void setNullable(Uint32 &, Uint32 nullable);
static void setDGroup(Uint32 &, Uint32 dgroup);
static void setDKey(Uint32 &, Uint32 dkey);
static void setPrimaryKey(Uint32 &, Uint32 dkey);
static void setDynamic(Uint32 &, Uint32 dynamicInd);

View file

@ -89,7 +89,7 @@ public:
return memcmp(this, &l, sizeof(* this)) == 0;
}
LogLevel& operator=(const class EventSubscribeReq & req);
LogLevel& operator=(const struct EventSubscribeReq & req);
private:
/**

View file

@ -50,7 +50,6 @@
**/
#define MAX_TUPLES_PER_PAGE 8191
#define MAX_TUPLES_BITS 13 /* 13 bits = 8191 tuples per page */
/*#define MAX_NO_OF_TUPLEKEY 16 Not currently used */
#define MAX_TABLES 1600
#define MAX_TAB_NAME_SIZE 128
#define MAX_ATTR_NAME_SIZE 32
@ -58,7 +57,6 @@
#define MAX_ATTRIBUTES_IN_TABLE 128
#define MAX_ATTRIBUTES_IN_INDEX 32
#define MAX_TUPLE_SIZE_IN_WORDS 2013
#define MAX_FIXED_KEY_LENGTH_IN_WORDS 8
#define MAX_KEY_SIZE_IN_WORDS 1023
#define MAX_FRM_DATA_SIZE 6000
#define MAX_NULL_BITS 4096

View file

@ -52,9 +52,11 @@ private:
*/
static Uint32 getLockMode(const Uint32 & requestInfo);
static Uint32 getReadCommittedFlag(const Uint32 & requestInfo);
static Uint32 getDescendingFlag(const Uint32 & requestInfo);
static void setLockMode(Uint32 & requestInfo, Uint32 lockMode);
static void setReadCommittedFlag(Uint32 & requestInfo, Uint32 readCommitted);
static void setDescendingFlag(Uint32 & requestInfo, Uint32 descending);
};
/**
@ -62,14 +64,16 @@ private:
*
* l = Lock Mode - 1 Bit 2
* h = Read Committed - 1 Bit 5
* z = Descending (TUX) - 1 Bit 6
*
* 1111111111222222222233
* 01234567890123456789012345678901
* l h
* l hz
*/
#define AS_LOCK_MODE_SHIFT (2)
#define AS_LOCK_MODE_MASK (1)
#define AS_READ_COMMITTED_SHIFT (5)
#define AS_DESCENDING_SHIFT (6)
inline
Uint32
@ -83,6 +87,12 @@ AccScanReq::getReadCommittedFlag(const Uint32 & requestInfo){
return (requestInfo >> AS_READ_COMMITTED_SHIFT) & 1;
}
inline
Uint32
AccScanReq::getDescendingFlag(const Uint32 & requestInfo){
return (requestInfo >> AS_DESCENDING_SHIFT) & 1;
}
inline
void
AccScanReq::setLockMode(UintR & requestInfo, UintR val){
@ -97,6 +107,13 @@ AccScanReq::setReadCommittedFlag(UintR & requestInfo, UintR val){
requestInfo |= (val << AS_READ_COMMITTED_SHIFT);
}
inline
void
AccScanReq::setDescendingFlag(UintR & requestInfo, UintR val){
ASSERT_BOOL(val, "AccScanReq::setDescendingFlag");
requestInfo |= (val << AS_DESCENDING_SHIFT);
}
class AccScanConf {
/**
* Sender(s)

View file

@ -75,7 +75,7 @@ inline
void
FsCloseReq::setRemoveFileFlag(UintR & fileflag, bool removefile){
// ASSERT_BOOL(removefile, "FsCloseReq::setRemoveFileFlag");
if (removefile == true)
if (removefile)
fileflag = 1;
else
fileflag = 0;

View file

@ -93,7 +93,7 @@ public:
Uint32 subscriptionId;
Uint32 subscriptionKey;
Uint32 senderNodeId;
GrepError::Code err;
GrepError::GE_Code err;
};
class RepGetGciReq
@ -151,7 +151,7 @@ public:
Uint32 lastPSGCI;
Uint32 firstSSGCI;
Uint32 lastSSGCI;
GrepError::Code err;
GrepError::GE_Code err;
};
class RepGetGciBufferReq {
@ -213,7 +213,7 @@ public:
Uint32 lastSSGCI;
Uint32 currentGCIBuffer;
Uint32 nodeGrp;
GrepError::Code err;
GrepError::GE_Code err;
};
class RepInsertGciBufferReq
@ -252,7 +252,7 @@ public:
Uint32 nodeGrp;
Uint32 tableId;
Uint32 force;
GrepError::Code err;
GrepError::GE_Code err;
};
class RepInsertGciBufferConf
@ -310,7 +310,7 @@ public:
Uint32 lastGCI;
Uint32 currentGCI;
Uint32 nodeGrp;
GrepError::Code err;
GrepError::GE_Code err;
};
class RepClearPSGciBufferConf
@ -367,7 +367,7 @@ public:
Uint32 lastGCI;
Uint32 currentGCI;
Uint32 nodeGrp;
GrepError::Code err;
GrepError::GE_Code err;
};
class RepClearSSGciBufferConf

View file

@ -56,6 +56,7 @@ public:
static Uint32 getKeyinfoFlag(const Uint32 & requestInfo);
static Uint32 getReadCommittedFlag(const Uint32 & requestInfo);
static Uint32 getRangeScanFlag(const Uint32 & requestInfo);
static Uint32 getDescendingFlag(const Uint32 & requestInfo);
static Uint32 getAttrLen(const Uint32 & requestInfo);
static Uint32 getScanPrio(const Uint32 & requestInfo);
@ -64,6 +65,7 @@ public:
static void setKeyinfoFlag(Uint32 & requestInfo, Uint32 keyinfo);
static void setReadCommittedFlag(Uint32 & requestInfo, Uint32 readCommitted);
static void setRangeScanFlag(Uint32 & requestInfo, Uint32 rangeScan);
static void setDescendingFlag(Uint32 & requestInfo, Uint32 descending);
static void setAttrLen(Uint32 & requestInfo, Uint32 attrLen);
static void setScanPrio(Uint32& requestInfo, Uint32 prio);
};
@ -197,11 +199,12 @@ public:
* k = Keyinfo - 1 Bit 8
* r = read committed - 1 Bit 9
* x = range scan - 1 Bit 6
* z = descending - 1 Bit 10
* p = Scan prio - 4 Bits (12-15) -> max 15
*
* 1111111111222222222233
* 01234567890123456789012345678901
* lxhkr ppppaaaaaaaaaaaaaaaa
* lxhkrz ppppaaaaaaaaaaaaaaaa
*/
#define SF_LOCK_MODE_SHIFT (5)
#define SF_LOCK_MODE_MASK (1)
@ -210,6 +213,7 @@ public:
#define SF_KEYINFO_SHIFT (8)
#define SF_READ_COMMITTED_SHIFT (9)
#define SF_RANGE_SCAN_SHIFT (6)
#define SF_DESCENDING_SHIFT (10)
#define SF_ATTR_LEN_SHIFT (16)
#define SF_ATTR_LEN_MASK (65535)
@ -241,6 +245,12 @@ ScanFragReq::getRangeScanFlag(const Uint32 & requestInfo){
return (requestInfo >> SF_RANGE_SCAN_SHIFT) & 1;
}
inline
Uint32
ScanFragReq::getDescendingFlag(const Uint32 & requestInfo){
return (requestInfo >> SF_DESCENDING_SHIFT) & 1;
}
inline
Uint32
ScanFragReq::getReadCommittedFlag(const Uint32 & requestInfo){
@ -301,6 +311,13 @@ ScanFragReq::setRangeScanFlag(UintR & requestInfo, UintR val){
requestInfo |= (val << SF_RANGE_SCAN_SHIFT);
}
inline
void
ScanFragReq::setDescendingFlag(UintR & requestInfo, UintR val){
ASSERT_BOOL(val, "ScanFragReq::setDescendingFlag");
requestInfo |= (val << SF_DESCENDING_SHIFT);
}
inline
void
ScanFragReq::setAttrLen(UintR & requestInfo, UintR val){

View file

@ -34,7 +34,8 @@ class ScanTabReq {
* Sender(s)
*/
friend class NdbConnection;
friend class NdbScanOperation;
friend class NdbScanOperation;
friend class NdbIndexScanOperation;
/**
* For printing
@ -79,6 +80,7 @@ private:
static Uint8 getHoldLockFlag(const UintR & requestInfo);
static Uint8 getReadCommittedFlag(const UintR & requestInfo);
static Uint8 getRangeScanFlag(const UintR & requestInfo);
static Uint8 getDescendingFlag(const UintR & requestInfo);
static Uint8 getKeyinfoFlag(const UintR & requestInfo);
static Uint16 getScanBatch(const UintR & requestInfo);
static Uint8 getDistributionKeyFlag(const UintR & requestInfo);
@ -92,6 +94,7 @@ private:
static void setHoldLockFlag(UintR & requestInfo, Uint32 flag);
static void setReadCommittedFlag(UintR & requestInfo, Uint32 flag);
static void setRangeScanFlag(UintR & requestInfo, Uint32 flag);
static void setDescendingFlag(UintR & requestInfo, Uint32 flag);
static void setKeyinfoFlag(UintR & requestInfo, Uint32 flag);
static void setScanBatch(Uint32& requestInfo, Uint32 sz);
static void setDistributionKeyFlag(Uint32& requestInfo, Uint32 flag);
@ -105,13 +108,14 @@ private:
h = Hold lock mode - 1 Bit 10
c = Read Committed - 1 Bit 11
k = Keyinfo - 1 Bit 12
z = Descending (TUX) - 1 Bit 14
x = Range Scan (TUX) - 1 Bit 15
b = Scan batch - 10 Bit 16-25 (max 1023)
d = Distribution key flag
1111111111222222222233
01234567890123456789012345678901
ppppppppl hck xbbbbbbbbbb
ppppppppl hck zxbbbbbbbbbb
*/
#define PARALLELL_SHIFT (0)
@ -132,6 +136,9 @@ private:
#define RANGE_SCAN_SHIFT (15)
#define RANGE_SCAN_MASK (1)
#define DESCENDING_SHIFT (14)
#define DESCENDING_MASK (1)
#define SCAN_BATCH_SHIFT (16)
#define SCAN_BATCH_MASK (1023)
@ -167,6 +174,12 @@ ScanTabReq::getRangeScanFlag(const UintR & requestInfo){
return (Uint8)((requestInfo >> RANGE_SCAN_SHIFT) & RANGE_SCAN_MASK);
}
inline
Uint8
ScanTabReq::getDescendingFlag(const UintR & requestInfo){
return (Uint8)((requestInfo >> DESCENDING_SHIFT) & DESCENDING_MASK);
}
inline
Uint16
ScanTabReq::getScanBatch(const Uint32 & requestInfo){
@ -214,6 +227,13 @@ ScanTabReq::setRangeScanFlag(UintR & requestInfo, Uint32 flag){
requestInfo |= (flag << RANGE_SCAN_SHIFT);
}
inline
void
ScanTabReq::setDescendingFlag(UintR & requestInfo, Uint32 flag){
ASSERT_BOOL(flag, "ScanTabReq::setDescendingFlag");
requestInfo |= (flag << DESCENDING_SHIFT);
}
inline
void
ScanTabReq::setScanBatch(Uint32 & requestInfo, Uint32 flag){

View file

@ -104,9 +104,9 @@ public:
STATIC_CONST( SignalLength = 2 );
enum ErrorCode {
NoError = 0,
InvalidRequest = 800,
NoFreeFragment = 604,
NoFreeAttributes = 827
InvalidRequest = 903,
NoFreeFragment = 904,
NoFreeAttributes = 905
};
private:
Uint32 userPtr;
@ -186,9 +186,9 @@ public:
STATIC_CONST( SignalLength = 2 );
enum ErrorCode {
NoError = 0,
InvalidAttributeType = 742,
InvalidCharset = 743,
InvalidNodeSize = 832
InvalidAttributeType = 906,
InvalidCharset = 907,
InvalidNodeSize = 908
};
private:
Uint32 userPtr;

View file

@ -36,8 +36,8 @@ public:
};
enum ErrorCode {
NoError = 0, // must be zero
SearchError = 895, // add + found or remove + not found
NoMemError = 827
SearchError = 901, // add + found or remove + not found
NoMemError = 902
};
STATIC_CONST( SignalLength = 8 );
private:

View file

@ -39,7 +39,7 @@ public:
enum RequestInfo {
TryLock = 1
};
private:
public:
Uint32 senderData;
Uint32 senderRef;
Uint32 lockId;
@ -63,7 +63,7 @@ class UtilLockConf {
public:
STATIC_CONST( SignalLength = 4 );
private:
public:
Uint32 senderData;
Uint32 senderRef;
Uint32 lockId;
@ -95,7 +95,7 @@ public:
LockAlreadyHeld = 4
};
private:
public:
Uint32 senderData;
Uint32 senderRef;
Uint32 lockId;
@ -119,7 +119,7 @@ class UtilUnlockReq {
public:
STATIC_CONST( SignalLength = 4 );
private:
public:
Uint32 senderData;
Uint32 senderRef;
Uint32 lockId;
@ -143,7 +143,7 @@ class UtilUnlockConf {
public:
STATIC_CONST( SignalLength = 3 );
private:
public:
Uint32 senderData;
Uint32 senderRef;
Uint32 lockId;
@ -171,7 +171,7 @@ public:
NoSuchLock = 1,
NotLockOwner = 2
};
private:
public:
Uint32 senderData;
Uint32 senderRef;
Uint32 lockId;
@ -200,7 +200,7 @@ public:
STATIC_CONST( SignalLength = 4 );
private:
public:
Uint32 senderData;
Uint32 senderRef;
Uint32 lockId;
@ -229,7 +229,7 @@ public:
STATIC_CONST( SignalLength = 4 );
private:
public:
Uint32 senderData;
Uint32 senderRef;
Uint32 lockId;
@ -251,7 +251,7 @@ class UtilCreateLockConf {
public:
STATIC_CONST( SignalLength = 3 );
private:
public:
Uint32 senderData;
Uint32 senderRef;
Uint32 lockId;
@ -275,7 +275,7 @@ class UtilDestroyLockReq {
public:
STATIC_CONST( SignalLength = 4 );
private:
public:
Uint32 senderData;
Uint32 senderRef;
Uint32 lockId;
@ -303,7 +303,7 @@ public:
STATIC_CONST( SignalLength = 4 );
private:
public:
Uint32 senderData;
Uint32 senderRef;
Uint32 lockId;
@ -325,7 +325,7 @@ class UtilDestroyLockConf {
public:
STATIC_CONST( SignalLength = 3 );
private:
public:
Uint32 senderData;
Uint32 senderRef;
Uint32 lockId;

View file

@ -18,7 +18,9 @@
#define SYSLOGHANDLER_H
#include "LogHandler.hpp"
#ifndef NDB_WIN32
#include <syslog.h>
#endif
/**
* Logs messages to syslog. The default identity is 'NDB'.
@ -62,7 +64,7 @@ public:
* @param pIdentity a syslog identity.
* @param facility syslog facility, defaults to LOG_USER
*/
SysLogHandler(const char* pIdentity, int facility = LOG_USER);
SysLogHandler(const char* pIdentity, int facility);
/**
* Destructor.

View file

@ -49,6 +49,7 @@
* @{
*/
#include <ndb_types.h>
#include "mgmapi_config_parameters.h"
#ifdef __cplusplus
@ -743,7 +744,7 @@ extern "C" {
int ndb_mgm_get_int_parameter(const ndb_mgm_configuration_iterator*,
int param, unsigned * value);
int ndb_mgm_get_int64_parameter(const ndb_mgm_configuration_iterator*,
int param, unsigned long long * value);
int param, Uint64 * value);
int ndb_mgm_get_string_parameter(const ndb_mgm_configuration_iterator*,
int param, const char ** value);
int ndb_mgm_purge_stale_sessions(NdbMgmHandle handle, char **);

View file

@ -59,7 +59,7 @@ public:
void print() const { props->print(); }
static Uint32 configureTransporters(Uint32 nodeId,
const class ndb_mgm_configuration &,
const struct ndb_mgm_configuration &,
class TransporterRegistry &);
private:

View file

@ -2,34 +2,51 @@
#ifndef NDBGLOBAL_H
#define NDBGLOBAL_H
#include <my_global.h>
#include <ndb_types.h>
/** signal & SIG_PIPE */
#include <my_alarm.h>
#define NDB_PORT "@ndb_port@"
#define NDB_TCP_BASE_PORT "@ndb_port_base@"
#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(WIN32)
#define NDB_WIN32
#include <winsock2.h>
#define PATH_MAX 256
#define DIR_SEPARATOR "\\"
#define MYSQLCLUSTERDIR "c:\\mysql\\mysql-cluster"
#define HAVE_STRCASECMP
#define strcasecmp _strcmpi
#pragma warning(disable: 4503 4786)
#else
#undef NDB_WIN32
#define DIR_SEPARATOR "/"
#endif
#include <my_global.h>
#include <my_alarm.h>
#ifdef _AIX
#undef _H_STRINGS
#endif
#include <m_string.h>
#include <m_ctype.h>
#include <ndb_types.h>
#include <ctype.h>
#ifdef HAVE_STDARG_H
#include <stdarg.h>
#endif
#ifdef TIME_WITH_SYS_TIME
#include <time.h>
#endif
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#ifdef HAVE_SYS_STAT_H
#if defined(__cplusplus) && defined(_APP32_64BIT_OFF_T) && defined(_INCLUDE_AES_SOURCE)
#undef _INCLUDE_AES_SOURCE
@ -39,31 +56,31 @@
#include <sys/stat.h>
#endif
#endif
#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif
#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
#ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h>
#endif
#ifdef NDB_WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#define DIR_SEPARATOR "\\"
#define PATH_MAX 256
#pragma warning(disable: 4503 4786)
#else
#define DIR_SEPARATOR "/"
#ifndef HAVE_STRDUP
extern char * strdup(const char *s);
#endif
#ifndef HAVE_STRCASECMP
extern int strcasecmp(const char *s1, const char *s2);
extern int strncasecmp(const char *s1, const char *s2, size_t n);
#endif
static const char table_name_separator = '/';
#if defined(_AIX) || defined(NDB_VC98)
#if defined(_AIX) || defined(WIN32) || defined(NDB_VC98)
#define STATIC_CONST(x) enum { x }
#else
#define STATIC_CONST(x) static const Uint32 x
@ -84,13 +101,8 @@ extern int ndb_init(void);
extern void ndb_end(int);
#define NDB_INIT(prog_name) {my_progname=(prog_name); ndb_init();}
#ifndef HAVE_STRDUP
extern char * strdup(const char *s);
#endif
#ifndef HAVE_STRCASECMP
extern int strcasecmp(const char *s1, const char *s2);
extern int strncasecmp(const char *s1, const char *s2, size_t n);
#ifdef __cplusplus
}
#endif
#ifdef SCO
@ -101,8 +113,4 @@ extern int strncasecmp(const char *s1, const char *s2, size_t n);
#endif /* SCO */
#ifdef __cplusplus
}
#endif
#endif

View file

@ -40,15 +40,21 @@ typedef __SIZE_TYPE__ UintPtr;
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#endif
#if defined(WIN32) || defined(NDB_WIN32)
typedef Uint32 UintPtr;
#else
typedef uintptr_t UintPtr;
#endif
#endif
#if defined(WIN32) || defined(NDB_WIN32)
typedef unsigned __int64 Uint64;
typedef signed __int64 Int64;
typedef UintPtr ssize_t;
#else
typedef unsigned long long Uint64;
typedef signed long long Int64;
#endif
#endif

View file

@ -20,14 +20,25 @@
#include <ndb_global.h>
#include <version.h>
/* NDB build version */
#define NDB_VERSION_BUILD @NDB_VERSION_BUILD@
/* NDB major version */
#define NDB_VERSION_MAJOR @NDB_VERSION_MAJOR@
/* NDB minor version */
#define NDB_VERSION_MINOR @NDB_VERSION_MINOR@
/* NDB status version */
#define NDB_VERSION_STATUS "@NDB_VERSION_STATUS@"
#define MAKE_VERSION(A,B,C) (((A) << 16) | ((B) << 8) | ((C) << 0))
#define NDB_VERSION_D MAKE_VERSION(NDB_VERSION_MAJOR, NDB_VERSION_MINOR, NDB_VERSION_BUILD)
#define NDB_VERSION_STRING (getVersionString(NDB_VERSION, NDB_VERSION_STATUS))
#define NDB_VERSION_TAG_STRING "$Name: $"
#define NDB_VERSION ndbGetOwnVersion()
/**

View file

@ -202,7 +202,7 @@ public:
// "Error in blob head update forced rollback of transaction"
STATIC_CONST( ErrAbort = 4268 );
// "Unknown blob error"
STATIC_CONST( ErrUnknown = 4269 );
STATIC_CONST( ErrUnknown = 4270 );
/**
* Return info about all blobs in this operation.
*/

View file

@ -50,7 +50,7 @@ enum AbortOption {
TryCommit = 0, ///< <i>Missing explanation</i>
#endif
AbortOnError = 0, ///< Abort transaction on failed operation
IgnoreError = 2 ///< Transaction continues on failed operation
AO_IgnoreError = 2 ///< Transaction continues on failed operation
};
typedef AbortOption CommitType;

View file

@ -703,7 +703,7 @@ public:
/**
* Get a specific column in the index
*/
const NdbDictionary::Column * getColumn(unsigned no) const ;
const Column * getColumn(unsigned no) const ;
/**
* Get a specific column name in the index

View file

@ -39,6 +39,7 @@ public:
* @param batch No of rows to fetch from each fragment at a time
* @param LockMode Scan lock handling
* @param order_by Order result set in index order
* @param order_desc Order descending, ignored unless order_by
* @returns NdbResultSet.
* @see NdbScanOperation::readTuples
*/
@ -46,6 +47,7 @@ public:
Uint32 batch = 0,
Uint32 parallel = 0,
bool order_by = false,
bool order_desc = false,
bool read_range_no = false);
inline int readTuples(int parallell){
@ -128,6 +130,7 @@ public:
int get_range_no();
bool getSorted() const { return m_ordered; }
bool getDescending() const { return m_descending; }
private:
NdbIndexScanOperation(Ndb* aNdb);
virtual ~NdbIndexScanOperation();

View file

@ -232,7 +232,8 @@ protected:
int getKeyFromKEYINFO20(Uint32* data, unsigned size);
NdbOperation* takeOverScanOp(OperationType opType, NdbConnection*);
Uint32 m_ordered;
bool m_ordered;
bool m_descending;
Uint32 m_read_range_no;
};

View file

@ -20,7 +20,7 @@
class TransporterFacade;
class ConfigRetriever;
class NdbThread;
struct NdbThread;
extern "C" {
void* run_ndb_cluster_connection_connect_thread(void*);

View file

@ -40,7 +40,7 @@ typedef int socklen_t;
#define InetErrno (* inet_errno())
#elif NDB_WIN32
#elif defined NDB_WIN32
/**
* Include files needed

View file

@ -22,55 +22,12 @@
$Id: PortDefs.h,v 1.5 2003/10/07 07:59:59 mikael Exp $
*/
#ifdef NDB_WIN32
#include <time.h>
struct tms
{
time_t tms_utime; /* user time */
time_t tms_stime; /* system time */
time_t tms_cutime; /* user time of children */
time_t tms_cstime; /* system time of children */
};
struct timespec
{
long tv_sec; /* Seconds */
long tv_nsec; /* Nanoseconds */
};
#define strcasecmp(a,b) _strcmpi(a,b)
/* Exports a WIN32 getopt function */
extern int optind;
extern char *optarg;
int getopt(int, char **, char *opts);
#endif /* NDB_WIN32 */
#ifdef NDB_ALPHA
#ifdef NDB_GCC /* only for NDB_ALPHA */
extern int gnuShouldNotUseRPCC();
#define RPCC() gnuShouldNotUseRPCC();
#else
#ifdef NDB_WIN32
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
u_int64 __asm(char *, ...);
double __dasm(char *, ...);
float __fasm(char *, ...);
void _AcquireSpinLock(long *);
void _ReleaseSpinLock(long *);
int __ADD_ATOMIC_LONG2(void *, int);
#ifdef __cplusplus
};
#endif /* __cplusplus */
#pragma intrinsic (__asm, __dasm, __fasm)
#pragma intrinsic(_ReleaseSpinLock, _AcquireSpinLock)
#pragma intrinsic(__ADD_ATOMIC_LONG2)
#endif /* NDB_WIN32 */
#define RPCC() ((int)__asm(" rpcc v0;"))
#define MB() __asm(" mb;");
#define WMB() __asm(" wmb;");

View file

@ -226,8 +226,8 @@ public:
const char *m_interface;
};
Vector<Transporter_interface> m_transporter_interface;
void add_transporter_interface(NodeId remoteNodeId,
const char *interface, unsigned short port);
void add_transporter_interface(NodeId remoteNodeId, const char *interf,
unsigned short port);
Transporter* get_transporter(NodeId nodeId);
NodeId get_localNodeId() { return localNodeId; };

View file

@ -23,7 +23,7 @@
#include "NdbOut.hpp"
class ParserImpl;
template<class T> class ParserRow;
template<class T> struct ParserRow;
//#define PARSER_DEBUG
#ifdef PARSER_DEBUG
@ -130,11 +130,11 @@ public:
* The void* equivalent implementation
*/
class ParserImpl {
public:
class Dummy {};
typedef ParserRow<Dummy> DummyRow;
typedef Parser<Dummy>::Context Context;
template<class T> friend class Parser;
private:
ParserImpl(const DummyRow rows[], class InputStream & in,
bool b_cmd, bool b_empty, bool b_iarg);

View file

@ -38,20 +38,20 @@ public:
/**
* Value types
*/
enum ValueType {
enum ValueType {
Uint32Value = 0,
StringValue = 1,
BinaryValue = 2,
InvalidValue = 3
};
};
/**
* Struct for defining mapping to be used with unpack
*/
struct SP2StructMapping {
Uint16 Key;
Uint32 Offset;
SimpleProperties::ValueType Type;
ValueType Type;
Uint32 minValue;
Uint32 maxValue;
Uint32 Length_Offset; // Offset used for looking up length of
@ -233,7 +233,7 @@ private:
*/
class SimplePropertiesSectionReader : public SimpleProperties::Reader {
public:
SimplePropertiesSectionReader(class SegmentedSectionPtr &,
SimplePropertiesSectionReader(struct SegmentedSectionPtr &,
class SectionSegmentPool &);
virtual void reset();
@ -248,8 +248,8 @@ private:
Uint32 m_pos;
Uint32 m_len;
class SectionSegmentPool & m_pool;
class SectionSegment * m_head;
class SectionSegment * m_currentSegment;
struct SectionSegment * m_head;
struct SectionSegment * m_currentSegment;
};
inline
@ -275,15 +275,15 @@ public:
/**
* This "unlinks" the writer from the memory
*/
void getPtr(class SegmentedSectionPtr & dst);
void getPtr(struct SegmentedSectionPtr & dst);
private:
Int32 m_pos;
Uint32 m_sz;
class SectionSegmentPool & m_pool;
class SectionSegment * m_head;
struct SectionSegment * m_head;
Uint32 m_prevPtrI; // Prev to m_currentSegment
class SectionSegment * m_currentSegment;
struct SectionSegment * m_currentSegment;
};
#endif

View file

@ -98,7 +98,7 @@ public:
*/
void stopSessions(bool wait = false);
void foreachSession(void (*f)(SocketServer::Session*, void*), void *data);
void foreachSession(void (*f)(Session*, void*), void *data);
private:
struct SessionInstance {

View file

@ -16,3 +16,18 @@ libndbclient_la_LIBADD = \
common/logger/liblogger.la \
common/portlib/libportlib.la \
common/util/libgeneral.la
windoze-dsp: libndbclient.dsp
libndbclient.dsp: Makefile \
$(top_srcdir)/ndb/config/win-lib.am \
$(top_srcdir)/ndb/config/win-name \
$(top_srcdir)/ndb/config/win-includes \
$(top_srcdir)/ndb/config/win-sources \
$(top_srcdir)/ndb/config/win-libraries
cat $(top_srcdir)/ndb/config/win-lib.am > $@
@$(top_srcdir)/ndb/config/win-name $@ $(ndblib_LTLIBRARIES)
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
@$(top_srcdir)/ndb/config/win-sources $@ dummy.cpp
@$(top_srcdir)/ndb/config/win-libraries $@ LIB $(libndbclient_la_LIBADD)
@touch dummy.cpp

View file

@ -11,3 +11,5 @@ libcommon_la_LIBADD = \
portlib/libportlib.la \
logger/liblogger.la \
util/libgeneral.la
windoze-dsp:

View file

@ -1033,7 +1033,7 @@ EventLogger::getText(char * m_text, size_t m_text_len,
"Grep::SSCoord:Error code: %d Error message: %s"
" (subId=%d,SubKey=%d)",
err,
GrepError::getErrorDesc((GrepError::Code)err),
GrepError::getErrorDesc((GrepError::GE_Code)err),
subId,
subKey);
break;
@ -1050,7 +1050,7 @@ EventLogger::getText(char * m_text, size_t m_text_len,
subId,
subKey,
err,
GrepError::getErrorDesc((GrepError::Code)err));
GrepError::getErrorDesc((GrepError::GE_Code)err));
break;
}
case GrepEvent::GrepSS_SubStartMetaRef:
@ -1066,7 +1066,7 @@ EventLogger::getText(char * m_text, size_t m_text_len,
subId,
subKey,
err,
GrepError::getErrorDesc((GrepError::Code)err));
GrepError::getErrorDesc((GrepError::GE_Code)err));
break;
}
case GrepEvent::GrepSS_SubStartDataRef:
@ -1081,7 +1081,7 @@ EventLogger::getText(char * m_text, size_t m_text_len,
subId,
subKey,
err,
GrepError::getErrorDesc((GrepError::Code)err));
GrepError::getErrorDesc((GrepError::GE_Code)err));
break;
}
case GrepEvent::GrepSS_SubSyncMetaRef:
@ -1096,7 +1096,7 @@ EventLogger::getText(char * m_text, size_t m_text_len,
subId,
subKey,
err,
GrepError::getErrorDesc((GrepError::Code)err));
GrepError::getErrorDesc((GrepError::GE_Code)err));
break;
}
case GrepEvent::GrepSS_SubSyncDataRef:
@ -1113,7 +1113,7 @@ EventLogger::getText(char * m_text, size_t m_text_len,
subKey,
gci,
err,
GrepError::getErrorDesc((GrepError::Code)err));
GrepError::getErrorDesc((GrepError::GE_Code)err));
break;
}
case GrepEvent::GrepSS_SubRemoveRef:
@ -1128,7 +1128,7 @@ EventLogger::getText(char * m_text, size_t m_text_len,
subId,
subKey,
err,
GrepError::getErrorDesc((GrepError::Code)err)
GrepError::getErrorDesc((GrepError::GE_Code)err)
);
break;
}
@ -1142,7 +1142,7 @@ EventLogger::getText(char * m_text, size_t m_text_len,
"Grep::PSCoord: Error code: %d Error Message: %s"
" (subId=%d,SubKey=%d)",
err,
GrepError::getErrorDesc((GrepError::Code)err),
GrepError::getErrorDesc((GrepError::GE_Code)err),
subId,
subKey);
break;
@ -1159,7 +1159,7 @@ EventLogger::getText(char * m_text, size_t m_text_len,
subId,
subKey,
err,
GrepError::getErrorDesc((GrepError::Code)err));
GrepError::getErrorDesc((GrepError::GE_Code)err));
break;
}
case GrepEvent::GrepPS_SubStartMetaRef:
@ -1175,7 +1175,7 @@ EventLogger::getText(char * m_text, size_t m_text_len,
subId,
subKey,
err,
GrepError::getErrorDesc((GrepError::Code)err));
GrepError::getErrorDesc((GrepError::GE_Code)err));
break;
}
case GrepEvent::GrepPS_SubStartDataRef:
@ -1190,7 +1190,7 @@ EventLogger::getText(char * m_text, size_t m_text_len,
subId,
subKey,
err,
GrepError::getErrorDesc((GrepError::Code)err));
GrepError::getErrorDesc((GrepError::GE_Code)err));
break;
}
case GrepEvent::GrepPS_SubSyncMetaRef:
@ -1205,7 +1205,7 @@ EventLogger::getText(char * m_text, size_t m_text_len,
subId,
subKey,
err,
GrepError::getErrorDesc((GrepError::Code)err));
GrepError::getErrorDesc((GrepError::GE_Code)err));
break;
}
case GrepEvent::GrepPS_SubSyncDataRef:
@ -1222,7 +1222,7 @@ EventLogger::getText(char * m_text, size_t m_text_len,
subKey,
gci,
err,
GrepError::getErrorDesc((GrepError::Code)err));
GrepError::getErrorDesc((GrepError::GE_Code)err));
break;
}
case GrepEvent::GrepPS_SubRemoveRef:
@ -1237,7 +1237,7 @@ EventLogger::getText(char * m_text, size_t m_text_len,
subId,
subKey,
err,
GrepError::getErrorDesc((GrepError::Code)err));
GrepError::getErrorDesc((GrepError::GE_Code)err));
break;
}
case GrepEvent::Rep_Disconnect:
@ -1249,7 +1249,7 @@ EventLogger::getText(char * m_text, size_t m_text_len,
" Error code: %d Error Message: %s",
nodeId,
err,
GrepError::getErrorDesc((GrepError::Code)err));
GrepError::getErrorDesc((GrepError::GE_Code)err));
break;
}

View file

@ -21,7 +21,7 @@
*/
const GrepError::ErrorDescription GrepError::errorDescriptions[] = {
{ GrepError::NO_ERROR,
{ GrepError::GE_NO_ERROR,
"No error" },
{ GrepError::SUBSCRIPTION_ID_NOMEM,
"Not enough resources to allocate the subscription" },
@ -119,7 +119,7 @@ GrepError::noOfErrorDescs = sizeof(GrepError::errorDescriptions) /
* gets the corresponding error message to an err code
*/
const char *
GrepError::getErrorDesc(GrepError::Code err) {
GrepError::getErrorDesc(GrepError::GE_Code err) {
for(Uint32 i = 0; i<noOfErrorDescs; i++){
if(err == errorDescriptions[i].errCode){

View file

@ -9,3 +9,17 @@ include $(top_srcdir)/ndb/config/type_kernel.mk.am
# Don't update the files from bitkeeper
%::SCCS/s.%
windoze-dsp: libtrace.dsp
libtrace.dsp: Makefile \
$(top_srcdir)/ndb/config/win-lib.am \
$(top_srcdir)/ndb/config/win-name \
$(top_srcdir)/ndb/config/win-includes \
$(top_srcdir)/ndb/config/win-sources \
$(top_srcdir)/ndb/config/win-libraries
cat $(top_srcdir)/ndb/config/win-lib.am > $@
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LTLIBRARIES)
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
@$(top_srcdir)/ndb/config/win-sources $@ $(libtrace_la_SOURCES)
@$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD)

View file

@ -31,7 +31,7 @@ printFSCLOSEREQ(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiv
sig->userReference);
fprintf(output, " Flags: H\'%.8x, ", sig->fileFlag);
if (sig->getRemoveFileFlag(sig->fileFlag) == true)
if (sig->getRemoveFileFlag(sig->fileFlag))
fprintf(output, "Remove file");
else
fprintf(output, "Don't remove file");

View file

@ -31,7 +31,7 @@ printFSREADWRITEREQ(FILE * output, const Uint32 * theData,
fprintf(output, " UserReference: H\'%.8x", sig->userReference);
fprintf(output, " Operation flag: H\'%.8x (", sig->operationFlag);
if (sig->getSyncFlag(sig->operationFlag) == true)
if (sig->getSyncFlag(sig->operationFlag))
fprintf(output, "Sync,");
else
fprintf(output, "No sync,");

View file

@ -32,3 +32,16 @@ include $(top_srcdir)/ndb/config/type_ndbapi.mk.am
# Don't update the files from bitkeeper
%::SCCS/s.%
windoze-dsp: libsignaldataprint.dsp
libsignaldataprint.dsp: Makefile \
$(top_srcdir)/ndb/config/win-lib.am \
$(top_srcdir)/ndb/config/win-name \
$(top_srcdir)/ndb/config/win-includes \
$(top_srcdir)/ndb/config/win-sources \
$(top_srcdir)/ndb/config/win-libraries
cat $(top_srcdir)/ndb/config/win-lib.am > $@
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LTLIBRARIES)
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
@$(top_srcdir)/ndb/config/win-sources $@ $(libsignaldataprint_la_SOURCES)
@$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD)

View file

@ -30,13 +30,14 @@ printSCANTABREQ(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiv
fprintf(output, " apiConnectPtr: H\'%.8x",
sig->apiConnectPtr);
fprintf(output, " requestInfo: H\'%.8x:\n", requestInfo);
fprintf(output, " Parallellism: %u, Batch: %u LockMode: %u, Keyinfo: %u Holdlock: %u, RangeScan: %u ReadCommitted: %u\n DistributionKeyFlag: %u",
fprintf(output, " Parallellism: %u, Batch: %u LockMode: %u Keyinfo: %u Holdlock: %u RangeScan: %u Descending: %u ReadCommitted: %u\n DistributionKeyFlag: %u",
sig->getParallelism(requestInfo),
sig->getScanBatch(requestInfo),
sig->getLockMode(requestInfo),
sig->getKeyinfoFlag(requestInfo),
sig->getHoldLockFlag(requestInfo),
sig->getRangeScanFlag(requestInfo),
sig->getDescendingFlag(requestInfo),
sig->getReadCommittedFlag(requestInfo),
sig->getDistributionKeyFlag(requestInfo));

View file

@ -206,9 +206,9 @@ FileLogHandler::setMaxSize(const BaseString &size) {
long val = strtol(size.c_str(), &end, 0); /* XXX */
if(size.c_str() == end)
return false;
if(strncasecmp("M", end, 1) == 0)
if(end[0] == 'M')
val *= 1024*1024;
if(strncasecmp("k", end, 1) == 0)
if(end[0] == 'k')
val *= 1024;
m_maxFileSize = val;

View file

@ -18,6 +18,7 @@
#define LOGHANDLERLIST_H
class LogHandler;
#include <ndb_global.h>
/**
* Provides a simple linked list of log handlers.

View file

@ -186,13 +186,17 @@ Logger::addHandler(const BaseString &logstring) {
LogHandler *handler = NULL;
if(type == "SYSLOG") {
#ifndef NDB_WIN32
if(type == "SYSLOG")
{
handler = new SysLogHandler();
} else if(type == "FILE")
} else
#endif
if(type == "FILE")
handler = new FileLogHandler();
else if(type == "CONSOLE")
handler = new ConsoleLogHandler();
if(handler == NULL)
DBUG_RETURN(false);
if(!handler->parseParams(params))

View file

@ -1,11 +1,25 @@
noinst_LTLIBRARIES = liblogger.la
liblogger_la_SOURCES = Logger.cpp LogHandlerList.cpp LogHandler.cpp \
ConsoleLogHandler.cpp FileLogHandler.cpp SysLogHandler.cpp
SOURCE_WIN = Logger.cpp LogHandlerList.cpp LogHandler.cpp \
ConsoleLogHandler.cpp FileLogHandler.cpp
liblogger_la_SOURCES = $(SOURCE_WIN) SysLogHandler.cpp
include $(top_srcdir)/ndb/config/common.mk.am
include $(top_srcdir)/ndb/config/type_ndbapi.mk.am
# Don't update the files from bitkeeper
%::SCCS/s.%
windoze-dsp: liblogger.dsp
liblogger.dsp: Makefile \
$(top_srcdir)/ndb/config/win-lib.am \
$(top_srcdir)/ndb/config/win-name \
$(top_srcdir)/ndb/config/win-includes \
$(top_srcdir)/ndb/config/win-sources \
$(top_srcdir)/ndb/config/win-libraries
cat $(top_srcdir)/ndb/config/win-lib.am > $@
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LTLIBRARIES)
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
@$(top_srcdir)/ndb/config/win-sources $@ $(SOURCE_WIN)
@$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD)

View file

@ -141,9 +141,10 @@ ConfigRetriever::getConfig(NdbMgmHandle m_handle){
return conf;
}
ndb_mgm_configuration *
ConfigRetriever::getConfig(const char * filename){
#ifndef NDB_WIN32
struct stat sbuf;
const int res = stat(filename, &sbuf);
@ -180,8 +181,10 @@ ConfigRetriever::getConfig(const char * filename){
return 0;
}
delete [] buf2;
return (ndb_mgm_configuration*)cvf.m_cfg;
#else
return 0;
#endif
}
void

View file

@ -12,3 +12,17 @@ include $(top_srcdir)/ndb/config/type_mgmapiclient.mk.am
# Don't update the files from bitkeeper
%::SCCS/s.%
windoze-dsp: libmgmsrvcommon.dsp
libmgmsrvcommon.dsp: Makefile \
$(top_srcdir)/ndb/config/win-lib.am \
$(top_srcdir)/ndb/config/win-name \
$(top_srcdir)/ndb/config/win-includes \
$(top_srcdir)/ndb/config/win-sources \
$(top_srcdir)/ndb/config/win-libraries
cat $(top_srcdir)/ndb/config/win-lib.am > $@
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LTLIBRARIES)
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
@$(top_srcdir)/ndb/config/win-sources $@ $(libmgmsrvcommon_la_SOURCES)
@$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD)

View file

@ -17,3 +17,27 @@ PortLibTest_SOURCES = NdbPortLibTest.cpp
munmaptest_SOURCES = munmaptest.cpp
# Don't update the files from bitkeeper
WIN_src = win32/NdbCondition.c \
win32/NdbDaemon.c \
win32/NdbEnv.c \
win32/NdbHost.c \
win32/NdbMem.c \
win32/NdbMutex.c \
win32/NdbSleep.c \
win32/NdbTCP.c \
win32/NdbThread.c \
win32/NdbTick.c
windoze-dsp: libportlib.dsp
libportlib.dsp: Makefile \
$(top_srcdir)/ndb/config/win-lib.am \
$(top_srcdir)/ndb/config/win-name \
$(top_srcdir)/ndb/config/win-includes \
$(top_srcdir)/ndb/config/win-sources \
$(top_srcdir)/ndb/config/win-libraries
cat $(top_srcdir)/ndb/config/win-lib.am > $@
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LTLIBRARIES)
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
@$(top_srcdir)/ndb/config/win-sources $@ $(WIN_src)
@$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD)

View file

@ -18,6 +18,7 @@
#include <NdbConfig.h>
#include <NdbEnv.h>
#include <NdbMem.h>
#include <basestring_vsnprintf.h>
static const char *datadir_path= 0;
@ -48,7 +49,7 @@ NdbConfig_AllocHomePath(int _len)
const char *path= NdbConfig_get_path(&path_len);
int len= _len+path_len;
char *buf= NdbMem_Allocate(len);
snprintf(buf, len, "%s%s", path, DIR_SEPARATOR);
basestring_snprintf(buf, len, "%s%s", path, DIR_SEPARATOR);
return buf;
}
@ -67,7 +68,7 @@ NdbConfig_NdbCfgName(int with_ndb_home){
len= strlen(buf);
} else
buf= NdbMem_Allocate(128);
snprintf(buf+len, 128, "Ndb.cfg");
basestring_snprintf(buf+len, 128, "Ndb.cfg");
return buf;
}
@ -77,9 +78,9 @@ char *get_prefix_buf(int len, int node_id)
char tmp_buf[sizeof("ndb_pid#############")+1];
char *buf;
if (node_id > 0)
snprintf(tmp_buf, sizeof(tmp_buf), "ndb_%u", node_id);
basestring_snprintf(tmp_buf, sizeof(tmp_buf), "ndb_%u", node_id);
else
snprintf(tmp_buf, sizeof(tmp_buf), "ndb_pid%u", getpid());
basestring_snprintf(tmp_buf, sizeof(tmp_buf), "ndb_pid%u", getpid());
tmp_buf[sizeof(tmp_buf)-1]= 0;
buf= NdbConfig_AllocHomePath(len+strlen(tmp_buf));
@ -91,7 +92,7 @@ char*
NdbConfig_ErrorFileName(int node_id){
char *buf= get_prefix_buf(128, node_id);
int len= strlen(buf);
snprintf(buf+len, 128, "_error.log");
basestring_snprintf(buf+len, 128, "_error.log");
return buf;
}
@ -99,7 +100,7 @@ char*
NdbConfig_ClusterLogFileName(int node_id){
char *buf= get_prefix_buf(128, node_id);
int len= strlen(buf);
snprintf(buf+len, 128, "_cluster.log");
basestring_snprintf(buf+len, 128, "_cluster.log");
return buf;
}
@ -107,7 +108,7 @@ char*
NdbConfig_SignalLogFileName(int node_id){
char *buf= get_prefix_buf(128, node_id);
int len= strlen(buf);
snprintf(buf+len, 128, "_signal.log");
basestring_snprintf(buf+len, 128, "_signal.log");
return buf;
}
@ -115,7 +116,7 @@ char*
NdbConfig_TraceFileName(int node_id, int file_no){
char *buf= get_prefix_buf(128, node_id);
int len= strlen(buf);
snprintf(buf+len, 128, "_trace.log.%u", file_no);
basestring_snprintf(buf+len, 128, "_trace.log.%u", file_no);
return buf;
}
@ -123,7 +124,7 @@ char*
NdbConfig_NextTraceFileName(int node_id){
char *buf= get_prefix_buf(128, node_id);
int len= strlen(buf);
snprintf(buf+len, 128, "_trace.log.next");
basestring_snprintf(buf+len, 128, "_trace.log.next");
return buf;
}
@ -131,7 +132,7 @@ char*
NdbConfig_PidFileName(int node_id){
char *buf= get_prefix_buf(128, node_id);
int len= strlen(buf);
snprintf(buf+len, 128, ".pid");
basestring_snprintf(buf+len, 128, ".pid");
return buf;
}
@ -139,6 +140,6 @@ char*
NdbConfig_StdoutFileName(int node_id){
char *buf= get_prefix_buf(128, node_id);
int len= strlen(buf);
snprintf(buf+len, 128, "_out.log");
basestring_snprintf(buf+len, 128, "_out.log");
return buf;
}

View file

@ -0,0 +1,178 @@
/* Copyright (C) 2003 MySQL AB
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; either version 2 of the License, or
(at your option) any later version.
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 */
#include <ndb_global.h>
#include "NdbCondition.h"
#include <NdbMutex.h>
struct NdbCondition
{
long nWaiters;
NdbMutex* pNdbMutexWaitersLock;
HANDLE hSemaphore;
HANDLE hEventWaitersDone;
int bWasBroadcast;
};
struct NdbCondition*
NdbCondition_Create(void)
{
int result = 0;
struct NdbCondition* pNdbCondition = (struct NdbCondition*)malloc(sizeof(struct NdbCondition));
if(!pNdbCondition)
return 0;
pNdbCondition->nWaiters = 0;
pNdbCondition->bWasBroadcast = 0;
if(!(pNdbCondition->hSemaphore = CreateSemaphore(0, 0, MAXLONG, 0)))
result = -1;
else if(!(pNdbCondition->pNdbMutexWaitersLock = NdbMutex_Create()))
result = -1;
else if(!(pNdbCondition->hEventWaitersDone = CreateEvent(0, 0, 0, 0)))
result = -1;
assert(!result);
return pNdbCondition;
}
int
NdbCondition_Wait(struct NdbCondition* p_cond,
NdbMutex* p_mutex)
{
int result;
int bLastWaiter;
if(!p_cond || !p_mutex)
return 1;
NdbMutex_Lock(p_cond->pNdbMutexWaitersLock);
p_cond->nWaiters++;
NdbMutex_Unlock(p_cond->pNdbMutexWaitersLock);
if(NdbMutex_Unlock(p_mutex))
return -1;
result = WaitForSingleObject (p_cond->hSemaphore, INFINITE);
NdbMutex_Lock(p_cond->pNdbMutexWaitersLock);
p_cond->nWaiters--;
bLastWaiter = (p_cond->bWasBroadcast && p_cond->nWaiters==0);
NdbMutex_Unlock(p_cond->pNdbMutexWaitersLock);
if(result==WAIT_OBJECT_0 && bLastWaiter)
SetEvent(p_cond->hEventWaitersDone);
NdbMutex_Lock(p_mutex);
return result;
}
int
NdbCondition_WaitTimeout(struct NdbCondition* p_cond,
NdbMutex* p_mutex,
int msecs)
{
int result;
int bLastWaiter;
if (!p_cond || !p_mutex)
return 1;
NdbMutex_Lock(p_cond->pNdbMutexWaitersLock);
p_cond->nWaiters++;
NdbMutex_Unlock(p_cond->pNdbMutexWaitersLock);
if(msecs<0)
msecs = 0;
if(NdbMutex_Unlock(p_mutex))
return -1;
result = WaitForSingleObject(p_cond->hSemaphore, msecs);
NdbMutex_Lock(p_cond->pNdbMutexWaitersLock);
p_cond->nWaiters--;
bLastWaiter = (p_cond->bWasBroadcast && p_cond->nWaiters==0);
NdbMutex_Unlock(p_cond->pNdbMutexWaitersLock);
if(result!=WAIT_OBJECT_0)
result = -1;
if(bLastWaiter)
SetEvent(p_cond->hEventWaitersDone);
NdbMutex_Lock(p_mutex);
return result;
}
int
NdbCondition_Signal(struct NdbCondition* p_cond)
{
int bHaveWaiters;
if(!p_cond)
return 1;
NdbMutex_Lock(p_cond->pNdbMutexWaitersLock);
bHaveWaiters = (p_cond->nWaiters > 0);
NdbMutex_Unlock(p_cond->pNdbMutexWaitersLock);
if(bHaveWaiters)
return (ReleaseSemaphore(p_cond->hSemaphore, 1, 0) ? 0 : -1);
else
return 0;
}
int NdbCondition_Broadcast(struct NdbCondition* p_cond)
{
int bHaveWaiters;
int result = 0;
if(!p_cond)
return 1;
NdbMutex_Lock(p_cond->pNdbMutexWaitersLock);
bHaveWaiters = 0;
if(p_cond->nWaiters > 0)
{
p_cond->bWasBroadcast = !0;
bHaveWaiters = 1;
}
NdbMutex_Unlock(p_cond->pNdbMutexWaitersLock);
if(bHaveWaiters)
{
if(!ReleaseSemaphore(p_cond->hSemaphore, p_cond->nWaiters, 0))
result = -1;
else if(WaitForSingleObject (p_cond->hEventWaitersDone, INFINITE) != WAIT_OBJECT_0)
result = -1;
p_cond->bWasBroadcast = 0;
}
return result;
}
int NdbCondition_Destroy(struct NdbCondition* p_cond)
{
int result;
if(!p_cond)
return 1;
CloseHandle(p_cond->hEventWaitersDone);
NdbMutex_Destroy(p_cond->pNdbMutexWaitersLock);
result = (CloseHandle(p_cond->hSemaphore) ? 0 : -1);
free(p_cond);
return 0;
}

View file

@ -0,0 +1,44 @@
/* Copyright (C) 2003 MySQL AB
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; either version 2 of the License, or
(at your option) any later version.
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 */
#include "NdbDaemon.h"
#define NdbDaemon_ErrorSize 500
long NdbDaemon_DaemonPid;
int NdbDaemon_ErrorCode;
char NdbDaemon_ErrorText[NdbDaemon_ErrorSize];
int
NdbDaemon_Make(const char* lockfile, const char* logfile, unsigned flags)
{
// XXX do something
return 0;
}
#ifdef NDB_DAEMON_TEST
int
main()
{
if (NdbDaemon_Make("test.pid", "test.log", 0) == -1) {
fprintf(stderr, "NdbDaemon_Make: %s\n", NdbDaemon_ErrorText);
return 1;
}
sleep(10);
return 0;
}
#endif

View file

@ -0,0 +1,31 @@
/* Copyright (C) 2003 MySQL AB
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; either version 2 of the License, or
(at your option) any later version.
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 */
#include <ndb_global.h>
#include "NdbEnv.h"
const char* NdbEnv_GetEnv(const char* name, char * buf, int buflen)
{
char* p = NULL;
p = getenv(name);
if (p != NULL && buf != NULL){
strncpy(buf, p, buflen);
buf[buflen-1] = 0;
}
return p;
}

View file

@ -0,0 +1,52 @@
/* Copyright (C) 2003 MySQL AB
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; either version 2 of the License, or
(at your option) any later version.
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 */
#include <ndb_global.h>
#include "NdbHost.h"
int NdbHost_GetHostName(char* buf)
{
/* We must initialize TCP/IP if we want to call gethostname */
WORD wVersionRequested;
WSADATA wsaData;
int err;
wVersionRequested = MAKEWORD( 2, 0 );
err = WSAStartup( wVersionRequested, &wsaData );
if ( err != 0 ) {
/**
* Tell the user that we couldn't find a usable
* WinSock DLL.
*/
return -1;
}
/* Get host name */
if(gethostname(buf, MAXHOSTNAMELEN))
{
return -1;
}
return 0;
}
int NdbHost_GetProcessId(void)
{
return _getpid();
}

View file

@ -0,0 +1,283 @@
/* Copyright (C) 2003 MySQL AB
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; either version 2 of the License, or
(at your option) any later version.
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 */
#include <ndb_global.h>
#include "NdbMem.h"
#if 0
struct AWEINFO
{
SIZE_T dwSizeInBytesRequested;
ULONG_PTR nNumberOfPagesRequested;
ULONG_PTR nNumberOfPagesActual;
ULONG_PTR nNumberOfPagesFreed;
ULONG_PTR* pnPhysicalMemoryPageArray;
void* pRegionReserved;
};
const size_t cNdbMem_nMaxAWEinfo = 256;
size_t gNdbMem_nAWEinfo = 0;
struct AWEINFO* gNdbMem_pAWEinfo = 0;
void ShowLastError(const char* szContext, const char* szFunction)
{
DWORD dwError = GetLastError();
LPVOID lpMsgBuf;
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
dwError,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPTSTR)&lpMsgBuf,
0,
NULL
);
printf("%s : %s failed : %lu : %s\n", szContext, szFunction, dwError, (char*)lpMsgBuf);
LocalFree(lpMsgBuf);
}
void NdbMem_Create()
{
// Address Windowing Extensions
struct PRIVINFO
{
DWORD Count;
LUID_AND_ATTRIBUTES Privilege[1];
} Info;
HANDLE hProcess = GetCurrentProcess();
HANDLE hToken;
if(!OpenProcessToken(hProcess, TOKEN_ADJUST_PRIVILEGES, &hToken))
{
ShowLastError("NdbMem_Create", "OpenProcessToken");
}
Info.Count = 1;
Info.Privilege[0].Attributes = SE_PRIVILEGE_ENABLED;
if(!LookupPrivilegeValue(0, SE_LOCK_MEMORY_NAME, &(Info.Privilege[0].Luid)))
{
ShowLastError("NdbMem_Create", "LookupPrivilegeValue");
}
if(!AdjustTokenPrivileges(hToken, FALSE, (PTOKEN_PRIVILEGES)&Info, 0, 0, 0))
{
ShowLastError("NdbMem_Create", "AdjustTokenPrivileges");
}
if(!CloseHandle(hToken))
{
ShowLastError("NdbMem_Create", "CloseHandle");
}
return;
}
void NdbMem_Destroy()
{
/* Do nothing */
return;
}
void* NdbMem_Allocate(size_t size)
{
// Address Windowing Extensions
struct AWEINFO* pAWEinfo;
HANDLE hProcess;
SYSTEM_INFO sysinfo;
if(!gNdbMem_pAWEinfo)
{
gNdbMem_pAWEinfo = VirtualAlloc(0,
sizeof(struct AWEINFO)*cNdbMem_nMaxAWEinfo,
MEM_COMMIT|MEM_RESERVE, PAGE_READWRITE);
}
assert(gNdbMem_nAWEinfo < cNdbMem_nMaxAWEinfo);
pAWEinfo = gNdbMem_pAWEinfo+gNdbMem_nAWEinfo++;
hProcess = GetCurrentProcess();
GetSystemInfo(&sysinfo);
pAWEinfo->nNumberOfPagesRequested = (size+sysinfo.dwPageSize-1)/sysinfo.dwPageSize;
pAWEinfo->pnPhysicalMemoryPageArray = VirtualAlloc(0,
sizeof(ULONG_PTR)*pAWEinfo->nNumberOfPagesRequested,
MEM_COMMIT|MEM_RESERVE, PAGE_READWRITE);
pAWEinfo->nNumberOfPagesActual = pAWEinfo->nNumberOfPagesRequested;
if(!AllocateUserPhysicalPages(hProcess, &(pAWEinfo->nNumberOfPagesActual), pAWEinfo->pnPhysicalMemoryPageArray))
{
ShowLastError("NdbMem_Allocate", "AllocateUserPhysicalPages");
return 0;
}
if(pAWEinfo->nNumberOfPagesRequested != pAWEinfo->nNumberOfPagesActual)
{
ShowLastError("NdbMem_Allocate", "nNumberOfPagesRequested != nNumberOfPagesActual");
return 0;
}
pAWEinfo->dwSizeInBytesRequested = size;
pAWEinfo->pRegionReserved = VirtualAlloc(0, pAWEinfo->dwSizeInBytesRequested, MEM_RESERVE | MEM_PHYSICAL, PAGE_READWRITE);
if(!pAWEinfo->pRegionReserved)
{
ShowLastError("NdbMem_Allocate", "VirtualAlloc");
return 0;
}
if(!MapUserPhysicalPages(pAWEinfo->pRegionReserved, pAWEinfo->nNumberOfPagesActual, pAWEinfo->pnPhysicalMemoryPageArray))
{
ShowLastError("NdbMem_Allocate", "MapUserPhysicalPages");
return 0;
}
/*
printf("allocate AWE memory: %lu bytes, %lu pages, address %lx\n",
pAWEinfo->dwSizeInBytesRequested,
pAWEinfo->nNumberOfPagesActual,
pAWEinfo->pRegionReserved);
*/
return pAWEinfo->pRegionReserved;
}
void* NdbMem_AllocateAlign(size_t size, size_t alignment)
{
/*
return (void*)memalign(alignment, size);
TEMP fix
*/
return NdbMem_Allocate(size);
}
void NdbMem_Free(void* ptr)
{
// VirtualFree(ptr, 0, MEM_DECOMMIT|MEM_RELEASE);
// Address Windowing Extensions
struct AWEINFO* pAWEinfo = 0;
size_t i;
HANDLE hProcess;
for(i=0; i<gNdbMem_nAWEinfo; ++i)
{
if(ptr==gNdbMem_pAWEinfo[i].pRegionReserved)
{
pAWEinfo = gNdbMem_pAWEinfo+i;
}
}
if(!pAWEinfo)
{
ShowLastError("NdbMem_Free", "ptr is not AWE memory");
}
hProcess = GetCurrentProcess();
if(!MapUserPhysicalPages(ptr, pAWEinfo->nNumberOfPagesActual, 0))
{
ShowLastError("NdbMem_Free", "MapUserPhysicalPages");
}
if(!VirtualFree(ptr, 0, MEM_RELEASE))
{
ShowLastError("NdbMem_Free", "VirtualFree");
}
pAWEinfo->nNumberOfPagesFreed = pAWEinfo->nNumberOfPagesActual;
if(!FreeUserPhysicalPages(hProcess, &(pAWEinfo->nNumberOfPagesFreed), pAWEinfo->pnPhysicalMemoryPageArray))
{
ShowLastError("NdbMem_Free", "FreeUserPhysicalPages");
}
VirtualFree(pAWEinfo->pnPhysicalMemoryPageArray, 0, MEM_DECOMMIT|MEM_RELEASE);
}
int NdbMem_MemLockAll()
{
/*
HANDLE hProcess = GetCurrentProcess();
SIZE_T nMinimumWorkingSetSize;
SIZE_T nMaximumWorkingSetSize;
GetProcessWorkingSetSize(hProcess, &nMinimumWorkingSetSize, &nMaximumWorkingSetSize);
ndbout << "nMinimumWorkingSetSize=" << nMinimumWorkingSetSize << ", nMaximumWorkingSetSize=" << nMaximumWorkingSetSize << endl;
SetProcessWorkingSetSize(hProcess, 50000000, 100000000);
GetProcessWorkingSetSize(hProcess, &nMinimumWorkingSetSize, &nMaximumWorkingSetSize);
ndbout << "nMinimumWorkingSetSize=" << nMinimumWorkingSetSize << ", nMaximumWorkingSetSize=" << nMaximumWorkingSetSize << endl;
*/
return -1;
}
int NdbMem_MemUnlockAll()
{
//VirtualUnlock();
return -1;
}
#endif
void NdbMem_Create()
{
/* Do nothing */
return;
}
void NdbMem_Destroy()
{
/* Do nothing */
return;
}
void* NdbMem_Allocate(size_t size)
{
void* mem_allocated;
assert(size > 0);
mem_allocated= (void*)malloc(size);
return mem_allocated;
}
void* NdbMem_AllocateAlign(size_t size, size_t alignment)
{
(void)alignment; /* remove warning for unused parameter */
/*
return (void*)memalign(alignment, size);
TEMP fix
*/
return (void*)malloc(size);
}
void NdbMem_Free(void* ptr)
{
free(ptr);
}
int NdbMem_MemLockAll()
{
return 0;
}
int NdbMem_MemUnlockAll()
{
return 0;
}

View file

@ -0,0 +1,73 @@
/* Copyright (C) 2003 MySQL AB
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; either version 2 of the License, or
(at your option) any later version.
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 */
#include <ndb_global.h>
#include "NdbMutex.h"
NdbMutex* NdbMutex_Create(void)
{
NdbMutex* pNdbMutex = (NdbMutex*)malloc(sizeof(NdbMutex));
if(!pNdbMutex)
return 0;
InitializeCriticalSection(pNdbMutex);
return pNdbMutex;
}
int NdbMutex_Destroy(NdbMutex* p_mutex)
{
if(!p_mutex)
return -1;
DeleteCriticalSection(p_mutex);
free(p_mutex);
return 0;
}
int NdbMutex_Lock(NdbMutex* p_mutex)
{
if(!p_mutex)
return -1;
EnterCriticalSection (p_mutex);
return 0;
}
int NdbMutex_Unlock(NdbMutex* p_mutex)
{
if(!p_mutex)
return -1;
LeaveCriticalSection(p_mutex);
return 0;
}
int NdbMutex_Trylock(NdbMutex* p_mutex)
{
int result = -1;
if(p_mutex)
{
result = NdbMutex_Lock(p_mutex);
//(TryEnterCriticalSection(p_mutex) ? 0 : -1);
}
return result;
}

View file

@ -0,0 +1,32 @@
/* Copyright (C) 2003 MySQL AB
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; either version 2 of the License, or
(at your option) any later version.
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 */
#include <ndb_global.h>
#include "NdbSleep.h"
int
NdbSleep_MilliSleep(int milliseconds)
{
Sleep(milliseconds);
return 0;
}
int
NdbSleep_SecSleep(int seconds)
{
return NdbSleep_MilliSleep(seconds*1000);
}

View file

@ -0,0 +1,39 @@
/* Copyright (C) 2003 MySQL AB
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; either version 2 of the License, or
(at your option) any later version.
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 */
#include <ndb_global.h>
#include "NdbTCP.h"
int
Ndb_getInAddr(struct in_addr * dst, const char *address)
{
struct hostent * hostPtr;
/* Try it as aaa.bbb.ccc.ddd. */
dst->s_addr = inet_addr(address);
if (dst->s_addr != -1) {
return 0;
}
hostPtr = gethostbyname(address);
if (hostPtr != NULL) {
dst->s_addr = ((struct in_addr *) *hostPtr->h_addr_list)->s_addr;
return 0;
}
return -1;
}

View file

@ -0,0 +1,114 @@
/* Copyright (C) 2003 MySQL AB
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; either version 2 of the License, or
(at your option) any later version.
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 */
#include <ndb_global.h>
#include "NdbThread.h"
#include <process.h>
#define MAX_THREAD_NAME 16
typedef unsigned (WINAPI* NDB_WIN32_THREAD_FUNC)(void*);
struct NdbThread
{
HANDLE hThread;
unsigned nThreadId;
char thread_name[MAX_THREAD_NAME];
};
struct NdbThread* NdbThread_Create(NDB_THREAD_FUNC *p_thread_func,
NDB_THREAD_ARG *p_thread_arg,
const NDB_THREAD_STACKSIZE thread_stack_size,
const char* p_thread_name,
NDB_THREAD_PRIO thread_prio)
{
struct NdbThread* tmpThread;
unsigned initflag;
int nPriority = 0;
if(!p_thread_func)
return 0;
tmpThread = (struct NdbThread*)malloc(sizeof(struct NdbThread));
if(!tmpThread)
return 0;
strncpy((char*)&tmpThread->thread_name, p_thread_name, MAX_THREAD_NAME);
switch(thread_prio)
{
case NDB_THREAD_PRIO_HIGHEST: nPriority=THREAD_PRIORITY_HIGHEST; break;
case NDB_THREAD_PRIO_HIGH: nPriority=THREAD_PRIORITY_ABOVE_NORMAL; break;
case NDB_THREAD_PRIO_MEAN: nPriority=THREAD_PRIORITY_NORMAL; break;
case NDB_THREAD_PRIO_LOW: nPriority=THREAD_PRIORITY_BELOW_NORMAL; break;
case NDB_THREAD_PRIO_LOWEST: nPriority=THREAD_PRIORITY_LOWEST; break;
}
initflag = (nPriority ? CREATE_SUSPENDED : 0);
tmpThread->hThread = (HANDLE)_beginthreadex(0, thread_stack_size,
(NDB_WIN32_THREAD_FUNC)p_thread_func, p_thread_arg,
initflag, &tmpThread->nThreadId);
if(nPriority && tmpThread->hThread)
{
SetThreadPriority(tmpThread->hThread, nPriority);
ResumeThread (tmpThread->hThread);
}
assert(tmpThread->hThread);
return tmpThread;
}
void NdbThread_Destroy(struct NdbThread** p_thread)
{
CloseHandle((*p_thread)->hThread);
(*p_thread)->hThread = 0;
free(*p_thread);
*p_thread = 0;
}
int NdbThread_WaitFor(struct NdbThread* p_wait_thread, void** status)
{
void *local_status = 0;
if (status == 0)
status = &local_status;
if(WaitForSingleObject(p_wait_thread->hThread, INFINITE) == WAIT_OBJECT_0
&& GetExitCodeThread(p_wait_thread->hThread, (LPDWORD)status))
{
CloseHandle(p_wait_thread->hThread);
p_wait_thread->hThread = 0;
return 0;
}
return -1;
}
void NdbThread_Exit(int status)
{
_endthreadex((DWORD) status);
}
int NdbThread_SetConcurrencyLevel(int level)
{
return 0;
}

View file

@ -0,0 +1,64 @@
/* Copyright (C) 2003 MySQL AB
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; either version 2 of the License, or
(at your option) any later version.
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 */
#include <ndb_global.h>
#include "NdbTick.h"
//#include <windows.h>
/*
#define FILETIME_PER_MICROSEC 10
#define FILETIME_PER_MILLISEC 10000
#define FILETIME_PER_SEC 10000000
NDB_TICKS NdbTick_CurrentMillisecond(void)
{
ULONGLONG ullTime;
GetSystemTimeAsFileTime((LPFILETIME)&ullTime);
return (ullTime / FILETIME_PER_MILLISEC);
}
int
NdbTick_CurrentMicrosecond(NDB_TICKS * secs, Uint32 * micros)
{
ULONGLONG ullTime;
GetSystemTimeAsFileTime((LPFILETIME)&ullTime);
*secs = (ullTime / FILETIME_PER_SEC);
*micros = (Uint32)((ullTime % FILETIME_PER_SEC) / FILETIME_PER_MICROSEC);
return 0;
}
*/
NDB_TICKS NdbTick_CurrentMillisecond(void)
{
LARGE_INTEGER liCount, liFreq;
QueryPerformanceCounter(&liCount);
QueryPerformanceFrequency(&liFreq);
return (liCount.QuadPart*1000) / liFreq.QuadPart;
}
int
NdbTick_CurrentMicrosecond(NDB_TICKS * secs, Uint32 * micros)
{
LARGE_INTEGER liCount, liFreq;
QueryPerformanceCounter(&liCount);
QueryPerformanceFrequency(&liFreq);
*secs = liCount.QuadPart / liFreq.QuadPart;
liCount.QuadPart -= *secs * liFreq.QuadPart;
*micros = (liCount.QuadPart*1000000) / liFreq.QuadPart;
return 0;
}

View file

@ -20,3 +20,17 @@ include $(top_srcdir)/ndb/config/type_util.mk.am
# Don't update the files from bitkeeper
%::SCCS/s.%
windoze-dsp: libtransporter.dsp
libtransporter.dsp: Makefile \
$(top_srcdir)/ndb/config/win-lib.am \
$(top_srcdir)/ndb/config/win-name \
$(top_srcdir)/ndb/config/win-includes \
$(top_srcdir)/ndb/config/win-sources \
$(top_srcdir)/ndb/config/win-libraries
cat $(top_srcdir)/ndb/config/win-lib.am > $@
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LTLIBRARIES)
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
@$(top_srcdir)/ndb/config/win-sources $@ $(libtransporter_la_SOURCES)
@$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD)

View file

@ -95,7 +95,7 @@ Transporter::connect_client() {
return true;
NDB_SOCKET_TYPE sockfd = m_socket_client->connect();
if (sockfd < 0)
if (sockfd == NDB_INVALID_SOCKET)
return false;
// send info about own id

View file

@ -1181,25 +1181,25 @@ TransporterRegistry::stop_clients()
void
TransporterRegistry::add_transporter_interface(NodeId remoteNodeId,
const char *interface,
const char *interf,
unsigned short port)
{
DBUG_ENTER("TransporterRegistry::add_transporter_interface");
DBUG_PRINT("enter",("interface=%s, port= %d", interface, port));
if (interface && strlen(interface) == 0)
interface= 0;
DBUG_PRINT("enter",("interface=%s, port= %d", interf, port));
if (interf && strlen(interf) == 0)
interf= 0;
for (unsigned i= 0; i < m_transporter_interface.size(); i++)
{
Transporter_interface &tmp= m_transporter_interface[i];
if (port != tmp.m_service_port)
continue;
if (interface != 0 && tmp.m_interface != 0 &&
strcmp(interface, tmp.m_interface) == 0)
if (interf != 0 && tmp.m_interface != 0 &&
strcmp(interf, tmp.m_interface) == 0)
{
DBUG_VOID_RETURN; // found match, no need to insert
}
if (interface == 0 && tmp.m_interface == 0)
if (interf == 0 && tmp.m_interface == 0)
{
DBUG_VOID_RETURN; // found match, no need to insert
}
@ -1207,7 +1207,7 @@ TransporterRegistry::add_transporter_interface(NodeId remoteNodeId,
Transporter_interface t;
t.m_remote_nodeId= remoteNodeId;
t.m_service_port= port;
t.m_interface= interface;
t.m_interface= interf;
m_transporter_interface.push_back(t);
DBUG_PRINT("exit",("interface and port added"));
DBUG_VOID_RETURN;
@ -1216,7 +1216,7 @@ TransporterRegistry::add_transporter_interface(NodeId remoteNodeId,
bool
TransporterRegistry::start_service(SocketServer& socket_server)
{
if (m_transporter_interface.size() > 0 && nodeIdSpecified != true)
if (m_transporter_interface.size() > 0 && !nodeIdSpecified)
{
ndbout_c("TransporterRegistry::startReceiving: localNodeId not specified");
return false;

View file

@ -19,6 +19,7 @@
#include <File.hpp>
#include <NdbOut.hpp>
#include <my_dir.h>
//
// PUBLIC
@ -28,9 +29,12 @@ bool
File_class::exists(const char* aFileName)
{
bool rc = true;
#ifdef USE_MY_STAT_STRUCT
struct my_stat stmp;
#else
struct stat stmp;
if (::stat(aFileName, &stmp) != 0)
#endif
if (my_stat(aFileName, &stmp, MYF(0)) != 0)
{
rc = false;
}

View file

@ -33,3 +33,17 @@ include $(top_srcdir)/ndb/config/type_util.mk.am
# Don't update the files from bitkeeper
%::SCCS/s.%
windoze-dsp: libgeneral.dsp
libgeneral.dsp: Makefile \
$(top_srcdir)/ndb/config/win-lib.am \
$(top_srcdir)/ndb/config/win-name \
$(top_srcdir)/ndb/config/win-includes \
$(top_srcdir)/ndb/config/win-sources \
$(top_srcdir)/ndb/config/win-libraries
cat $(top_srcdir)/ndb/config/win-lib.am > $@
@$(top_srcdir)/ndb/config/win-name $@ $(noinst_LTLIBRARIES)
@$(top_srcdir)/ndb/config/win-includes $@ $(INCLUDES)
@$(top_srcdir)/ndb/config/win-sources $@ $(libgeneral_la_SOURCES)
@$(top_srcdir)/ndb/config/win-libraries $@ LIB $(LDADD)

View file

@ -881,7 +881,7 @@ PropertiesImpl::unpack(const Uint32 * buf, Uint32 &bufLen, Properties * top,
case PropertiesType_Properties:
assert(0);
}
if(res3 != true){
if(!res3){
return false;
}
_items--;

View file

@ -26,14 +26,14 @@ SocketClient::SocketClient(const char *server_name, unsigned short port, SocketA
m_auth= sa;
m_port= port;
m_server_name= strdup(server_name);
m_sockfd= -1;
m_sockfd= NDB_INVALID_SOCKET;
}
SocketClient::~SocketClient()
{
if (m_server_name)
free(m_server_name);
if (m_sockfd >= 0)
if (m_sockfd != NDB_INVALID_SOCKET)
NDB_CLOSE_SOCKET(m_sockfd);
if (m_auth)
delete m_auth;
@ -42,7 +42,7 @@ SocketClient::~SocketClient()
bool
SocketClient::init()
{
if (m_sockfd >= 0)
if (m_sockfd != NDB_INVALID_SOCKET)
NDB_CLOSE_SOCKET(m_sockfd);
memset(&m_servaddr, 0, sizeof(m_servaddr));
@ -63,32 +63,32 @@ SocketClient::init()
NDB_SOCKET_TYPE
SocketClient::connect()
{
if (m_sockfd < 0)
if (m_sockfd == NDB_INVALID_SOCKET)
{
if (!init()) {
#ifdef VM_TRACE
ndbout << "SocketClient::connect() failed " << m_server_name << " " << m_port << endl;
#endif
return -1;
return NDB_INVALID_SOCKET;
}
}
const int r = ::connect(m_sockfd, (struct sockaddr*) &m_servaddr, sizeof(m_servaddr));
if (r == -1) {
NDB_CLOSE_SOCKET(m_sockfd);
m_sockfd= -1;
return -1;
m_sockfd= NDB_INVALID_SOCKET;
return NDB_INVALID_SOCKET;
}
if (m_auth) {
if (!m_auth->client_authenticate(m_sockfd))
{
NDB_CLOSE_SOCKET(m_sockfd);
m_sockfd= -1;
return -1;
m_sockfd= NDB_INVALID_SOCKET;
return NDB_INVALID_SOCKET;
}
}
NDB_SOCKET_TYPE sockfd= m_sockfd;
m_sockfd= -1;
m_sockfd= NDB_INVALID_SOCKET;
return sockfd;
}

Some files were not shown because too many files have changed in this diff Show more