这篇教程C++ DBUG_RETURN函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中DBUG_RETURN函数的典型用法代码示例。如果您正苦于以下问题:C++ DBUG_RETURN函数的具体用法?C++ DBUG_RETURN怎么用?C++ DBUG_RETURN使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了DBUG_RETURN函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: _mi_read_rnd_static_recordint _mi_read_rnd_static_record(MI_INFO *info, uchar *buf, my_off_t filepos, my_bool skip_deleted_blocks){ int locked,error,cache_read; uint cache_length; MYISAM_SHARE *share=info->s; DBUG_ENTER("_mi_read_rnd_static_record"); cache_read=0; cache_length=0; if (info->opt_flag & WRITE_CACHE_USED && (info->rec_cache.pos_in_file <= filepos || skip_deleted_blocks) && flush_io_cache(&info->rec_cache)) DBUG_RETURN(my_errno); if (info->opt_flag & READ_CACHE_USED) { /* Cache in use */ if (filepos == my_b_tell(&info->rec_cache) && (skip_deleted_blocks || !filepos)) { cache_read=1; /* Read record using cache */ cache_length=(uint) (info->rec_cache.read_end - info->rec_cache.read_pos); } else info->rec_cache.seek_not_done=1; /* Filepos is changed */ } locked=0; if (info->lock_type == F_UNLCK) { if (filepos >= info->state->data_file_length) { /* Test if new records */ if (_mi_readinfo(info,F_RDLCK,0)) DBUG_RETURN(my_errno); locked=1; } else { /* We don't nead new info */ if ((! cache_read || share->base.reclength > cache_length) && share->tot_locks == 0) { /* record not in cache */ if (my_lock(share->kfile,F_RDLCK,0L,F_TO_EOF, MYF(MY_SEEK_NOT_DONE) | info->lock_wait)) DBUG_RETURN(my_errno); locked=1; } } } if (filepos >= info->state->data_file_length) { DBUG_PRINT("test",("filepos: %ld (%ld) records: %ld del: %ld", (long) filepos/share->base.reclength, (long) filepos, (long) info->state->records, (long) info->state->del)); fast_mi_writeinfo(info); DBUG_RETURN(my_errno=HA_ERR_END_OF_FILE); } info->lastpos= filepos; info->nextpos= filepos+share->base.pack_reclength; if (! cache_read) /* No cacheing */ { if ((error=_mi_read_static_record(info,filepos,buf))) { if (error > 0) error=my_errno=HA_ERR_RECORD_DELETED; else error=my_errno; } DBUG_RETURN(error); } /* Read record with caching. If my_b_read() returns TRUE, less than the requested bytes have been read. In this case rec_cache.error is either -1 for a read error, or contains the number of bytes copied into the buffer. */ error=my_b_read(&info->rec_cache,(uchar*) buf,share->base.reclength); if (info->s->base.pack_reclength != info->s->base.reclength && !error) { char tmp[8]; /* Skill fill bytes */ error=my_b_read(&info->rec_cache,(uchar*) tmp, info->s->base.pack_reclength - info->s->base.reclength); } if (locked) (void) _mi_writeinfo(info,0); /* Unlock keyfile */ if (!error) { if (!buf[0]) { /* Record is removed */ DBUG_RETURN(my_errno=HA_ERR_RECORD_DELETED); } /* Found and may be updated */ info->update|= HA_STATE_AKTIV | HA_STATE_KEY_CHANGED; DBUG_RETURN(0); } /* error is TRUE. my_errno should be set if rec_cache.error == -1 */ if (info->rec_cache.error != -1 || my_errno == 0) { /* If we could not get a full record, we either have a broken record,//.........这里部分代码省略.........
开发者ID:CSI3304Project,项目名称:CSI3304Project1,代码行数:101,
示例2: maria_page_crc_checkstatic my_bool maria_page_crc_check(uchar *page, pgcache_page_no_t page_no, MARIA_SHARE *share, uint32 no_crc_val, int data_length){ uint32 crc= uint4korr(page + share->block_size - CRC_SIZE), new_crc; my_bool res; DBUG_ENTER("maria_page_crc_check"); DBUG_ASSERT((uint)data_length <= share->block_size - CRC_SIZE); /* we need this assert to get following comparison working */ compile_time_assert(MARIA_NO_CRC_BITMAP_PAGE == MARIA_NO_CRC_NORMAL_PAGE - 1 && MARIA_NO_CRC_NORMAL_PAGE == 0xffffffff); /* If crc is no_crc_val then the page has no crc, so there is nothing to check. */ if (crc >= MARIA_NO_CRC_BITMAP_PAGE) { DBUG_PRINT("info", ("No crc: %lu crc: %lu page: %lu ", (ulong) no_crc_val, (ulong) crc, (ulong) page_no)); if (crc != no_crc_val) { my_errno= HA_ERR_WRONG_CRC; DBUG_PRINT("error", ("Wrong no CRC value")); DBUG_RETURN(1); } DBUG_RETURN(0); } new_crc= maria_page_crc((uint32) page_no, page, data_length); DBUG_ASSERT(new_crc != no_crc_val); res= MY_TEST(new_crc != crc); if (res) { /* Bitmap pages may be totally zero filled in some cases. This happens when we get a crash after the pagecache has written out a page that is on a newly created bitmap page and we get a crash before the bitmap page is written out. We handle this case with the following logic: When reading, approve of bitmap pages where all bytes are zero (This is after all a bitmap pages where no data is reserved and the CRC will be corrected at next write) */ if (no_crc_val == MARIA_NO_CRC_BITMAP_PAGE && crc == 0 && _ma_check_if_zero(page, data_length)) { DBUG_PRINT("warning", ("Found bitmap page that was not initialized")); DBUG_RETURN(0); } DBUG_PRINT("error", ("Page: %lu crc: %lu calculated crc: %lu", (ulong) page_no, (ulong) crc, (ulong) new_crc)); my_errno= HA_ERR_WRONG_CRC; } DBUG_RETURN(res);}
开发者ID:SunguckLee,项目名称:MariaDB-PageCompression,代码行数:61,
示例3: my_create_with_symlinkFile my_create_with_symlink(const char *linkname, const char *filename, int createflags, int access_flags, myf MyFlags){ File file; int tmp_errno; /* Test if we should create a link */ int create_link; char abs_linkname[FN_REFLEN]; DBUG_ENTER("my_create_with_symlink"); DBUG_PRINT("enter", ("linkname: %s filename: %s", linkname ? linkname : "(null)", filename ? filename : "(null)")); if (!my_enable_symlinks) { DBUG_PRINT("info", ("Symlinks disabled")); /* Create only the file, not the link and file */ create_link= 0; if (linkname) filename= linkname; } else { if (linkname) my_realpath(abs_linkname, linkname, MYF(0)); create_link= (linkname && strcmp(abs_linkname,filename)); } if (!(MyFlags & MY_DELETE_OLD)) { if (!access(filename,F_OK)) { char errbuf[MYSYS_STRERROR_SIZE]; my_errno= errno= EEXIST; my_error(EE_CANTCREATEFILE, MYF(0), filename, EEXIST, my_strerror(errbuf, sizeof(errbuf), EEXIST)); DBUG_RETURN(-1); } if (create_link && !access(linkname,F_OK)) { char errbuf[MYSYS_STRERROR_SIZE]; my_errno= errno= EEXIST; my_error(EE_CANTCREATEFILE, MYF(0), linkname, EEXIST, my_strerror(errbuf, sizeof(errbuf), EEXIST)); DBUG_RETURN(-1); } } if ((file=my_create(filename, createflags, access_flags, MyFlags)) >= 0) { if (create_link) { /* Delete old link/file */ if (MyFlags & MY_DELETE_OLD) my_delete(linkname, MYF(0)); /* Create link */ if (my_symlink(filename, linkname, MyFlags)) { /* Fail, remove everything we have done */ tmp_errno=my_errno; my_close(file,MYF(0)); my_delete(filename, MYF(0)); file= -1; my_errno=tmp_errno; } } } DBUG_RETURN(file);}
开发者ID:AsylumCorp,项目名称:dsploit,代码行数:69,
示例4: examine_logstatic int examine_log(my_string file_name, char **table_names){ uint command,result,files_open; ulong access_time,length; my_off_t filepos; int lock_command,mi_result; char isam_file_name[FN_REFLEN],llbuff[21],llbuff2[21]; uchar head[20]; gptr buff; struct test_if_open_param open_param; IO_CACHE cache; File file; FILE *write_file; enum ha_extra_function extra_command; TREE tree; struct file_info file_info,*curr_file_info; DBUG_ENTER("examine_log"); if ((file=my_open(file_name,O_RDONLY,MYF(MY_WME))) < 0) DBUG_RETURN(1); write_file=0; if (write_filename) { if (!(write_file=my_fopen(write_filename,O_WRONLY,MYF(MY_WME)))) { my_close(file,MYF(0)); DBUG_RETURN(1); } } init_io_cache(&cache,file,0,READ_CACHE,start_offset,0,MYF(0)); bzero((gptr) com_count,sizeof(com_count)); init_tree(&tree,0,0,sizeof(file_info),(qsort_cmp2) file_info_compare,1, (tree_element_free) file_info_free, NULL); VOID(init_key_cache(KEY_CACHE_SIZE)); files_open=0; access_time=0; while (access_time++ != number_of_commands && !my_b_read(&cache,(byte*) head,9)) { isamlog_filepos=my_b_tell(&cache)-9L; file_info.filenr= mi_uint2korr(head+1); isamlog_process=file_info.process=(long) mi_uint4korr(head+3); if (!opt_processes) file_info.process=0; result= mi_uint2korr(head+7); if ((curr_file_info=(struct file_info*) tree_search(&tree,&file_info))) { curr_file_info->accessed=access_time; if (update && curr_file_info->used && curr_file_info->closed) { if (reopen_closed_file(&tree,curr_file_info)) { command=sizeof(com_count)/sizeof(com_count[0][0])/3; result=0; goto com_err; } } } command=(uint) head[0]; if (command < sizeof(com_count)/sizeof(com_count[0][0])/3 && (!table_names[0] || (curr_file_info && curr_file_info->used))) { com_count[command][0]++; if (result) com_count[command][1]++; } switch ((enum myisam_log_commands) command) { case MI_LOG_OPEN: if (!table_names[0]) { com_count[command][0]--; /* Must be counted explicite */ if (result) com_count[command][1]--; } if (curr_file_info) printf("/nWarning: %s is opened with same process and filenumber/nMaybe you should use the -P option ?/n", curr_file_info->show_name); if (my_b_read(&cache,(byte*) head,2)) goto err; file_info.name=0; file_info.show_name=0; file_info.record=0; if (read_string(&cache,(gptr*) &file_info.name, (uint) mi_uint2korr(head))) goto err; { uint i; char *pos,*to; /* Fix if old DOS files to new format */ for (pos=file_info.name; (pos=strchr(pos,'//')) ; pos++) *pos= '/'; pos=file_info.name; for (i=0 ; i < prefix_remove ; i++) { char *next; if (!(next=strchr(pos,'/')))//.........这里部分代码省略.........
开发者ID:OPSF,项目名称:uClinux,代码行数:101,
示例5: wait_for_lock//.........这里部分代码省略......... locks_waited++; /* Set up control struct to allow others to abort locks */ thread_var->current_mutex= &data->lock->mutex; thread_var->current_cond= cond; data->cond= cond; proc_info_hook(NULL, &stage_waiting_for_table_level_lock, &old_stage, __func__, __FILE__, __LINE__); /* Since before_lock_wait potentially can create more threads to scheduler work for, we don't want to call the before_lock_wait callback unless it will really start to wait. For similar reasons, we do not want to call before_lock_wait and after_lock_wait for each lap around the loop, so we restrict ourselves to call it before_lock_wait once before starting to wait and once after the thread has exited the wait loop. */ if ((!thread_var->abort || in_wait_list) && before_lock_wait) (*before_lock_wait)(); set_timespec(wait_timeout, lock_wait_timeout); while (!thread_var->abort || in_wait_list) { int rc= mysql_cond_timedwait(cond, &data->lock->mutex, &wait_timeout); /* We must break the wait if one of the following occurs: - the connection has been aborted (!thread_var->abort), - the lock has been granted (data->cond is set to NULL by the granter), or the waiting has been aborted (additionally data->type is set to TL_UNLOCK). - the wait has timed out (rc == ETIMEDOUT) Order of checks below is important to not report about timeout if the predicate is true. */ if (data->cond == 0) { DBUG_PRINT("thr_lock", ("lock granted/aborted")); break; } if (rc == ETIMEDOUT || rc == ETIME) { /* purecov: begin inspected */ DBUG_PRINT("thr_lock", ("lock timed out")); result= THR_LOCK_WAIT_TIMEOUT; break; /* purecov: end */ } } /* We call the after_lock_wait callback once the wait loop has finished. */ if (after_lock_wait) (*after_lock_wait)(); DBUG_PRINT("thr_lock", ("aborted: %d in_wait_list: %d", thread_var->abort, in_wait_list)); if (data->cond || data->type == TL_UNLOCK) { if (data->cond) /* aborted or timed out */ { if (((*data->prev)=data->next)) /* remove from wait-list */ data->next->prev= data->prev; else wait->last=data->prev; data->type= TL_UNLOCK; /* No lock */ check_locks(data->lock, "killed or timed out wait_for_lock", 1); wake_up_waiters(data->lock); } else { DBUG_PRINT("thr_lock", ("lock aborted")); check_locks(data->lock, "aborted wait_for_lock", 0); } } else { result= THR_LOCK_SUCCESS; if (data->lock->get_status) (*data->lock->get_status)(data->status_param, 0); check_locks(data->lock,"got wait_for_lock",0); } mysql_mutex_unlock(&data->lock->mutex); /* The following must be done after unlock of lock->mutex */ mysql_mutex_lock(&thread_var->mutex); thread_var->current_mutex= 0; thread_var->current_cond= 0; mysql_mutex_unlock(&thread_var->mutex); proc_info_hook(NULL, &old_stage, NULL, __func__, __FILE__, __LINE__); DBUG_RETURN(result);}
开发者ID:JohnOhl,项目名称:mysql-connector-c,代码行数:101,
示例6: DBUG_ENTERint NdbDictionary::Dictionary::createTable(const Table & t){ DBUG_ENTER("NdbDictionary::Dictionary::createTable"); DBUG_RETURN(m_impl.createTable(NdbTableImpl::getImpl(t)));}
开发者ID:A-eolus,项目名称:mysql,代码行数:6,
示例7: mi_extra//.........这里部分代码省略......... if (share->kfile >= 0 && mysql_file_close(share->kfile, MYF(0))) error=my_errno; { LIST *list_element ; for (list_element=myisam_open_list ; list_element ; list_element=list_element->next) { MI_INFO *tmpinfo=(MI_INFO*) list_element->data; if (tmpinfo->s == info->s) { if (tmpinfo->dfile >= 0 && mysql_file_close(tmpinfo->dfile, MYF(0))) error = my_errno; tmpinfo->dfile= -1; } } } share->kfile= -1; /* Files aren't open anymore */ mysql_mutex_unlock(&share->intern_lock);#endif mysql_mutex_unlock(&THR_LOCK_myisam); break; case HA_EXTRA_FLUSH: if (!share->temporary) flush_key_blocks(share->key_cache, share->kfile, FLUSH_KEEP);#ifdef HAVE_PWRITE _mi_decrement_open_count(info);#endif if (share->not_flushed) { share->not_flushed=0; if (mysql_file_sync(share->kfile, MYF(0))) error= my_errno; if (mysql_file_sync(info->dfile, MYF(0))) error= my_errno; if (error) { share->changed=1; mi_print_error(info->s, HA_ERR_CRASHED); mi_mark_crashed(info); /* Fatal error found */ } } if (share->base.blobs) mi_alloc_rec_buff(info, -1, &info->rec_buff); break; case HA_EXTRA_NORMAL: /* Theese isn't in use */ info->quick_mode=0; break; case HA_EXTRA_QUICK: info->quick_mode=1; break; case HA_EXTRA_NO_ROWS: if (!share->state.header.uniques) info->opt_flag|= OPT_NO_ROWS; break; case HA_EXTRA_PRELOAD_BUFFER_SIZE: info->preload_buff_size= *((ulong *) extra_arg); break; case HA_EXTRA_CHANGE_KEY_TO_UNIQUE: case HA_EXTRA_CHANGE_KEY_TO_DUP: mi_extra_keyflag(info, function); break; case HA_EXTRA_MMAP:#ifdef HAVE_MMAP mysql_mutex_lock(&share->intern_lock); /* Memory map the data file if it is not already mapped. It is safe to memory map a file while other threads are using file I/O on it. Assigning a new address to a function pointer is an atomic operation. intern_lock prevents that two or more mappings are done at the same time. */ if (!share->file_map) { if (mi_dynmap_file(info, share->state.state.data_file_length)) { DBUG_PRINT("warning",("mmap failed: errno: %d",errno)); error= my_errno= errno; } } mysql_mutex_unlock(&share->intern_lock);#endif break; case HA_EXTRA_MARK_AS_LOG_TABLE: mysql_mutex_lock(&share->intern_lock); share->is_log_table= TRUE; mysql_mutex_unlock(&share->intern_lock); break; case HA_EXTRA_KEY_CACHE: case HA_EXTRA_NO_KEY_CACHE: default: break; } { char tmp[1]; tmp[0]=function; myisam_log_command(MI_LOG_EXTRA,info,(uchar*) tmp,1,error); } DBUG_RETURN(error);} /* mi_extra */
开发者ID:bobzhen,项目名称:MySQL-Research,代码行数:101,
示例8: heap_create//.........这里部分代码省略......... max_records); /* Fix keys */ memcpy(share->keydef, keydef, (size_t) (sizeof(keydef[0]) * keys)); for (i= 0, keyinfo= share->keydef; i < keys; i++, keyinfo++) { keyinfo->seg= keyseg; memcpy(keyseg, keydef[i].seg, (size_t) (sizeof(keyseg[0]) * keydef[i].keysegs)); keyseg+= keydef[i].keysegs; if (keydef[i].algorithm == HA_KEY_ALG_BTREE) { /* additional HA_KEYTYPE_END keyseg */ keyseg->type= HA_KEYTYPE_END; keyseg->length= sizeof(uchar*); keyseg->flag= 0; keyseg->null_bit= 0; keyseg++; init_tree(&keyinfo->rb_tree, 0, 0, sizeof(uchar*), (qsort_cmp2)keys_compare, 1, NULL, NULL); keyinfo->delete_key= hp_rb_delete_key; keyinfo->write_key= hp_rb_write_key; } else { init_block(&keyinfo->block, sizeof(HASH_INFO), min_records, max_records); keyinfo->delete_key= hp_delete_key; keyinfo->write_key= hp_write_key; keyinfo->hash_buckets= 0; } if ((keyinfo->flag & HA_AUTO_KEY) && create_info->with_auto_increment) share->auto_key= i + 1; } share->min_records= min_records; share->max_records= max_records; share->max_table_size= create_info->max_table_size; share->index_length= 0; share->blength= 1; share->keys= keys; share->max_key_length= max_length; share->column_count= create_info->columns; share->changed= 0; share->auto_key= create_info->auto_key; share->auto_key_type= create_info->auto_key_type; share->auto_increment= create_info->auto_increment; share->create_time= (long) time((time_t*) 0); share->fixed_data_length= fixed_data_length; share->fixed_column_count= fixed_column_count; share->blobs= create_info->blobs; share->recordspace.chunk_length= chunk_length; share->recordspace.chunk_dataspace_length= chunk_dataspace_length; share->recordspace.is_variable_size= is_variable_size; share->recordspace.total_data_length= 0; if (is_variable_size) { share->recordspace.offset_link= chunk_dataspace_length; share->recordspace.offset_status= share->recordspace.offset_link + sizeof(uchar **); } else { /* Make it likely to fail if anyone uses this offset */ share->recordspace.offset_link= 1 << 22; share->recordspace.offset_status= chunk_dataspace_length; } /* Must be allocated separately for rename to work */ if (!(share->name= my_strdup(name,MYF(0)))) { my_free(share); goto err; } thr_lock_init(&share->lock); mysql_mutex_init(hp_key_mutex_HP_SHARE_intern_lock, &share->intern_lock, MY_MUTEX_INIT_FAST); if (!create_info->internal_table) { share->open_list.data= (void*) share; heap_share_list= list_add(heap_share_list,&share->open_list); } else share->delete_on_close= 1; } if (!create_info->internal_table) { if (create_info->pin_share) ++share->open_count; mysql_mutex_unlock(&THR_LOCK_heap); } *res= share; DBUG_RETURN(0);err: if (!create_info->internal_table) mysql_mutex_unlock(&THR_LOCK_heap); DBUG_RETURN(1);} /* heap_create */
开发者ID:VonRosenchild,项目名称:build-test,代码行数:101,
示例9: fn_formatmy_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 */
开发者ID:Miguel-J,项目名称:eneboo-core,代码行数:83,
示例10: my_preadsize_t my_pread(File Filedes, uchar *Buffer, size_t Count, my_off_t offset, myf MyFlags){ size_t readbytes; size_t total_readbytes= 0; int error= 0;#if !defined (HAVE_PREAD) && !defined (_WIN32) int save_errno;#endif DBUG_ENTER("my_pread"); DBUG_PRINT("my",("fd: %d Seek: %llu Buffer: %p Count: %lu MyFlags: %d", Filedes, (ulonglong)offset, Buffer, (ulong)Count, MyFlags)); for (;;) { errno= 0; /* Linux, Windows don't reset this on EOF/success */#if !defined (HAVE_PREAD) && !defined (_WIN32) mysql_mutex_lock(&my_file_info[Filedes].mutex); readbytes= (uint) -1; error= (lseek(Filedes, offset, MY_SEEK_SET) == (my_off_t) -1 || (readbytes= read(Filedes, Buffer, Count)) != Count); save_errno= errno; mysql_mutex_unlock(&my_file_info[Filedes].mutex); if (error) errno= save_errno;#else#if defined(_WIN32) readbytes= my_win_pread(Filedes, Buffer, Count, offset);#else readbytes= pread(Filedes, Buffer, Count, offset);#endif error= (readbytes != Count);#endif if (readbytes > 0) total_readbytes+= readbytes; if(error) { if (readbytes > 0 && readbytes < Count && errno == 0) { /* pread() may return less bytes than requested even if enough bytes are available according to the Linux man page. This makes determining the end-of-file condition a bit harder. We just do another pread() call to see if more bytes can be read, since all my_pread() users expect it to always return all available bytes. For end-of-file 0 bytes is returned. This can never be the case for a partial read, since according to the man page, -1 is returned with errno set to EINTR if no data has been read. */ Buffer+= readbytes; offset+= readbytes; Count-= readbytes; continue; } my_errno= errno ? errno : -1; if (errno == 0 || (readbytes != (size_t) -1 && (MyFlags & (MY_NABP | MY_FNABP)))) my_errno= HA_ERR_FILE_TOO_SHORT; DBUG_PRINT("warning",("Read only %d bytes off %u from %d, errno: %d", (int) readbytes, (uint) Count,Filedes,my_errno)); if ((readbytes == 0 || readbytes == (size_t) -1) && errno == EINTR) { DBUG_PRINT("debug", ("my_pread() was interrupted and returned %d", (int) readbytes)); continue; /* Interrupted */ } if (MyFlags & (MY_WME | MY_FAE | MY_FNABP)) { char errbuf[MYSYS_STRERROR_SIZE]; if (readbytes == (size_t) -1) my_error(EE_READ, MYF(ME_BELL+ME_WAITTANG), my_filename(Filedes), my_errno, my_strerror(errbuf, sizeof(errbuf), my_errno)); else if (MyFlags & (MY_NABP | MY_FNABP)) my_error(EE_EOFERR, MYF(ME_BELL+ME_WAITTANG), my_filename(Filedes), my_errno, my_strerror(errbuf, sizeof(errbuf), my_errno)); } if (readbytes == (size_t) -1 || (MyFlags & (MY_FNABP | MY_NABP))) DBUG_RETURN(MY_FILE_ERROR); /* Return with error */ } if (MyFlags & (MY_NABP | MY_FNABP)) DBUG_RETURN(0); /* Read went ok; Return 0 */ DBUG_RETURN(total_readbytes); /* purecov: inspected */ }} /* my_pread */
开发者ID:VonRosenchild,项目名称:build-test,代码行数:89,
示例11: my_pwritesize_t my_pwrite(File Filedes, const uchar *Buffer, size_t Count, my_off_t offset, myf MyFlags){ size_t writtenbytes, written; uint errors; DBUG_ENTER("my_pwrite"); DBUG_PRINT("my",("fd: %d Seek: %llu Buffer: %p Count: %lu MyFlags: %d", Filedes, offset, Buffer, (ulong)Count, MyFlags)); errors= 0; written= 0; for (;;) {#if !defined (HAVE_PREAD) && !defined (_WIN32) int error; writtenbytes= (size_t) -1; mysql_mutex_lock(&my_file_info[Filedes].mutex); error= (lseek(Filedes, offset, MY_SEEK_SET) != (my_off_t) -1 && (writtenbytes= write(Filedes, Buffer, Count)) == Count); mysql_mutex_unlock(&my_file_info[Filedes].mutex); if (error) break;#elif defined (_WIN32) writtenbytes= my_win_pwrite(Filedes, Buffer, Count, offset);#else writtenbytes= pwrite(Filedes, Buffer, Count, offset);#endif if(writtenbytes == Count) break; my_errno= errno; if (writtenbytes != (size_t) -1) { written+= writtenbytes; Buffer+= writtenbytes; Count-= writtenbytes; offset+= writtenbytes; } DBUG_PRINT("error",("Write only %u bytes", (uint) writtenbytes));#ifndef NO_BACKGROUND if (my_thread_var->abort) MyFlags&= ~ MY_WAIT_IF_FULL; /* End if aborted by user */ if ((my_errno == ENOSPC || my_errno == EDQUOT) && (MyFlags & MY_WAIT_IF_FULL)) { wait_for_free_space(my_filename(Filedes), errors); errors++; continue; } if ((writtenbytes && writtenbytes != (size_t) -1) || my_errno == EINTR) continue; /* Retry */#endif if (MyFlags & (MY_NABP | MY_FNABP)) { if (MyFlags & (MY_WME | MY_FAE | MY_FNABP)) { char errbuf[MYSYS_STRERROR_SIZE]; my_error(EE_WRITE, MYF(ME_BELL | ME_WAITTANG), my_filename(Filedes), my_errno, my_strerror(errbuf, sizeof(errbuf), my_errno)); } DBUG_RETURN(MY_FILE_ERROR); /* Error on read */ } else break; /* Return bytes written */ } DBUG_EXECUTE_IF("check", my_seek(Filedes, -1, SEEK_SET, MYF(0)););
开发者ID:VonRosenchild,项目名称:build-test,代码行数:68,
示例12: heap_create//.........这里部分代码省略......... keyinfo->get_key_length= hp_rb_var_key_length; else if (keyinfo->flag & HA_NULL_PART_KEY) keyinfo->get_key_length= hp_rb_null_key_length; else keyinfo->get_key_length= hp_rb_key_length; } } if (!(share= (HP_SHARE*) my_malloc(hp_key_memory_HP_SHARE, (uint) sizeof(HP_SHARE)+ keys*sizeof(HP_KEYDEF)+ key_segs*sizeof(HA_KEYSEG), MYF(MY_ZEROFILL)))) goto err; share->keydef= (HP_KEYDEF*) (share + 1); share->key_stat_version= 1; keyseg= (HA_KEYSEG*) (share->keydef + keys); init_block(&share->block, reclength + 1, min_records, max_records); /* Fix keys */ memcpy(share->keydef, keydef, (size_t) (sizeof(keydef[0]) * keys)); for (i= 0, keyinfo= share->keydef; i < keys; i++, keyinfo++) { keyinfo->seg= keyseg; memcpy(keyseg, keydef[i].seg, (size_t) (sizeof(keyseg[0]) * keydef[i].keysegs)); keyseg+= keydef[i].keysegs; if (keydef[i].algorithm == HA_KEY_ALG_BTREE) { /* additional HA_KEYTYPE_END keyseg */ keyseg->type= HA_KEYTYPE_END; keyseg->length= sizeof(uchar*); keyseg->flag= 0; keyseg->null_bit= 0; keyseg++; init_tree(&keyinfo->rb_tree, 0, 0, sizeof(uchar*), (qsort_cmp2)keys_compare, 1, NULL, NULL); keyinfo->delete_key= hp_rb_delete_key; keyinfo->write_key= hp_rb_write_key; } else { init_block(&keyinfo->block, sizeof(HASH_INFO), min_records, max_records); keyinfo->delete_key= hp_delete_key; keyinfo->write_key= hp_write_key; keyinfo->hash_buckets= 0; } if ((keyinfo->flag & HA_AUTO_KEY) && create_info->with_auto_increment) share->auto_key= i + 1; } share->min_records= min_records; share->max_records= max_records; share->max_table_size= create_info->max_table_size; share->data_length= share->index_length= 0; share->reclength= reclength; share->blength= 1; share->keys= keys; share->max_key_length= max_length; share->changed= 0; share->auto_key= create_info->auto_key; share->auto_key_type= create_info->auto_key_type; share->auto_increment= create_info->auto_increment; share->create_time= (long) time((time_t*) 0); /* Must be allocated separately for rename to work */ if (!(share->name= my_strdup(hp_key_memory_HP_SHARE, name, MYF(0)))) { my_free(share); goto err; } if (!create_info->internal_table) { /* Do not initialize THR_LOCK object for internal temporary tables. It is not needed for such tables. Calling thr_lock_init() can cause scalability issues since it acquires global lock. */ thr_lock_init(&share->lock); share->open_list.data= (void*) share; heap_share_list= list_add(heap_share_list,&share->open_list); } else share->delete_on_close= 1; } if (!create_info->internal_table) { if (create_info->pin_share) ++share->open_count; mysql_mutex_unlock(&THR_LOCK_heap); } *res= share; DBUG_RETURN(0);err: if (!create_info->internal_table) mysql_mutex_unlock(&THR_LOCK_heap); DBUG_RETURN(1);} /* heap_create */
开发者ID:leafji,项目名称:MYSQL_5.7,代码行数:101,
示例13: rtree_delete_reqstatic int rtree_delete_req(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key, uint key_length, my_off_t page, uint *page_size, stPageList *ReinsertList, int level){ uchar *k; uchar *last; ulong i; uint nod_flag; uchar *page_buf; int res; DBUG_ENTER("rtree_delete_req"); if (!(page_buf = (uchar*)my_alloca((uint)keyinfo->block_length))) { my_errno = HA_ERR_OUT_OF_MEM; DBUG_RETURN(-1); /* purecov: inspected */ } if (!_mi_fetch_keypage(info, keyinfo, page, DFLT_INIT_HITS, page_buf, 0)) goto err1; nod_flag = mi_test_if_nod(page_buf); DBUG_PRINT("rtree", ("page: %lu level: %d nod_flag: %u", (ulong) page, level, nod_flag)); k = rt_PAGE_FIRST_KEY(page_buf, nod_flag); last = rt_PAGE_END(page_buf); for (i = 0; k < last; k = rt_PAGE_NEXT_KEY(k, key_length, nod_flag), ++i) { if (nod_flag) { /* not leaf */ if (!rtree_key_cmp(keyinfo->seg, key, k, key_length, MBR_WITHIN)) { switch ((res = rtree_delete_req(info, keyinfo, key, key_length, _mi_kpos(nod_flag, k), page_size, ReinsertList, level + 1))) { case 0: /* deleted */ { /* test page filling */ if (*page_size + key_length >= rt_PAGE_MIN_SIZE(keyinfo->block_length)) { /* OK */ /* Calculate a new key value (MBR) for the shrinked block. */ if (rtree_set_key_mbr(info, keyinfo, k, key_length, _mi_kpos(nod_flag, k))) goto err1; if (_mi_write_keypage(info, keyinfo, page, DFLT_INIT_HITS, page_buf)) goto err1; } else { /* Too small: delete key & add it descendant to reinsert list. Store position and level of the block so that it can be accessed later for inserting the remaining keys. */ DBUG_PRINT("rtree", ("too small. move block to reinsert list")); if (rtree_fill_reinsert_list(ReinsertList, _mi_kpos(nod_flag, k), level + 1)) goto err1; /* Delete the key that references the block. This makes the block disappear from the index. Hence we need to insert its remaining keys later. Note: if the block is a branch block, we do not only remove this block, but the whole subtree. So we need to re-insert its keys on the same level later to reintegrate the subtrees. */ rtree_delete_key(info, page_buf, k, key_length, nod_flag); if (_mi_write_keypage(info, keyinfo, page, DFLT_INIT_HITS, page_buf)) goto err1; *page_size = mi_getint(page_buf); } goto ok; } case 1: /* not found - continue searching */ { break; } case 2: /* vacuous case: last key in the leaf */ { rtree_delete_key(info, page_buf, k, key_length, nod_flag); if (_mi_write_keypage(info, keyinfo, page, DFLT_INIT_HITS, page_buf)) goto err1; *page_size = mi_getint(page_buf); res = 0; goto ok; } default: /* error */ case -1: { goto err1; } } } }//.........这里部分代码省略.........
开发者ID:zylishiyu,项目名称:mysql-timeout-ms,代码行数:101,
示例14: mysql_real_connectMYSQL * STDCALLmysql_real_connect(MYSQL *mysql,const char *host, const char *user, const char *passwd, const char *db, uint port, const char *unix_socket,ulong client_flag){ char name_buff[USERNAME_LENGTH]; DBUG_ENTER("mysql_real_connect"); DBUG_PRINT("enter",("host: %s db: %s user: %s", host ? host : "(Null)", db ? db : "(Null)", user ? user : "(Null)")); if (!host || !host[0]) host= mysql->options.host; if (mysql->options.methods_to_use == MYSQL_OPT_USE_REMOTE_CONNECTION || (mysql->options.methods_to_use == MYSQL_OPT_GUESS_CONNECTION && host && *host && strcmp(host,LOCAL_HOST))) DBUG_RETURN(cli_mysql_real_connect(mysql, host, user, passwd, db, port, unix_socket, client_flag)); mysql->methods= &embedded_methods; /* use default options */ if (mysql->options.my_cnf_file || mysql->options.my_cnf_group) { mysql_read_default_options(&mysql->options, (mysql->options.my_cnf_file ? mysql->options.my_cnf_file : "my"), mysql->options.my_cnf_group); my_free(mysql->options.my_cnf_file,MYF(MY_ALLOW_ZERO_PTR)); my_free(mysql->options.my_cnf_group,MYF(MY_ALLOW_ZERO_PTR)); mysql->options.my_cnf_file=mysql->options.my_cnf_group=0; } if (!db || !db[0]) db=mysql->options.db; if (!user || !user[0]) user=mysql->options.user;#ifndef NO_EMBEDDED_ACCESS_CHECKS if (!passwd) { passwd=mysql->options.password;#if !defined(DONT_USE_MYSQL_PWD) if (!passwd) passwd=getenv("MYSQL_PWD"); /* get it from environment */#endif } mysql->passwd= passwd ? my_strdup(passwd,MYF(0)) : NULL;#endif /*!NO_EMBEDDED_ACCESS_CHECKS*/ if (!user || !user[0]) { read_user_name(name_buff); if (name_buff[0]) user= name_buff; } if (!user) user= ""; /* We need to alloc some space for mysql->info but don't want to put extra 'my_free's in mysql_close. So we alloc it with the 'user' string to be freed at once */ mysql->user= my_strdup(user, MYF(0)); port=0; unix_socket=0; /* Send client information for access check */ client_flag|=CLIENT_CAPABILITIES; if (client_flag & CLIENT_MULTI_STATEMENTS) client_flag|= CLIENT_MULTI_RESULTS; client_flag&= ~CLIENT_COMPRESS; if (db) client_flag|=CLIENT_CONNECT_WITH_DB; mysql->info_buffer= my_malloc(MYSQL_ERRMSG_SIZE, MYF(0)); mysql->thd= create_embedded_thd(client_flag); init_embedded_mysql(mysql, client_flag); if (mysql_init_character_set(mysql)) goto error; if (check_embedded_connection(mysql, db)) goto error; mysql->server_status= SERVER_STATUS_AUTOCOMMIT; if (mysql->options.init_commands) { DYNAMIC_ARRAY *init_commands= mysql->options.init_commands; char **ptr= (char**)init_commands->buffer; char **end= ptr + init_commands->elements;//.........这里部分代码省略.........
开发者ID:isleon,项目名称:Jaxer,代码行数:101,
示例15: rtree_deleteint rtree_delete(MI_INFO *info, uint keynr, uchar *key, uint key_length){ uint page_size; stPageList ReinsertList; my_off_t old_root; MI_KEYDEF *keyinfo = info->s->keyinfo + keynr; DBUG_ENTER("rtree_delete"); if ((old_root = info->s->state.key_root[keynr]) == HA_OFFSET_ERROR) { my_errno= HA_ERR_END_OF_FILE; DBUG_RETURN(-1); /* purecov: inspected */ } DBUG_PRINT("rtree", ("starting deletion at root page: %lu", (ulong) old_root)); ReinsertList.pages = NULL; ReinsertList.n_pages = 0; ReinsertList.m_pages = 0; switch (rtree_delete_req(info, keyinfo, key, key_length, old_root, &page_size, &ReinsertList, 0)) { case 2: /* empty */ { info->s->state.key_root[keynr] = HA_OFFSET_ERROR; DBUG_RETURN(0); } case 0: /* deleted */ { uint nod_flag; ulong i; for (i = 0; i < ReinsertList.n_pages; ++i) { uchar *page_buf; uchar *k; uchar *last; if (!(page_buf = (uchar*)my_alloca((uint)keyinfo->block_length))) { my_errno = HA_ERR_OUT_OF_MEM; goto err1; } if (!_mi_fetch_keypage(info, keyinfo, ReinsertList.pages[i].offs, DFLT_INIT_HITS, page_buf, 0)) goto err1; nod_flag = mi_test_if_nod(page_buf); DBUG_PRINT("rtree", ("reinserting keys from " "page: %lu level: %d nod_flag: %u", (ulong) ReinsertList.pages[i].offs, ReinsertList.pages[i].level, nod_flag)); k = rt_PAGE_FIRST_KEY(page_buf, nod_flag); last = rt_PAGE_END(page_buf); for (; k < last; k = rt_PAGE_NEXT_KEY(k, key_length, nod_flag)) { int res; if ((res= rtree_insert_level(info, keynr, k, key_length, ReinsertList.pages[i].level)) == -1) { my_afree((uchar*)page_buf); goto err1; } if (res) { ulong j; DBUG_PRINT("rtree", ("root has been split, adjust levels")); for (j= i; j < ReinsertList.n_pages; j++) { ReinsertList.pages[j].level++; DBUG_PRINT("rtree", ("keys from page: %lu now level: %d", (ulong) ReinsertList.pages[i].offs, ReinsertList.pages[i].level)); } } } my_afree((uchar*)page_buf); if (_mi_dispose(info, keyinfo, ReinsertList.pages[i].offs, DFLT_INIT_HITS)) goto err1; } if (ReinsertList.pages) my_free((uchar*) ReinsertList.pages, MYF(0)); /* check for redundant root (not leaf, 1 child) and eliminate */ if ((old_root = info->s->state.key_root[keynr]) == HA_OFFSET_ERROR) goto err1; if (!_mi_fetch_keypage(info, keyinfo, old_root, DFLT_INIT_HITS, info->buff, 0)) goto err1; nod_flag = mi_test_if_nod(info->buff); page_size = mi_getint(info->buff); if (nod_flag && (page_size == 2 + key_length + nod_flag)) { my_off_t new_root = _mi_kpos(nod_flag, rt_PAGE_FIRST_KEY(info->buff, nod_flag)); if (_mi_dispose(info, keyinfo, old_root, DFLT_INIT_HITS)) goto err1; info->s->state.key_root[keynr] = new_root; }//.........这里部分代码省略.........
开发者ID:zylishiyu,项目名称:mysql-timeout-ms,代码行数:101,
示例16: my_search_option_filesint 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)//.........这里部分代码省略.........
开发者ID:Denisss025,项目名称:duda,代码行数:101,
示例17: my_readsize_t my_read(File Filedes, uchar *Buffer, size_t Count, myf MyFlags){ size_t readbytes, save_count; DBUG_ENTER("my_read"); DBUG_PRINT("my",("fd: %d Buffer: %p Count: %lu MyFlags: %d", Filedes, Buffer, (ulong) Count, MyFlags)); save_count= Count; if (!(MyFlags & (MY_WME | MY_FAE | MY_FNABP))) MyFlags|= my_global_flags; for (;;) { errno= 0; /* Linux, Windows don't reset this on EOF/success */#ifdef _WIN32 readbytes= my_win_read(Filedes, Buffer, Count);#else readbytes= read(Filedes, Buffer, Count);#endif if (readbytes != Count) { my_errno= errno; if (errno == 0 || (readbytes != (size_t) -1 && (MyFlags & (MY_NABP | MY_FNABP)))) my_errno= HA_ERR_FILE_TOO_SHORT; DBUG_PRINT("warning",("Read only %d bytes off %lu from %d, errno: %d", (int) readbytes, (ulong) Count, Filedes, my_errno)); if ((readbytes == 0 || (int) readbytes == -1) && errno == EINTR) { DBUG_PRINT("debug", ("my_read() was interrupted and returned %ld", (long) readbytes)); continue; /* Interrupted */ } if (MyFlags & (MY_WME | MY_FAE | MY_FNABP)) { if (readbytes == (size_t) -1) my_error(EE_READ, MYF(ME_BELL | ME_WAITTANG | (MyFlags & (ME_JUST_INFO | ME_NOREFRESH))), my_filename(Filedes),my_errno); else if (MyFlags & (MY_NABP | MY_FNABP)) my_error(EE_EOFERR, MYF(ME_BELL | ME_WAITTANG | (MyFlags & (ME_JUST_INFO | ME_NOREFRESH))), my_filename(Filedes),my_errno); } if (readbytes == (size_t) -1 || ((MyFlags & (MY_FNABP | MY_NABP)) && !(MyFlags & MY_FULL_IO))) DBUG_RETURN(MY_FILE_ERROR); /* Return with error */ if (readbytes != (size_t) -1 && (MyFlags & MY_FULL_IO)) { Buffer+= readbytes; Count-= readbytes; continue; } } if (MyFlags & (MY_NABP | MY_FNABP)) readbytes= 0; /* Ok on read */ else if (MyFlags & MY_FULL_IO) readbytes= save_count; break; } DBUG_RETURN(readbytes);} /* my_read */
开发者ID:88lees,项目名称:2014-10-08_Ymachine_,代码行数:66,
示例18: my_load_defaultsint my_load_defaults(const char *conf_file, const char **groups, int *argc, char ***argv, const char ***default_directories){ DYNAMIC_ARRAY args; TYPELIB group; my_bool found_print_defaults= 0; uint args_used= 0; int error= 0; MEM_ROOT alloc; char *ptr,**res; struct handle_option_ctx ctx; const char **dirs; uint args_sep= my_getopt_use_args_separator ? 1 : 0; DBUG_ENTER("load_defaults"); init_alloc_root(&alloc,512,0); if ((dirs= init_default_directories(&alloc)) == NULL) goto err; /* Check if the user doesn't want any default option processing --no-defaults is always the first option */ if (*argc >= 2 && !strcmp(argv[0][1],"--no-defaults")) { /* remove the --no-defaults argument and return only the other arguments */ uint i, j; if (!(ptr=(char*) alloc_root(&alloc,sizeof(alloc)+ (*argc + 1)*sizeof(char*)))) goto err; res= (char**) (ptr+sizeof(alloc)); res[0]= **argv; /* Copy program name */ j= 1; /* Start from 1 for the reset result args */ if (my_getopt_use_args_separator) { /* set arguments separator */ set_args_separator(&res[1]); j++; } for (i=2 ; i < (uint) *argc ; i++, j++) res[j]=argv[0][i]; res[j]=0; /* End pointer */ /* Update the argc, if have not added args separator, then we have to decrease argc because we have removed the "--no-defaults". */ if (!my_getopt_use_args_separator) (*argc)--; *argv=res; *(MEM_ROOT*) ptr= alloc; /* Save alloc root for free */ if (default_directories) *default_directories= dirs; DBUG_RETURN(0); } group.count=0; group.name= "defaults"; group.type_names= groups; for (; *groups ; groups++) group.count++; if (my_init_dynamic_array(&args, sizeof(char*),*argc, 32)) goto err; ctx.alloc= &alloc; ctx.args= &args; ctx.group= &group; if ((error= my_search_option_files(conf_file, argc, argv, &args_used, handle_default_option, (void *) &ctx, dirs))) { free_root(&alloc,MYF(0)); DBUG_RETURN(error); } /* Here error contains <> 0 only if we have a fully specified conf_file or a forced default file */ if (!(ptr=(char*) alloc_root(&alloc,sizeof(alloc)+ (args.elements + *argc + 1 + args_sep) *sizeof(char*)))) goto err; res= (char**) (ptr+sizeof(alloc)); /* copy name + found arguments + command line arguments to new array */ res[0]= argv[0][0]; /* Name MUST be set, even by embedded library */ memcpy((uchar*) (res+1), args.buffer, args.elements*sizeof(char*)); /* Skip --defaults-xxx options */ (*argc)-= args_used; (*argv)+= args_used; /* Check if we wan't to see the new argument list This options must always be the last of the default options */ if (*argc >= 2 && !strcmp(argv[0][1],"--print-defaults")) { found_print_defaults=1; --*argc; ++*argv; /* skip argument */ }//.........这里部分代码省略.........
开发者ID:Denisss025,项目名称:duda,代码行数:101,
示例19: DBUG_ENTERsci_error_t SCI_Transporter::initLocalSegment() { DBUG_ENTER("SCI_Transporter::initLocalSegment"); Uint32 segmentSize = m_BufferSize; Uint32 offset = 0; sci_error_t err; if(!m_sciinit) { for(Uint32 i=0; i<m_adapters ; i++) { SCIOpen(&(sciAdapters[i].scidesc), FLAGS, &err); sciAdapters[i].localSciNodeId=getLocalNodeId(i); DBUG_PRINT("info", ("SCInode iD %d adapter %d/n", sciAdapters[i].localSciNodeId, i)); if(err != SCI_ERR_OK) { DBUG_PRINT("error", ("Cannot open an SCI virtual device. Error code 0x%x", err)); DBUG_RETURN(err); } } } m_sciinit=true; SCICreateSegment(sciAdapters[0].scidesc, &(m_SourceSegm[0].localHandle), hostSegmentId(localNodeId, remoteNodeId), segmentSize, 0, 0, 0, &err); if(err != SCI_ERR_OK) { DBUG_PRINT("error", ("Error creating segment, err = 0x%x", err)); DBUG_RETURN(err); } else { DBUG_PRINT("info", ("created segment id : %d", hostSegmentId(localNodeId, remoteNodeId))); } /** Prepare the segment*/ for(Uint32 i=0; i < m_adapters; i++) { SCIPrepareSegment((m_SourceSegm[0].localHandle), i, FLAGS, &err); if(err != SCI_ERR_OK) { DBUG_PRINT("error", ("Local Segment is not accessible by an SCI adapter. Error code 0x%x/n", err)); DBUG_RETURN(err); } } m_SourceSegm[0].mappedMemory = SCIMapLocalSegment((m_SourceSegm[0].localHandle), &(m_SourceSegm[0].lhm[0].map), offset, segmentSize, NULL, FLAGS, &err); if(err != SCI_ERR_OK) { DBUG_PRINT("error", ("Cannot map area of size %d. Error code 0x%x", segmentSize,err)); doDisconnect(); DBUG_RETURN(err); } /** Make the local segment available*/ for(Uint32 i=0; i < m_adapters; i++) { SCISetSegmentAvailable((m_SourceSegm[0].localHandle), i, FLAGS, &err); if(err != SCI_ERR_OK) { DBUG_PRINT("error", ("Local Segment is not available for remote connections. Error code 0x%x/n", err)); DBUG_RETURN(err); } } setupLocalSegment(); DBUG_RETURN(err); } // initLocalSegment()
开发者ID:4T-Shirt,项目名称:mysql,代码行数:92,
示例20: fetch_nmy_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);}
开发者ID:ForcerKing,项目名称:ShaoqunXu-mysql5.7,代码行数:65,
示例21: DBUG_ENTERstatic info *infoFree(info *inf){ DBUG_ENTER("infofree"); inf = MEMfree(inf); DBUG_RETURN(inf);}
开发者ID:foliern,项目名称:LUT_relocate,代码行数:6,
示例22: _ma_read_cachemy_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 */
开发者ID:SunguckLee,项目名称:MariaDB-PageCompression,代码行数:75,
示例23: thr_lock//.........这里部分代码省略......... write locks are of TL_WRITE_ALLOW_WRITE type. Note that, since lock requests for the same table are sorted in such way that requests with higher thr_lock_type value come first (with one exception (*)), lock being requested usually has equal or "weaker" type than one which thread might have already acquired. *) The only exception to this rule is case when type of old lock is TL_WRITE_LOW_PRIORITY and type of new lock is changed inside of thr_lock() from TL_WRITE_CONCURRENT_INSERT to TL_WRITE since engine turns out to be not supporting concurrent inserts. Note that since TL_WRITE has the same compatibility rules as TL_WRITE_LOW_PRIORITY (their only difference is priority), it is OK to grant new lock without additional checks in such situation. Therefore it is OK to allow acquiring write lock on the table if this thread already holds some write lock on it. (INSERT INTO t1 VALUES (f1()), where f1() is stored function which tries to update t1, is an example of statement which requests two different types of write lock on the same table). */ DBUG_ASSERT(! has_old_lock(lock->write.data, data->owner) || ((lock_type <= lock->write.data->type || (lock_type == TL_WRITE && lock->write.data->type == TL_WRITE_LOW_PRIORITY)))); if ((lock_type == TL_WRITE_ALLOW_WRITE && ! lock->write_wait.data && lock->write.data->type == TL_WRITE_ALLOW_WRITE) || has_old_lock(lock->write.data, data->owner)) { /* We have already got a write lock or all locks are TL_WRITE_ALLOW_WRITE */ DBUG_PRINT("info", ("write_wait.data: 0x%lx old_type: %d", (ulong) lock->write_wait.data, lock->write.data->type)); (*lock->write.last)=data; /* Add to running fifo */ data->prev=lock->write.last; lock->write.last= &data->next; check_locks(lock,"second write lock",0); if (data->lock->get_status) (*data->lock->get_status)(data->status_param, 0); locks_immediate++; goto end; } DBUG_PRINT("lock",("write locked 2 by thread: 0x%lx", lock->write.data->owner->thread_id)); } else { DBUG_PRINT("info", ("write_wait.data: 0x%lx", (ulong) lock->write_wait.data)); if (!lock->write_wait.data) { /* no scheduled write locks */ my_bool concurrent_insert= 0; if (lock_type == TL_WRITE_CONCURRENT_INSERT) { concurrent_insert= 1; if ((*lock->check_status)(data->status_param)) { concurrent_insert= 0; data->type=lock_type= thr_upgraded_concurrent_insert_lock; } } if (!lock->read.data || (lock_type <= TL_WRITE_CONCURRENT_INSERT && ((lock_type != TL_WRITE_CONCURRENT_INSERT && lock_type != TL_WRITE_ALLOW_WRITE) || !lock->read_no_write_count))) { (*lock->write.last)=data; /* Add as current write lock */ data->prev=lock->write.last; lock->write.last= &data->next; if (data->lock->get_status) (*data->lock->get_status)(data->status_param, concurrent_insert); check_locks(lock,"only write lock",0); locks_immediate++; goto end; } } DBUG_PRINT("lock",("write locked 3 by thread: 0x%lx type: %d", lock->read.data->owner->thread_id, data->type)); } wait_queue= &lock->write_wait; } /* Can't get lock yet; Wait for it */ result= wait_for_lock(wait_queue, data, 0, lock_wait_timeout); MYSQL_END_TABLE_LOCK_WAIT(locker); DBUG_RETURN(result);end: mysql_mutex_unlock(&lock->mutex); MYSQL_END_TABLE_LOCK_WAIT(locker); DBUG_RETURN(result);}
开发者ID:JohnOhl,项目名称:mysql-connector-c,代码行数:101,
示例24: rtree_insert_reqstatic int rtree_insert_req(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key, uint key_length, my_off_t page, my_off_t *new_page, int ins_level, int level){ uchar *k; uint nod_flag; uchar *page_buf; int res; DBUG_ENTER("rtree_insert_req"); if (!(page_buf = (uchar*)my_alloca((uint)keyinfo->block_length + MI_MAX_KEY_BUFF))) { my_errno = HA_ERR_OUT_OF_MEM; DBUG_RETURN(-1); /* purecov: inspected */ } if (!_mi_fetch_keypage(info, keyinfo, page, DFLT_INIT_HITS, page_buf, 0)) goto err1; nod_flag = mi_test_if_nod(page_buf); DBUG_PRINT("rtree", ("page: %lu level: %d ins_level: %d nod_flag: %u", (ulong) page, level, ins_level, nod_flag)); if ((ins_level == -1 && nod_flag) || /* key: go down to leaf */ (ins_level > -1 && ins_level > level)) /* branch: go down to ins_level */ { if ((k = rtree_pick_key(info, keyinfo, key, key_length, page_buf, nod_flag)) == NULL) goto err1; switch ((res = rtree_insert_req(info, keyinfo, key, key_length, _mi_kpos(nod_flag, k), new_page, ins_level, level + 1))) { case 0: /* child was not split */ { rtree_combine_rect(keyinfo->seg, k, key, k, key_length); if (_mi_write_keypage(info, keyinfo, page, DFLT_INIT_HITS, page_buf)) goto err1; goto ok; } case 1: /* child was split */ { uchar *new_key = page_buf + keyinfo->block_length + nod_flag; /* set proper MBR for key */ if (rtree_set_key_mbr(info, keyinfo, k, key_length, _mi_kpos(nod_flag, k))) goto err1; /* add new key for new page */ _mi_kpointer(info, new_key - nod_flag, *new_page); if (rtree_set_key_mbr(info, keyinfo, new_key, key_length, *new_page)) goto err1; res = rtree_add_key(info, keyinfo, new_key, key_length, page_buf, new_page); if (_mi_write_keypage(info, keyinfo, page, DFLT_INIT_HITS, page_buf)) goto err1; goto ok; } default: case -1: /* error */ { goto err1; } } } else { res = rtree_add_key(info, keyinfo, key, key_length, page_buf, new_page); if (_mi_write_keypage(info, keyinfo, page, DFLT_INIT_HITS, page_buf)) goto err1; goto ok; }ok: my_afree((uchar*)page_buf); DBUG_RETURN(res);err1: my_afree((uchar*)page_buf); DBUG_RETURN(-1); /* purecov: inspected */}
开发者ID:zylishiyu,项目名称:mysql-timeout-ms,代码行数:78,
示例25: my_rename_with_symlinkint my_rename_with_symlink(const char *from, const char *to, myf MyFlags){#ifndef HAVE_READLINK return my_rename(from, to, MyFlags);#else char link_name[FN_REFLEN], tmp_name[FN_REFLEN]; int was_symlink= (my_enable_symlinks && !my_readlink(link_name, from, MYF(0))); int result=0; int name_is_different; DBUG_ENTER("my_rename_with_symlink"); if (!was_symlink) DBUG_RETURN(my_rename(from, to, MyFlags)); /* Change filename that symlink pointed to */ strmov(tmp_name, to); fn_same(tmp_name,link_name,1); /* Copy dir */ name_is_different= strcmp(link_name, tmp_name); if (name_is_different && !access(tmp_name, F_OK)) { my_errno= EEXIST; if (MyFlags & MY_WME) { char errbuf[MYSYS_STRERROR_SIZE]; my_error(EE_CANTCREATEFILE, MYF(0), tmp_name, EEXIST, my_strerror(errbuf, sizeof(errbuf), EEXIST)); } DBUG_RETURN(1); } /* Create new symlink */ if (my_symlink(tmp_name, to, MyFlags)) DBUG_RETURN(1); /* Rename symlinked file if the base name didn't change. This can happen if you use this function where 'from' and 'to' has the same basename and different directories. */ if (name_is_different && my_rename(link_name, tmp_name, MyFlags)) { int save_errno=my_errno; my_delete(to, MyFlags); /* Remove created symlink */ my_errno=save_errno; DBUG_RETURN(1); } /* Remove original symlink */ if (my_delete(from, MyFlags)) { int save_errno=my_errno; /* Remove created link */ my_delete(to, MyFlags); /* Rename file back */ if (strcmp(link_name, tmp_name)) (void) my_rename(tmp_name, link_name, MyFlags); my_errno=save_errno; result= 1; } DBUG_RETURN(result);#endif /* HAVE_READLINK */}
开发者ID:AsylumCorp,项目名称:dsploit,代码行数:64,
示例26: rtree_insert_levelstatic 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);}
开发者ID:zylishiyu,项目名称:mysql-timeout-ms,代码行数:84,
示例27: my_get_open_flagsstatic int my_get_open_flags(File fd){ DBUG_ENTER("my_get_open_flags"); validate_fd(fd); DBUG_RETURN(my_file_info[fd].oflag);}
开发者ID:ashang,项目名称:google-mysql,代码行数:6,
示例28: sslconnectint sslconnect(struct st_VioSSLFd *ptr, Vio *vio, long timeout, unsigned long *errptr){ DBUG_ENTER("sslconnect"); DBUG_RETURN(ssl_do(ptr, vio, timeout, SSL_connect, errptr));}
开发者ID:cryptdb-org,项目名称:mysql-5-5-14,代码行数:5,
注:本文中的DBUG_RETURN函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ DBWriteContactSettingByte函数代码示例 C++ DBUG_PRINT函数代码示例 |