本文整理汇总了C++中DBUG_ENTER函数的典型用法代码示例。如果您正苦于以下问题:C++ DBUG_ENTER函数的具体用法?C++ DBUG_ENTER怎么用?C++ DBUG_ENTER使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DBUG_ENTER函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: my_ssl_verify_server_cert
int my_ssl_verify_server_cert(SSL *ssl)
{
X509 *cert;
MYSQL *mysql;
X509_NAME *x509sn;
int cn_pos;
X509_NAME_ENTRY *cn_entry;
ASN1_STRING *cn_asn1;
const char *cn_str;
DBUG_ENTER("my_ssl_verify_server_cert");
mysql= (MYSQL *)SSL_get_app_data(ssl);
if (!mysql->host)
{
my_set_error(mysql, CR_SSL_CONNECTION_ERROR, SQLSTATE_UNKNOWN,
ER(CR_SSL_CONNECTION_ERROR),
"Invalid (empty) hostname");
DBUG_RETURN(1);
}
if (!(cert= SSL_get_peer_certificate(ssl)))
{
my_set_error(mysql, CR_SSL_CONNECTION_ERROR, SQLSTATE_UNKNOWN,
ER(CR_SSL_CONNECTION_ERROR),
"Unable to get server certificate");
DBUG_RETURN(1);
}
x509sn= X509_get_subject_name(cert);
if ((cn_pos= X509_NAME_get_index_by_NID(x509sn, NID_commonName, -1)) < 0)
goto error;
if (!(cn_entry= X509_NAME_get_entry(x509sn, cn_pos)))
goto error;
if (!(cn_asn1 = X509_NAME_ENTRY_get_data(cn_entry)))
goto error;
cn_str = (char *)ASN1_STRING_data(cn_asn1);
/* Make sure there is no embedded \0 in the CN */
if ((size_t)ASN1_STRING_length(cn_asn1) != strlen(cn_str))
goto error;
if (strcmp(cn_str, mysql->host))
goto error;
X509_free(cert);
DBUG_RETURN(0);
error:
X509_free(cert);
my_set_error(mysql, CR_SSL_CONNECTION_ERROR, SQLSTATE_UNKNOWN,
ER(CR_SSL_CONNECTION_ERROR),
"Validation of SSL server certificate failed");
DBUG_RETURN(1);
}
示例2: _ma_read_cache
my_bool _ma_read_cache(MARIA_HA *handler, IO_CACHE *info, uchar *buff,
my_off_t pos, size_t length, uint flag)
{
size_t read_length,in_buff_length;
my_off_t offset;
uchar *in_buff_pos;
DBUG_ENTER("_ma_read_cache");
if (pos < info->pos_in_file)
{
read_length=length;
if ((my_off_t) read_length > (my_off_t) (info->pos_in_file-pos))
read_length=(uint) (info->pos_in_file-pos);
info->seek_not_done=1;
if (mysql_file_pread(info->file,buff,read_length,pos,MYF(MY_NABP)))
DBUG_RETURN(1);
if (!(length-=read_length))
DBUG_RETURN(0);
pos+=read_length;
buff+=read_length;
}
if (pos >= info->pos_in_file &&
(offset= (my_off_t) (pos - info->pos_in_file)) <
(my_off_t) (info->read_end - info->request_pos))
{
in_buff_pos=info->request_pos+(uint) offset;
in_buff_length= MY_MIN(length,(size_t) (info->read_end-in_buff_pos));
memcpy(buff,info->request_pos+(uint) offset,(size_t) in_buff_length);
if (!(length-=in_buff_length))
DBUG_RETURN(0);
pos+=in_buff_length;
buff+=in_buff_length;
}
else
in_buff_length=0;
if (flag & READING_NEXT)
{
if (pos != (info->pos_in_file +
(uint) (info->read_end - info->request_pos)))
{
info->pos_in_file=pos; /* Force start here */
info->read_pos=info->read_end=info->request_pos; /* Everything used */
info->seek_not_done=1;
}
else
info->read_pos=info->read_end; /* All block used */
if (!(*info->read_function)(info,buff,length))
DBUG_RETURN(0);
read_length=info->error;
}
else
{
info->seek_not_done=1;
if ((read_length=mysql_file_pread(info->file,buff,length,pos,MYF(0))) == length)
DBUG_RETURN(0);
}
if (!(flag & READING_HEADER) || (int) read_length == -1 ||
read_length+in_buff_length < 3)
{
DBUG_PRINT("error",
("Error %d reading next-multi-part block (Got %d bytes)",
my_errno, (int) read_length));
if (!my_errno || my_errno == HA_ERR_FILE_TOO_SHORT)
{
if (!handler->in_check_table)
_ma_set_fatal_error(handler->s, HA_ERR_WRONG_IN_RECORD);
else
my_errno= HA_ERR_WRONG_IN_RECORD;
}
DBUG_RETURN(1);
}
bzero(buff+read_length,MARIA_BLOCK_INFO_HEADER_LENGTH - in_buff_length -
read_length);
DBUG_RETURN(0);
} /* _ma_read_cache */
示例3: rtree_insert_level
static int rtree_insert_level(MI_INFO *info, uint keynr, uchar *key,
uint key_length, int ins_level)
{
my_off_t old_root;
MI_KEYDEF *keyinfo = info->s->keyinfo + keynr;
int res;
my_off_t new_page;
DBUG_ENTER("rtree_insert_level");
if ((old_root = info->s->state.key_root[keynr]) == HA_OFFSET_ERROR)
{
if ((old_root = _mi_new(info, keyinfo, DFLT_INIT_HITS)) == HA_OFFSET_ERROR)
DBUG_RETURN(-1);
info->buff_used = 1;
mi_putint(info->buff, 2, 0);
res = rtree_add_key(info, keyinfo, key, key_length, info->buff, NULL);
if (_mi_write_keypage(info, keyinfo, old_root, DFLT_INIT_HITS, info->buff))
DBUG_RETURN(1);
info->s->state.key_root[keynr] = old_root;
DBUG_RETURN(res);
}
switch ((res = rtree_insert_req(info, keyinfo, key, key_length,
old_root, &new_page, ins_level, 0)))
{
case 0: /* root was not split */
{
break;
}
case 1: /* root was split, grow a new root */
{
uchar *new_root_buf;
my_off_t new_root;
uchar *new_key;
uint nod_flag = info->s->base.key_reflength;
DBUG_PRINT("rtree", ("root was split, grow a new root"));
if (!(new_root_buf = (uchar*)my_alloca((uint)keyinfo->block_length +
MI_MAX_KEY_BUFF)))
{
my_errno = HA_ERR_OUT_OF_MEM;
DBUG_RETURN(-1); /* purecov: inspected */
}
mi_putint(new_root_buf, 2, nod_flag);
if ((new_root = _mi_new(info, keyinfo, DFLT_INIT_HITS)) ==
HA_OFFSET_ERROR)
goto err1;
new_key = new_root_buf + keyinfo->block_length + nod_flag;
_mi_kpointer(info, new_key - nod_flag, old_root);
if (rtree_set_key_mbr(info, keyinfo, new_key, key_length, old_root))
goto err1;
if (rtree_add_key(info, keyinfo, new_key, key_length, new_root_buf, NULL)
== -1)
goto err1;
_mi_kpointer(info, new_key - nod_flag, new_page);
if (rtree_set_key_mbr(info, keyinfo, new_key, key_length, new_page))
goto err1;
if (rtree_add_key(info, keyinfo, new_key, key_length, new_root_buf, NULL)
== -1)
goto err1;
if (_mi_write_keypage(info, keyinfo, new_root,
DFLT_INIT_HITS, new_root_buf))
goto err1;
info->s->state.key_root[keynr] = new_root;
DBUG_PRINT("rtree", ("new root page: %lu level: %d nod_flag: %u",
(ulong) new_root, 0, mi_test_if_nod(new_root_buf)));
my_afree((uchar*)new_root_buf);
break;
err1:
my_afree((uchar*)new_root_buf);
DBUG_RETURN(-1); /* purecov: inspected */
}
default:
case -1: /* error */
{
break;
}
}
DBUG_RETURN(res);
}
示例4: my_search_option_files
int my_search_option_files(const char *conf_file, int *argc, char ***argv,
uint *args_used, Process_option_func func,
void *func_ctx, const char **default_directories)
{
const char **dirs, *forced_default_file, *forced_extra_defaults;
int error= 0;
DBUG_ENTER("my_search_option_files");
/* Check if we want to force the use a specific default file */
*args_used+= get_defaults_options(*argc - *args_used, *argv + *args_used,
(char **) &forced_default_file,
(char **) &forced_extra_defaults,
(char **) &my_defaults_group_suffix);
if (! my_defaults_group_suffix)
my_defaults_group_suffix= getenv(STRINGIFY_ARG(DEFAULT_GROUP_SUFFIX_ENV));
if (forced_extra_defaults && !defaults_already_read)
{
int error= fn_expand(forced_extra_defaults, my_defaults_extra_file_buffer);
if (error)
DBUG_RETURN(error);
my_defaults_extra_file= my_defaults_extra_file_buffer;
}
if (forced_default_file && !defaults_already_read)
{
int error= fn_expand(forced_default_file, my_defaults_file_buffer);
if (error)
DBUG_RETURN(error);
my_defaults_file= my_defaults_file_buffer;
}
defaults_already_read= TRUE;
/*
We can only handle 'defaults-group-suffix' if we are called from
load_defaults() as otherwise we can't know the type of 'func_ctx'
*/
if (my_defaults_group_suffix && func == handle_default_option)
{
/* Handle --defaults-group-suffix= */
uint i;
const char **extra_groups;
const size_t instance_len= strlen(my_defaults_group_suffix);
struct handle_option_ctx *ctx= (struct handle_option_ctx*) func_ctx;
char *ptr;
TYPELIB *group= ctx->group;
if (!(extra_groups=
(const char**)alloc_root(ctx->alloc,
(2*group->count+1)*sizeof(char*))))
DBUG_RETURN(2);
for (i= 0; i < group->count; i++)
{
size_t len;
extra_groups[i]= group->type_names[i]; /** copy group */
len= strlen(extra_groups[i]);
if (!(ptr= alloc_root(ctx->alloc, (uint) (len+instance_len+1))))
DBUG_RETURN(2);
extra_groups[i+group->count]= ptr;
/** Construct new group */
memcpy(ptr, extra_groups[i], len);
memcpy(ptr+len, my_defaults_group_suffix, instance_len+1);
}
group->count*= 2;
group->type_names= extra_groups;
group->type_names[group->count]= 0;
}
if (my_defaults_file)
{
if ((error= search_default_file_with_ext(func, func_ctx, "", "",
my_defaults_file, 0)) < 0)
goto err;
if (error > 0)
{
fprintf(stderr, "Could not open required defaults file: %s\n",
my_defaults_file);
goto err;
}
}
else if (dirname_length(conf_file))
{
if ((error= search_default_file(func, func_ctx, NullS, conf_file)) < 0)
goto err;
}
else
{
for (dirs= default_directories ; *dirs; dirs++)
{
if (**dirs)
{
if (search_default_file(func, func_ctx, *dirs, conf_file) < 0)
//.........这里部分代码省略.........
示例5: fetch_n
my_bool fetch_n(const char **query_list, unsigned query_count,
enum fetch_type fetch_type)
{
unsigned open_statements= query_count;
int rc, error_count= 0;
Stmt_fetch *fetch_array= (Stmt_fetch*) calloc(1, sizeof(Stmt_fetch) *
query_count);
Stmt_fetch *fetch;
DBUG_ENTER("fetch_n");
for (fetch= fetch_array; fetch < fetch_array + query_count; ++fetch)
{
/* Init will exit(1) in case of error */
stmt_fetch_init(fetch, fetch - fetch_array,
query_list[fetch - fetch_array]);
}
if (fetch_type == USE_STORE_RESULT)
{
for (fetch= fetch_array; fetch < fetch_array + query_count; ++fetch)
{
rc= mysql_stmt_store_result(fetch->handle);
check_execute(fetch->handle, rc);
}
}
while (open_statements)
{
for (fetch= fetch_array; fetch < fetch_array + query_count; ++fetch)
{
if (fetch->is_open && (rc= stmt_fetch_fetch_row(fetch)))
{
open_statements--;
/*
We try to fetch from the rest of the statements in case of
error
*/
if (rc != MYSQL_NO_DATA)
{
fprintf(stderr,
"Got error reading rows from statement %d,\n"
"query is: %s,\n"
"error message: %s", (int) (fetch - fetch_array),
fetch->query,
mysql_stmt_error(fetch->handle));
error_count++;
}
}
}
}
if (error_count)
fprintf(stderr, "Fetch FAILED");
else
{
unsigned total_row_count= 0;
for (fetch= fetch_array; fetch < fetch_array + query_count; ++fetch)
total_row_count+= fetch->row_count;
if (!opt_silent)
printf("Success, total rows fetched: %d\n", total_row_count);
}
for (fetch= fetch_array; fetch < fetch_array + query_count; ++fetch)
stmt_fetch_close(fetch);
free(fetch_array);
DBUG_RETURN(error_count != 0);
}
示例6: fn_format
my_string fn_format(my_string to, const char *name, const char *dir,
const char *extension, uint flag)
{
reg1 uint length;
char dev[FN_REFLEN], buff[FN_REFLEN], *pos, *startpos;
const char *ext;
DBUG_ENTER("fn_format");
DBUG_PRINT("enter",("name: %s dir: %s extension: %s flag: %d",
name,dir,extension,flag));
/* Copy and skip directory */
name+=(length=dirname_part(dev,(startpos=(my_string) name)));
if (length == 0 || (flag & MY_REPLACE_DIR))
{
/* Use given directory */
convert_dirname(dev,dir,NullS); /* Fix to this OS */
}
else if ((flag & MY_RELATIVE_PATH) && !test_if_hard_path(dev))
{
/* Put 'dir' before the given path */
strmake(buff,dev,sizeof(buff)-1);
pos=convert_dirname(dev,dir,NullS);
strmake(pos,buff,sizeof(buff)-1- (int) (pos-dev));
}
if (flag & MY_PACK_FILENAME)
pack_dirname(dev,dev); /* Put in ./.. and ~/.. */
if (flag & MY_UNPACK_FILENAME)
(void) unpack_dirname(dev,dev); /* Replace ~/.. with dir */
if ((pos= (char*) strchr(name,FN_EXTCHAR)) != NullS)
{
if ((flag & MY_REPLACE_EXT) == 0) /* If we should keep old ext */
{
length=strlength(name); /* Use old extension */
ext = "";
}
else
{
length=(uint) (pos-(char*) name); /* Change extension */
ext= extension;
}
}
else
{
length=strlength(name); /* No ext, use the now one */
ext=extension;
}
if (strlen(dev)+length+strlen(ext) >= FN_REFLEN || length >= FN_LEN )
{
/* To long path, return original or NULL */
uint tmp_length;
if (flag & MY_SAFE_PATH)
return NullS;
tmp_length=strlength(startpos);
DBUG_PRINT("error",("dev: '%s' ext: '%s' length: %d",dev,ext,length));
(void) strmake(to,startpos,min(tmp_length,FN_REFLEN-1));
}
else
{
if (to == startpos)
{
bmove(buff,(char*) name,length); /* Save name for last copy */
name=buff;
}
pos=strmake(strmov(to,dev),name,length);
(void) strmov(pos,ext); /* Don't convert extension */
}
/*
If MY_RETURN_REAL_PATH and MY_RESOLVE_SYMLINK is given, only do
realpath if the file is a symbolic link
*/
if (flag & MY_RETURN_REAL_PATH)
(void) my_realpath(to, to, MYF(flag & MY_RESOLVE_SYMLINKS ?
MY_RESOLVE_LINK: 0));
else if (flag & MY_RESOLVE_SYMLINKS)
{
strmov(buff,to);
(void) my_readlink(to, buff, MYF(0));
}
DBUG_RETURN(to);
} /* fn_format */
示例7: end_server
static void end_server(MYSQL *mysql)
{
DBUG_ENTER("end_server");
free_old_query(mysql);
DBUG_VOID_RETURN;
}
示例8: DBUG_ENTER
Ndb_cluster_connection_impl::~Ndb_cluster_connection_impl()
{
DBUG_ENTER("~Ndb_cluster_connection");
if (m_transporter_facade != 0)
{
m_transporter_facade->stop_instance();
}
if (m_connect_thread)
{
void *status;
m_run_connect_thread= 0;
NdbThread_WaitFor(m_connect_thread, &status);
NdbThread_Destroy(&m_connect_thread);
m_connect_thread= 0;
}
if (m_transporter_facade != 0)
{
delete m_transporter_facade;
m_transporter_facade = 0;
}
if (m_config_retriever)
{
delete m_config_retriever;
m_config_retriever= NULL;
}
#ifdef VM_TRACE
if (ndb_print_state_mutex != NULL)
{
NdbMutex_Destroy(ndb_print_state_mutex);
ndb_print_state_mutex= NULL;
}
#endif
if (m_name)
free(m_name);
NdbMutex_Lock(g_ndb_connection_mutex);
if(--g_ndb_connection_count == 0){
delete NdbDictionary::Column::FRAGMENT;
delete NdbDictionary::Column::FRAGMENT_FIXED_MEMORY;
delete NdbDictionary::Column::FRAGMENT_VARSIZED_MEMORY;
delete NdbDictionary::Column::ROW_COUNT;
delete NdbDictionary::Column::COMMIT_COUNT;
delete NdbDictionary::Column::ROW_SIZE;
delete NdbDictionary::Column::RANGE_NO;
delete NdbDictionary::Column::DISK_REF;
delete NdbDictionary::Column::RECORDS_IN_RANGE;
delete NdbDictionary::Column::ROWID;
delete NdbDictionary::Column::ROW_GCI;
delete NdbDictionary::Column::ANY_VALUE;
NdbDictionary::Column::FRAGMENT= 0;
NdbDictionary::Column::FRAGMENT_FIXED_MEMORY= 0;
NdbDictionary::Column::FRAGMENT_VARSIZED_MEMORY= 0;
NdbDictionary::Column::ROW_COUNT= 0;
NdbDictionary::Column::COMMIT_COUNT= 0;
NdbDictionary::Column::ROW_SIZE= 0;
NdbDictionary::Column::RANGE_NO= 0;
NdbDictionary::Column::DISK_REF= 0;
NdbDictionary::Column::RECORDS_IN_RANGE= 0;
NdbDictionary::Column::ROWID= 0;
NdbDictionary::Column::ROW_GCI= 0;
NdbDictionary::Column::ANY_VALUE= 0;
delete NdbDictionary::Column::COPY_ROWID;
NdbDictionary::Column::COPY_ROWID = 0;
}
NdbMutex_Unlock(g_ndb_connection_mutex);
if (m_event_add_drop_mutex)
NdbMutex_Destroy(m_event_add_drop_mutex);
DBUG_VOID_RETURN;
}
示例9: rtree_split_page
int rtree_split_page(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page, uchar *key,
uint key_length, my_off_t *new_page_offs)
{
int n1, n2; /* Number of items in groups */
SplitStruct *task;
SplitStruct *cur;
SplitStruct *stop;
double *coord_buf;
double *next_coord;
int n_dim;
uchar *source_cur, *cur1, *cur2;
uchar *new_page= info->buff;
int err_code= 0;
uint nod_flag= mi_test_if_nod(page);
uint full_length= key_length + (nod_flag ? nod_flag :
info->s->base.rec_reflength);
int max_keys= (mi_getint(page)-2) / (full_length);
DBUG_ENTER("rtree_split_page");
DBUG_PRINT("rtree", ("splitting block"));
n_dim = keyinfo->keysegs / 2;
if (!(coord_buf= (double*) my_alloca(n_dim * 2 * sizeof(double) *
(max_keys + 1 + 4) +
sizeof(SplitStruct) * (max_keys + 1))))
DBUG_RETURN(-1); /* purecov: inspected */
task= (SplitStruct *)(coord_buf + n_dim * 2 * (max_keys + 1 + 4));
next_coord = coord_buf;
stop = task + max_keys;
source_cur = rt_PAGE_FIRST_KEY(page, nod_flag);
for (cur = task; cur < stop; ++cur, source_cur = rt_PAGE_NEXT_KEY(source_cur,
key_length, nod_flag))
{
cur->coords = reserve_coords(&next_coord, n_dim);
cur->key = source_cur;
rtree_d_mbr(keyinfo->seg, source_cur, key_length, cur->coords);
}
cur->coords = reserve_coords(&next_coord, n_dim);
rtree_d_mbr(keyinfo->seg, key, key_length, cur->coords);
cur->key = key;
if (split_rtree_node(task, max_keys + 1,
mi_getint(page) + full_length + 2, full_length,
rt_PAGE_MIN_SIZE(keyinfo->block_length),
2, 2, &next_coord, n_dim))
{
err_code = 1;
goto split_err;
}
info->buff_used= 1;
stop = task + (max_keys + 1);
cur1 = rt_PAGE_FIRST_KEY(page, nod_flag);
cur2 = rt_PAGE_FIRST_KEY(new_page, nod_flag);
n1= n2 = 0;
for (cur = task; cur < stop; ++cur)
{
uchar *to;
if (cur->n_node == 1)
{
to = cur1;
cur1 = rt_PAGE_NEXT_KEY(cur1, key_length, nod_flag);
++n1;
}
else
{
to = cur2;
cur2 = rt_PAGE_NEXT_KEY(cur2, key_length, nod_flag);
++n2;
}
if (to != cur->key)
memcpy(to - nod_flag, cur->key - nod_flag, full_length);
}
mi_putint(page, 2 + n1 * full_length, nod_flag);
mi_putint(new_page, 2 + n2 * full_length, nod_flag);
if ((*new_page_offs= _mi_new(info, keyinfo, DFLT_INIT_HITS)) ==
HA_OFFSET_ERROR)
err_code= -1;
else
err_code= _mi_write_keypage(info, keyinfo, *new_page_offs,
DFLT_INIT_HITS, new_page);
DBUG_PRINT("rtree", ("split new block: %lu", (ulong) *new_page_offs));
split_err:
my_afree((uchar*) coord_buf);
DBUG_RETURN(err_code);
}
示例10: Ndb_cluster_connection
Ndb_cluster_connection_impl::Ndb_cluster_connection_impl(const char *
connect_string)
: Ndb_cluster_connection(*this),
m_optimized_node_selection(1),
m_name(0),
m_run_connect_thread(0),
m_event_add_drop_mutex(0),
m_latest_trans_gci(0)
{
DBUG_ENTER("Ndb_cluster_connection");
DBUG_PRINT("enter",("Ndb_cluster_connection this=0x%lx", (long) this));
if (!m_event_add_drop_mutex)
m_event_add_drop_mutex= NdbMutex_Create();
g_eventLogger.createConsoleHandler();
g_eventLogger.setCategory("NdbApi");
g_eventLogger.enable(Logger::LL_ON, Logger::LL_ERROR);
m_connect_thread= 0;
m_connect_callback= 0;
#ifdef VM_TRACE
if (ndb_print_state_mutex == NULL)
ndb_print_state_mutex= NdbMutex_Create();
#endif
m_config_retriever=
new ConfigRetriever(connect_string, NDB_VERSION, NODE_TYPE_API);
if (m_config_retriever->hasError())
{
printf("Could not initialize handle to management server: %s\n",
m_config_retriever->getErrorString());
delete m_config_retriever;
m_config_retriever= 0;
}
if (m_name)
{
NdbMgmHandle h= m_config_retriever->get_mgmHandle();
ndb_mgm_set_name(h, m_name);
}
m_transporter_facade= new TransporterFacade();
NdbMutex_Lock(g_ndb_connection_mutex);
if(g_ndb_connection_count++ == 0){
NdbDictionary::Column::FRAGMENT=
NdbColumnImpl::create_pseudo("NDB$FRAGMENT");
NdbDictionary::Column::FRAGMENT_FIXED_MEMORY=
NdbColumnImpl::create_pseudo("NDB$FRAGMENT_FIXED_MEMORY");
NdbDictionary::Column::FRAGMENT_VARSIZED_MEMORY=
NdbColumnImpl::create_pseudo("NDB$FRAGMENT_VARSIZED_MEMORY");
NdbDictionary::Column::ROW_COUNT=
NdbColumnImpl::create_pseudo("NDB$ROW_COUNT");
NdbDictionary::Column::COMMIT_COUNT=
NdbColumnImpl::create_pseudo("NDB$COMMIT_COUNT");
NdbDictionary::Column::ROW_SIZE=
NdbColumnImpl::create_pseudo("NDB$ROW_SIZE");
NdbDictionary::Column::RANGE_NO=
NdbColumnImpl::create_pseudo("NDB$RANGE_NO");
NdbDictionary::Column::DISK_REF=
NdbColumnImpl::create_pseudo("NDB$DISK_REF");
NdbDictionary::Column::RECORDS_IN_RANGE=
NdbColumnImpl::create_pseudo("NDB$RECORDS_IN_RANGE");
NdbDictionary::Column::ROWID=
NdbColumnImpl::create_pseudo("NDB$ROWID");
NdbDictionary::Column::ROW_GCI=
NdbColumnImpl::create_pseudo("NDB$ROW_GCI");
NdbDictionary::Column::ANY_VALUE=
NdbColumnImpl::create_pseudo("NDB$ANY_VALUE");
NdbDictionary::Column::COPY_ROWID=
NdbColumnImpl::create_pseudo("NDB$COPY_ROWID");
}
NdbMutex_Unlock(g_ndb_connection_mutex);
DBUG_VOID_RETURN;
}
示例11: main
int main(int argc, char **argv)
{
SHAPEFILE *sha;
SHAPEFILE_RECORD *rec;
PROJECTION *proj;
int rc;
int i, max;
DBUG_ENTER("main");
DBUG_PROCESS(argv[0]);
DBUG_PUSH("d:t");
if(argc != 2)
{
printf("usage %s <shapefile>\n", argv[0]);
DBUG_RETURN(-1);
}
if(!(sha = shapefile_init(0)))
{
printf("Couldn't init\n");
DBUG_RETURN(-2);
}
if((rc= shapefile_open(sha, argv[1], 'r')) < 0)
{
printf("Couldn't open\n");
DBUG_RETURN(-3);
}
proj = projection_init();
if(sha->flags & SHAPEFILE_HAS_PRJ)
{
projection_set(proj, sha->prj->proj4_def, "+proj=latlong");
shapefile_set_projection(sha, proj);
}
shapefile_dump(sha);
max = sha->dbf->numrecords < 100 ? sha->dbf->numrecords : 100;
for(i=1; i<max; i+=10)
{
shapefile_seek_record(sha, i);
if((rec = shapefile_read_next(sha)))
{
shapefile_record_dump(rec);
shapefile_record_free(rec);
} else {
printf("Error reading record\n");
return 4;
}
printf("\n\n\n");
}
shapefile_close(sha);
shapefile_free(sha);
DBUG_RETURN(0);
}
示例12: runEventApplier
int runEventApplier(NDBT_Context* ctx, NDBT_Step* step)
{
DBUG_ENTER("runEventApplier");
int records = ctx->getNumRecords();
int loops = ctx->getNumLoops();
const NdbDictionary::Table * table= ctx->getTab();
char buf[1024];
sprintf(buf, "%s_SHADOW", table->getName());
const NdbDictionary::Table * table_shadow;
if ((table_shadow = GETNDB(step)->getDictionary()->getTable(buf)) == 0)
{
g_err << "Unable to get table " << buf << endl;
DBUG_RETURN(NDBT_FAILED);
}
sprintf(buf, "%s_EVENT", table->getName());
NdbEventOperation *pOp;
pOp = GETNDB(step)->createEventOperation(buf, 10*records);
if ( pOp == NULL ) {
g_err << "Event operation creation failed on %s" << buf << endl;
DBUG_RETURN(NDBT_FAILED);
}
int i;
int n_columns= table->getNoOfColumns();
NdbRecAttr* recAttr[1024];
NdbRecAttr* recAttrPre[1024];
for (i = 0; i < n_columns; i++) {
recAttr[i] = pOp->getValue(table->getColumn(i)->getName());
recAttrPre[i] = pOp->getPreValue(table->getColumn(i)->getName());
}
if (pOp->execute()) { // This starts changes to "start flowing"
g_err << "execute operation execution failed: \n";
g_err << pOp->getNdbError().code << " "
<< pOp->getNdbError().message << endl;
DBUG_RETURN(NDBT_FAILED);
}
int r= 0;
int res;
while (r < 10*records){
//printf("now waiting for event...\n");
res= GETNDB(step)->pollEvents(1000); // wait for event or 1000 ms
if (res <= 0)
{
ndbout_c("********************");
continue;
}
//printf("got data! %d\n", r);
int overrun= 0;
while (pOp->next(&overrun) > 0)
{
if (overrun)
{
g_err << "buffer overrun\n";
DBUG_RETURN(NDBT_FAILED);
}
r++;
Uint32 gci= pOp->getGCI();
if (!pOp->isConsistent()) {
g_err << "A node failure has occured and events might be missing\n";
DBUG_RETURN(NDBT_FAILED);
}
int noRetries= 0;
do
{
NdbTransaction *trans= GETNDB(step)->startTransaction();
if (trans == 0)
{
g_err << "startTransaction failed "
<< GETNDB(step)->getNdbError().code << " "
<< GETNDB(step)->getNdbError().message << endl;
DBUG_RETURN(NDBT_FAILED);
}
NdbOperation *op= trans->getNdbOperation(table_shadow);
if (op == 0)
{
g_err << "getNdbOperation failed "
<< trans->getNdbError().code << " "
<< trans->getNdbError().message << endl;
DBUG_RETURN(NDBT_FAILED);
}
switch (pOp->getEventType()) {
case NdbDictionary::Event::TE_INSERT:
if (op->insertTuple())
{
g_err << "insertTuple "
<< op->getNdbError().code << " "
<< op->getNdbError().message << endl;
DBUG_RETURN(NDBT_FAILED);
}
//.........这里部分代码省略.........
示例13: my_win_init
static void my_win_init(void)
{
DBUG_ENTER("my_win_init");
#if defined(_MSC_VER)
#if _MSC_VER < 1300
/*
Clear the OS system variable TZ and avoid the 100% CPU usage
Only for old versions of Visual C++
*/
_putenv( "TZ=" );
#endif
#if _MSC_VER >= 1400
/* this is required to make crt functions return -1 appropriately */
_set_invalid_parameter_handler(my_parameter_handler);
#endif
#endif
#ifdef __MSVC_RUNTIME_CHECKS
/*
Install handler to send RTC (Runtime Error Check) warnings
to log file
*/
_RTC_SetErrorFunc(handle_rtc_failure);
#endif
_tzset();
/* The following is used by time functions */
#define OFFSET_TO_EPOC ((__int64) 134774 * 24 * 60 * 60 * 1000 * 1000 * 10)
#define MS 10000000
{
FILETIME ft;
LARGE_INTEGER li, t_cnt;
DBUG_ASSERT(sizeof(LARGE_INTEGER) == sizeof(query_performance_frequency));
if (QueryPerformanceFrequency((LARGE_INTEGER *)&query_performance_frequency) == 0)
query_performance_frequency= 0;
else
{
GetSystemTimeAsFileTime(&ft);
li.LowPart= ft.dwLowDateTime;
li.HighPart= ft.dwHighDateTime;
query_performance_offset= li.QuadPart-OFFSET_TO_EPOC;
QueryPerformanceCounter(&t_cnt);
query_performance_offset-= (t_cnt.QuadPart /
query_performance_frequency * MS +
t_cnt.QuadPart %
query_performance_frequency * MS /
query_performance_frequency);
}
}
{
/*
Open HKEY_LOCAL_MACHINE\SOFTWARE\MySQL and set any strings found
there as environment variables
*/
HKEY key_handle;
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, (LPCTSTR)"SOFTWARE\\MySQL",
0, KEY_READ, &key_handle) == ERROR_SUCCESS)
{
LONG ret;
DWORD index= 0;
DWORD type;
char key_name[256], key_data[1024];
DWORD key_name_len= sizeof(key_name) - 1;
DWORD key_data_len= sizeof(key_data) - 1;
while ((ret= RegEnumValue(key_handle, index++,
key_name, &key_name_len,
NULL, &type, (LPBYTE)&key_data,
&key_data_len)) != ERROR_NO_MORE_ITEMS)
{
char env_string[sizeof(key_name) + sizeof(key_data) + 2];
if (ret == ERROR_MORE_DATA)
{
//.........这里部分代码省略.........
示例14: ssl_do
static int ssl_do(struct st_VioSSLFd *ptr, Vio *vio, long timeout,
int (*connect_accept_func)(SSL*), unsigned long *errptr)
{
int r;
SSL *ssl;
my_bool unused;
my_bool was_blocking;
DBUG_ENTER("ssl_do");
DBUG_PRINT("enter", ("ptr: 0x%lx, sd: %d ctx: 0x%lx",
(long) ptr, vio->sd, (long) ptr->ssl_context));
/* Set socket to blocking if not already set */
vio_blocking(vio, 1, &was_blocking);
if (!(ssl= SSL_new(ptr->ssl_context)))
{
DBUG_PRINT("error", ("SSL_new failure"));
*errptr= ERR_get_error();
vio_blocking(vio, was_blocking, &unused);
DBUG_RETURN(1);
}
DBUG_PRINT("info", ("ssl: 0x%lx timeout: %ld", (long) ssl, timeout));
SSL_clear(ssl);
SSL_SESSION_set_timeout(SSL_get_session(ssl), timeout);
SSL_set_fd(ssl, vio->sd);
if ((r= connect_accept_func(ssl)) < 1)
{
DBUG_PRINT("error", ("SSL_connect/accept failure"));
*errptr= SSL_get_error(ssl, r);
SSL_free(ssl);
vio_blocking(vio, was_blocking, &unused);
DBUG_RETURN(1);
}
/*
Connection succeeded. Install new function handlers,
change type, set sd to the fd used when connecting
and set pointer to the SSL structure
*/
vio_reset(vio, VIO_TYPE_SSL, SSL_get_fd(ssl), 0, 0);
vio->ssl_arg= (void*)ssl;
#ifndef DBUG_OFF
{
/* Print some info about the peer */
X509 *cert;
char buf[512];
DBUG_PRINT("info",("SSL connection succeeded"));
DBUG_PRINT("info",("Using cipher: '%s'" , SSL_get_cipher_name(ssl)));
if ((cert= SSL_get_peer_certificate (ssl)))
{
DBUG_PRINT("info",("Peer certificate:"));
X509_NAME_oneline(X509_get_subject_name(cert), buf, sizeof(buf));
DBUG_PRINT("info",("\t subject: '%s'", buf));
X509_NAME_oneline(X509_get_issuer_name(cert), buf, sizeof(buf));
DBUG_PRINT("info",("\t issuer: '%s'", buf));
X509_free(cert);
}
else
DBUG_PRINT("info",("Peer does not have certificate."));
if (SSL_get_shared_ciphers(ssl, buf, sizeof(buf)))
{
DBUG_PRINT("info",("shared_ciphers: '%s'", buf));
}
else
DBUG_PRINT("info",("no shared ciphers!"));
}
#endif
DBUG_RETURN(0);
}
示例15: heap_create
int heap_create(const char *name, HP_CREATE_INFO *create_info,
HP_SHARE **res, my_bool *created_new_share)
{
uint i, j, key_segs, max_length, length;
HP_SHARE *share= 0;
HA_KEYSEG *keyseg;
HP_KEYDEF *keydef= create_info->keydef;
uint reclength= create_info->reclength;
uint keys= create_info->keys;
ulong min_records= create_info->min_records;
ulong max_records= create_info->max_records;
ulong max_rows_for_stated_memory;
DBUG_ENTER("heap_create");
if (!create_info->internal_table)
{
mysql_mutex_lock(&THR_LOCK_heap);
share= hp_find_named_heap(name);
if (share && share->open_count == 0)
{
hp_free(share);
share= 0;
}
}
*created_new_share= (share == NULL);
if (!share)
{
uint chunk_dataspace_length, chunk_length, is_variable_size;
uint fixed_data_length, fixed_column_count;
HP_KEYDEF *keyinfo;
DBUG_PRINT("info",("Initializing new table"));
if (create_info->max_chunk_size)
{
uint configured_chunk_size= create_info->max_chunk_size;
/* User requested variable-size records, let's see if they're possible */
if (configured_chunk_size < create_info->fixed_data_size)
{
/*
The resulting chunk_size cannot be smaller than fixed data part
at the start of the first chunk which allows faster copying
with a single memcpy().
*/
my_error(ER_CANT_USE_OPTION_HERE, MYF(0), "key_block_size");
goto err;
}
if (reclength > configured_chunk_size + VARIABLE_REC_OVERHEAD ||
create_info->blobs > 0)
{
/*
Allow variable size only if we're saving some space, i.e.
if a fixed-size record would take more space than variable-size
one plus the variable-size overhead.
There has to be at least one field after indexed fields.
Note that NULL bits are already included in key_part_size.
*/
is_variable_size= 1;
chunk_dataspace_length= configured_chunk_size;
}
else
{
/* max_chunk_size is near the full reclength, let's use fixed size */
is_variable_size= 0;
chunk_dataspace_length= reclength;
}
}
else if ((create_info->is_dynamic && reclength >
256 + VARIABLE_REC_OVERHEAD)
|| create_info->blobs > 0)
{
/*
User asked for dynamic records - use 256 as the chunk size, if that
will may save some memory. Otherwise revert to fixed size format.
*/
if ((create_info->fixed_data_size + VARIABLE_REC_OVERHEAD) > 256)
chunk_dataspace_length= create_info->fixed_data_size;
else
chunk_dataspace_length= 256 - VARIABLE_REC_OVERHEAD;
is_variable_size= 1;
}
else
{
/*
If max_chunk_size is not specified, put the whole record in one chunk
*/
is_variable_size= 0;
chunk_dataspace_length= reclength;
}
if (is_variable_size)
{
/* Check whether we have any variable size records past key data */
uint has_variable_fields= 0;
fixed_data_length= create_info->fixed_data_size;
//.........这里部分代码省略.........