#include "myisam.h"#include <my_getopt.h>#include <m_string.h>Include dependency graph for mi_test1.c:

Go to the source code of this file.
Defines | |
| #define | MAX_REC_LENGTH 1024 |
Functions | |
| static void | usage () |
| static int | run_test (const char *filename) |
| static void | get_options (int argc, char *argv[]) |
| static void | create_key (char *key, uint rownr) |
| static void | create_record (char *record, uint rownr) |
| static void | update_record (char *record) |
| int | main (int argc, char *argv[]) |
| static void | create_key_part (char *key, uint rownr) |
| static my_bool | get_one_option (int optid, const struct my_option *opt __attribute__((unused)), char *argument) |
Variables | |
| static int | rec_pointer_size = 0 |
| static int | flags [50] |
| static int | key_field = FIELD_SKIP_PRESPACE |
| static int | extra_field = FIELD_SKIP_ENDSPACE |
| static int | key_type = HA_KEYTYPE_NUM |
| static int | create_flag = 0 |
| static uint | insert_count |
| static uint | update_count |
| static uint | remove_count |
| static uint | pack_keys = 0 |
| static uint | pack_seg = 0 |
| static uint | key_length |
| static uint | unique_key = HA_NOSAME |
| static my_bool | key_cacheing |
| static my_bool | null_fields |
| static my_bool | silent |
| static my_bool | skip_update |
| static my_bool | opt_unique |
| static my_bool | verbose |
| static MI_COLUMNDEF | recinfo [4] |
| static MI_KEYDEF | keyinfo [10] |
| static HA_KEYSEG | keyseg [10] |
| static HA_KEYSEG | uniqueseg [10] |
| static char | blob_key [MAX_REC_LENGTH] |
| static char | blob_record [MAX_REC_LENGTH+20 *20] |
| static struct my_option | my_long_options [] |
| #define MAX_REC_LENGTH 1024 |
Definition at line 23 of file mi_test1.c.
| static void create_key | ( | char * | key, | |
| uint | rownr | |||
| ) | [static] |
Definition at line 369 of file mi_test1.c.
References create_key_part(), flag, HA_BLOB_PART, HA_VAR_LENGTH_PART, int2store, keyinfo, and strlen().
Referenced by run_test().
00370 { 00371 if (keyinfo[0].seg[0].null_bit) 00372 { 00373 if (rownr == 0) 00374 { 00375 key[0]=1; /* null key */ 00376 key[1]=0; /* Fore easy print of key */ 00377 return; 00378 } 00379 *key++=0; 00380 } 00381 if (keyinfo[0].seg[0].flag & (HA_BLOB_PART | HA_VAR_LENGTH_PART)) 00382 { 00383 uint tmp; 00384 create_key_part(key+2,rownr); 00385 tmp=strlen(key+2); 00386 int2store(key,tmp); 00387 } 00388 else 00389 create_key_part(key,rownr); 00390 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void create_key_part | ( | char * | key, | |
| uint | rownr | |||
| ) | [static] |
Definition at line 330 of file mi_test1.c.
References bfill, flag, HA_KEYTYPE_NUM, HA_KEYTYPE_VARTEXT1, HA_KEYTYPE_VARTEXT2, HA_SPACE_PACK, keyinfo, and unique_key.
Referenced by create_key(), and create_record().
00331 { 00332 if (!unique_key) 00333 rownr&=7; /* Some identical keys */ 00334 if (keyinfo[0].seg[0].type == HA_KEYTYPE_NUM) 00335 { 00336 sprintf(key,"%*d",keyinfo[0].seg[0].length,rownr); 00337 } 00338 else if (keyinfo[0].seg[0].type == HA_KEYTYPE_VARTEXT1 || 00339 keyinfo[0].seg[0].type == HA_KEYTYPE_VARTEXT2) 00340 { /* Alpha record */ 00341 /* Create a key that may be easily packed */ 00342 bfill(key,keyinfo[0].seg[0].length,rownr < 10 ? 'A' : 'B'); 00343 sprintf(key+keyinfo[0].seg[0].length-2,"%-2d",rownr); 00344 if ((rownr & 7) == 0) 00345 { 00346 /* Change the key to force a unpack of the next key */ 00347 bfill(key+3,keyinfo[0].seg[0].length-4,rownr < 10 ? 'a' : 'b'); 00348 } 00349 } 00350 else 00351 { /* Alpha record */ 00352 if (keyinfo[0].seg[0].flag & HA_SPACE_PACK) 00353 sprintf(key,"%-*d",keyinfo[0].seg[0].length,rownr); 00354 else 00355 { 00356 /* Create a key that may be easily packed */ 00357 bfill(key,keyinfo[0].seg[0].length,rownr < 10 ? 'A' : 'B'); 00358 sprintf(key+keyinfo[0].seg[0].length-2,"%-2d",rownr); 00359 if ((rownr & 7) == 0) 00360 { 00361 /* Change the key to force a unpack of the next key */ 00362 key[1]= (rownr < 10 ? 'a' : 'b'); 00363 } 00364 } 00365 } 00366 }
Here is the caller graph for this function:

| static void create_record | ( | char * | record, | |
| uint | rownr | |||
| ) | [static] |
Definition at line 397 of file mi_test1.c.
References blob_key, blob_record, bzero, create_key_part(), FIELD_BLOB, FIELD_VARCHAR, HA_VARCHAR_PACKLENGTH, int2store, int4store, keyinfo, st_columndef::length, max, MAX_REC_LENGTH, memcpy_fixed, st_HA_KEYSEG::null_bit, pos(), recinfo, st_mi_keydef::seg, strappend(), and strlen().
00398 { 00399 char *pos; 00400 bzero((char*) record,MAX_REC_LENGTH); 00401 record[0]=1; /* delete marker */ 00402 if (rownr == 0 && keyinfo[0].seg[0].null_bit) 00403 record[0]|=keyinfo[0].seg[0].null_bit; /* Null key */ 00404 00405 pos=record+1; 00406 if (recinfo[1].type == FIELD_BLOB) 00407 { 00408 uint tmp; 00409 char *ptr; 00410 create_key_part(blob_key,rownr); 00411 tmp=strlen(blob_key); 00412 int4store(pos,tmp); 00413 ptr=blob_key; 00414 memcpy_fixed(pos+4,&ptr,sizeof(char*)); 00415 pos+=recinfo[1].length; 00416 } 00417 else if (recinfo[1].type == FIELD_VARCHAR) 00418 { 00419 uint tmp, pack_length= HA_VARCHAR_PACKLENGTH(recinfo[1].length-1); 00420 create_key_part(pos+pack_length,rownr); 00421 tmp= strlen(pos+pack_length); 00422 if (pack_length == 1) 00423 *(uchar*) pos= (uchar) tmp; 00424 else 00425 int2store(pos,tmp); 00426 pos+= recinfo[1].length; 00427 } 00428 else 00429 { 00430 create_key_part(pos,rownr); 00431 pos+=recinfo[1].length; 00432 } 00433 if (recinfo[2].type == FIELD_BLOB) 00434 { 00435 uint tmp; 00436 char *ptr;; 00437 sprintf(blob_record,"... row: %d", rownr); 00438 strappend(blob_record,max(MAX_REC_LENGTH-rownr,10),' '); 00439 tmp=strlen(blob_record); 00440 int4store(pos,tmp); 00441 ptr=blob_record; 00442 memcpy_fixed(pos+4,&ptr,sizeof(char*)); 00443 } 00444 else if (recinfo[2].type == FIELD_VARCHAR) 00445 { 00446 uint tmp, pack_length= HA_VARCHAR_PACKLENGTH(recinfo[1].length-1); 00447 sprintf(pos+pack_length, "... row: %d", rownr); 00448 tmp= strlen(pos+pack_length); 00449 if (pack_length == 1) 00450 *(uchar*) pos= (uchar) tmp; 00451 else 00452 int2store(pos,tmp); 00453 } 00454 else 00455 { 00456 sprintf(pos,"... row: %d", rownr); 00457 strappend(pos,recinfo[2].length,' '); 00458 } 00459 }
Here is the call graph for this function:

| static my_bool get_one_option | ( | int | optid, | |
| const struct my_option *opt | __attribute__((unused)), | |||
| char * | argument | |||
| ) | [static] |
Definition at line 586 of file mi_test1.c.
References create_flag, DBUG_PUSH, exit, extra_field, FIELD_BLOB, FIELD_NORMAL, FIELD_VARCHAR, HA_BINARY_PACK_KEY, HA_BLOB_PART, HA_CREATE_CHECKSUM, HA_KEYTYPE_TEXT, HA_KEYTYPE_VARTEXT1, HA_PACK_KEY, HA_PACK_RECORD, HA_SPACE_PACK, HA_VAR_LENGTH_PART, key_cacheing, key_field, key_type, MI_MAX_KEY_LENGTH, pack_keys, pack_seg, rec_pointer_size, unique_key, and usage().
00588 { 00589 switch(optid) { 00590 case 'a': 00591 key_type= HA_KEYTYPE_TEXT; 00592 break; 00593 case 'c': 00594 create_flag|= HA_CREATE_CHECKSUM; 00595 break; 00596 case 'R': /* Length of record pointer */ 00597 if (rec_pointer_size > 3) 00598 rec_pointer_size=0; 00599 break; 00600 case 'P': 00601 pack_keys= HA_PACK_KEY; /* Use prefix compression */ 00602 break; 00603 case 'B': 00604 pack_keys= HA_BINARY_PACK_KEY; /* Use binary compression */ 00605 break; 00606 case 'S': 00607 if (key_field == FIELD_VARCHAR) 00608 { 00609 create_flag=0; /* Static sized varchar */ 00610 } 00611 else if (key_field != FIELD_BLOB) 00612 { 00613 key_field=FIELD_NORMAL; /* static-size record */ 00614 extra_field=FIELD_NORMAL; 00615 } 00616 break; 00617 case 'p': 00618 pack_keys=HA_PACK_KEY; /* Use prefix + space packing */ 00619 pack_seg=HA_SPACE_PACK; 00620 key_type=HA_KEYTYPE_TEXT; 00621 break; 00622 case 'm': 00623 unique_key=0; 00624 break; 00625 case 'b': 00626 key_field=FIELD_BLOB; /* blob key */ 00627 extra_field= FIELD_BLOB; 00628 pack_seg|= HA_BLOB_PART; 00629 key_type= HA_KEYTYPE_VARTEXT1; 00630 break; 00631 case 'k': 00632 if (key_length < 4 || key_length > MI_MAX_KEY_LENGTH) 00633 { 00634 fprintf(stderr,"Wrong key length\n"); 00635 exit(1); 00636 } 00637 break; 00638 case 'w': 00639 key_field=FIELD_VARCHAR; /* varchar keys */ 00640 extra_field= FIELD_VARCHAR; 00641 key_type= HA_KEYTYPE_VARTEXT1; 00642 pack_seg|= HA_VAR_LENGTH_PART; 00643 create_flag|= HA_PACK_RECORD; 00644 break; 00645 case 'K': /* Use key cacheing */ 00646 key_cacheing=1; 00647 break; 00648 case 'V': 00649 printf("test1 Ver 1.2 \n"); 00650 exit(0); 00651 case '#': 00652 DBUG_PUSH (argument); 00653 break; 00654 case '?': 00655 usage(); 00656 exit(1); 00657 } 00658 return 0; 00659 }
Here is the call graph for this function:

| static void get_options | ( | int | argc, | |
| char * | argv[] | |||
| ) | [static] |
Definition at line 664 of file mi_test1.c.
References exit, get_one_option(), handle_options(), and my_long_options.
00665 { 00666 int ho_error; 00667 00668 if ((ho_error=handle_options(&argc, &argv, my_long_options, get_one_option))) 00669 exit(ho_error); 00670 00671 return; 00672 } /* get options */
Here is the call graph for this function:

| int main | ( | int | argc, | |
| char * | argv[] | |||
| ) |
Definition at line 48 of file mi_test1.c.
References dflt_key_cache, exit, get_options(), init_key_cache(), IO_SIZE, KEY_CACHE_BLOCK_SIZE, key_cacheing, my_init(), MY_INIT, and run_test().
00049 { 00050 MY_INIT(argv[0]); 00051 my_init(); 00052 if (key_cacheing) 00053 init_key_cache(dflt_key_cache,KEY_CACHE_BLOCK_SIZE,IO_SIZE*16,0,0); 00054 get_options(argc,argv); 00055 00056 exit(run_test("test1")); 00057 }
Here is the call graph for this function:

| static int run_test | ( | const char * | filename | ) | [static] |
Definition at line 60 of file mi_test1.c.
References st_HA_KEYSEG::bit_start, st_mi_keydef::block_length, bzero, create_flag, create_key(), create_record(), default_charset_info, err, error, exit, extra_field, FIELD_BLOB, FIELD_CHECK, FIELD_NORMAL, FIELD_VARCHAR, flag, st_mi_keydef::flag, st_HA_KEYSEG::flag, flags, HA_BLOB_PART, HA_ERR_END_OF_FILE, HA_ERR_FOUND_DUPP_UNIQUE, HA_ERR_KEY_NOT_FOUND, HA_ERR_RECORD_DELETED, HA_KEY_ALG_BTREE, HA_KEYTYPE_TEXT, HA_KEYTYPE_VARTEXT1, HA_KEYTYPE_VARTEXT2, HA_OFFSET_ERROR, HA_OPEN_ABORT_IF_LOCKED, HA_READ_KEY_EXACT, HA_VAR_LENGTH_PART, HA_VARCHAR_PACKLENGTH, insert_count, key, st_mi_keydef::key_alg, key_field, key_length, key_type, keyinfo, keyseg, st_mi_keydef::keysegs, st_HA_KEYSEG::language, st_HA_KEYSEG::length, MAX_REC_LENGTH, memcpy, mi_close(), mi_create(), mi_delete(), mi_open(), mi_portable_sizeof_char_ptr, mi_rkey(), mi_rrnd(), mi_rsame(), MI_UNIQUE_HASH_LENGTH, mi_update(), mi_write(), MY_CHECK_ERROR, my_end(), my_errno, st_HA_KEYSEG::null_bit, null_fields, st_HA_KEYSEG::null_pos, charset_info_st::number, opt_unique, pack_keys, pack_seg, pos(), read_record, rec_pointer_size, recinfo, remove_count, st_mi_keydef::seg, silent, skip_update, start(), st_HA_KEYSEG::start, test, st_HA_KEYSEG::type, unique_key, uniqueseg, update_count, update_record(), verbose, and VOID.
00061 { 00062 MI_INFO *file; 00063 int i,j,error,deleted,rec_length,uniques=0; 00064 ha_rows found,row_count; 00065 my_off_t pos; 00066 char record[MAX_REC_LENGTH],key[MAX_REC_LENGTH],read_record[MAX_REC_LENGTH]; 00067 MI_UNIQUEDEF uniquedef; 00068 MI_CREATE_INFO create_info; 00069 00070 bzero((char*) recinfo,sizeof(recinfo)); 00071 00072 /* First define 2 columns */ 00073 recinfo[0].type=FIELD_NORMAL; recinfo[0].length=1; /* For NULL bits */ 00074 recinfo[1].type=key_field; 00075 recinfo[1].length= (key_field == FIELD_BLOB ? 4+mi_portable_sizeof_char_ptr : 00076 key_length); 00077 if (key_field == FIELD_VARCHAR) 00078 recinfo[1].length+= HA_VARCHAR_PACKLENGTH(key_length);; 00079 recinfo[2].type=extra_field; 00080 recinfo[2].length= (extra_field == FIELD_BLOB ? 4 + mi_portable_sizeof_char_ptr : 24); 00081 if (extra_field == FIELD_VARCHAR) 00082 recinfo[2].length+= HA_VARCHAR_PACKLENGTH(recinfo[2].length); 00083 if (opt_unique) 00084 { 00085 recinfo[3].type=FIELD_CHECK; 00086 recinfo[3].length=MI_UNIQUE_HASH_LENGTH; 00087 } 00088 rec_length=recinfo[0].length+recinfo[1].length+recinfo[2].length+ 00089 recinfo[3].length; 00090 00091 if (key_type == HA_KEYTYPE_VARTEXT1 && 00092 key_length > 255) 00093 key_type= HA_KEYTYPE_VARTEXT2; 00094 00095 /* Define a key over the first column */ 00096 keyinfo[0].seg=keyseg; 00097 keyinfo[0].keysegs=1; 00098 keyinfo[0].block_length= 0; /* Default block length */ 00099 keyinfo[0].key_alg=HA_KEY_ALG_BTREE; 00100 keyinfo[0].seg[0].type= key_type; 00101 keyinfo[0].seg[0].flag= pack_seg; 00102 keyinfo[0].seg[0].start=1; 00103 keyinfo[0].seg[0].length=key_length; 00104 keyinfo[0].seg[0].null_bit= null_fields ? 2 : 0; 00105 keyinfo[0].seg[0].null_pos=0; 00106 keyinfo[0].seg[0].language= default_charset_info->number; 00107 if (pack_seg & HA_BLOB_PART) 00108 { 00109 keyinfo[0].seg[0].bit_start=4; /* Length of blob length */ 00110 } 00111 keyinfo[0].flag = (uint8) (pack_keys | unique_key); 00112 00113 bzero((byte*) flags,sizeof(flags)); 00114 if (opt_unique) 00115 { 00116 uint start; 00117 uniques=1; 00118 bzero((char*) &uniquedef,sizeof(uniquedef)); 00119 bzero((char*) uniqueseg,sizeof(uniqueseg)); 00120 uniquedef.seg=uniqueseg; 00121 uniquedef.keysegs=2; 00122 00123 /* Make a unique over all columns (except first NULL fields) */ 00124 for (i=0, start=1 ; i < 2 ; i++) 00125 { 00126 uniqueseg[i].start=start; 00127 start+=recinfo[i+1].length; 00128 uniqueseg[i].length=recinfo[i+1].length; 00129 uniqueseg[i].language= default_charset_info->number; 00130 } 00131 uniqueseg[0].type= key_type; 00132 uniqueseg[0].null_bit= null_fields ? 2 : 0; 00133 uniqueseg[1].type= HA_KEYTYPE_TEXT; 00134 if (extra_field == FIELD_BLOB) 00135 { 00136 uniqueseg[1].length=0; /* The whole blob */ 00137 uniqueseg[1].bit_start=4; /* long blob */ 00138 uniqueseg[1].flag|= HA_BLOB_PART; 00139 } 00140 else if (extra_field == FIELD_VARCHAR) 00141 uniqueseg[1].flag|= HA_VAR_LENGTH_PART; 00142 } 00143 else 00144 uniques=0; 00145 00146 if (!silent) 00147 printf("- Creating isam-file\n"); 00148 bzero((char*) &create_info,sizeof(create_info)); 00149 create_info.max_rows=(ulong) (rec_pointer_size ? 00150 (1L << (rec_pointer_size*8))/40 : 00151 0); 00152 if (mi_create(filename,1,keyinfo,3+opt_unique,recinfo, 00153 uniques, &uniquedef, &create_info, 00154 create_flag)) 00155 goto err; 00156 if (!(file=mi_open(filename,2,HA_OPEN_ABORT_IF_LOCKED))) 00157 goto err; 00158 if (!silent) 00159 printf("- Writing key:s\n"); 00160 00161 my_errno=0; 00162 row_count=deleted=0; 00163 for (i=49 ; i>=1 ; i-=2 ) 00164 { 00165 if (insert_count-- == 0) { VOID(mi_close(file)) ; exit(0) ; } 00166 j=i%25 +1; 00167 create_record(record,j); 00168 error=mi_write(file,record); 00169 if (!error) 00170 row_count++; 00171 flags[j]=1; 00172 if (verbose || error) 00173 printf("J= %2d mi_write: %d errno: %d\n", j,error,my_errno); 00174 } 00175 00176 /* Insert 2 rows with null values */ 00177 if (null_fields) 00178 { 00179 create_record(record,0); 00180 error=mi_write(file,record); 00181 if (!error) 00182 row_count++; 00183 if (verbose || error) 00184 printf("J= NULL mi_write: %d errno: %d\n", error,my_errno); 00185 error=mi_write(file,record); 00186 if (!error) 00187 row_count++; 00188 if (verbose || error) 00189 printf("J= NULL mi_write: %d errno: %d\n", error,my_errno); 00190 flags[0]=2; 00191 } 00192 00193 if (!skip_update) 00194 { 00195 if (opt_unique) 00196 { 00197 if (!silent) 00198 printf("- Checking unique constraint\n"); 00199 create_record(record,j); 00200 if (!mi_write(file,record) || my_errno != HA_ERR_FOUND_DUPP_UNIQUE) 00201 { 00202 printf("unique check failed\n"); 00203 } 00204 } 00205 if (!silent) 00206 printf("- Updating rows\n"); 00207 00208 /* Update first last row to force extend of file */ 00209 if (mi_rsame(file,read_record,-1)) 00210 { 00211 printf("Can't find last row with mi_rsame\n"); 00212 } 00213 else 00214 { 00215 memcpy(record,read_record,rec_length); 00216 update_record(record); 00217 if (mi_update(file,read_record,record)) 00218 { 00219 printf("Can't update last row: %.*s\n", 00220 keyinfo[0].seg[0].length,read_record+1); 00221 } 00222 } 00223 00224 /* Read through all rows and update them */ 00225 pos=(my_off_t) 0; 00226 found=0; 00227 while ((error=mi_rrnd(file,read_record,pos)) == 0) 00228 { 00229 if (update_count-- == 0) { VOID(mi_close(file)) ; exit(0) ; } 00230 memcpy(record,read_record,rec_length); 00231 update_record(record); 00232 if (mi_update(file,read_record,record)) 00233 { 00234 printf("Can't update row: %.*s, error: %d\n", 00235 keyinfo[0].seg[0].length,record+1,my_errno); 00236 } 00237 found++; 00238 pos=HA_OFFSET_ERROR; 00239 } 00240 if (found != row_count) 00241 printf("Found %ld of %ld rows\n", (ulong) found, (ulong) row_count); 00242 } 00243 00244 if (!silent) 00245 printf("- Reopening file\n"); 00246 if (mi_close(file)) goto err; 00247 if (!(file=mi_open(filename,2,HA_OPEN_ABORT_IF_LOCKED))) goto err; 00248 if (!skip_update) 00249 { 00250 if (!silent) 00251 printf("- Removing keys\n"); 00252 00253 for (i=0 ; i <= 10 ; i++) 00254 { 00255 /* testing */ 00256 if (remove_count-- == 0) { VOID(mi_close(file)) ; exit(0) ; } 00257 j=i*2; 00258 if (!flags[j]) 00259 continue; 00260 create_key(key,j); 00261 my_errno=0; 00262 if ((error = mi_rkey(file,read_record,0,key,0,HA_READ_KEY_EXACT))) 00263 { 00264 if (verbose || (flags[j] >= 1 || 00265 (error && my_errno != HA_ERR_KEY_NOT_FOUND))) 00266 printf("key: '%.*s' mi_rkey: %3d errno: %3d\n", 00267 (int) key_length,key+test(null_fields),error,my_errno); 00268 } 00269 else 00270 { 00271 error=mi_delete(file,read_record); 00272 if (verbose || error) 00273 printf("key: '%.*s' mi_delete: %3d errno: %3d\n", 00274 (int) key_length, key+test(null_fields), error, my_errno); 00275 if (! error) 00276 { 00277 deleted++; 00278 flags[j]--; 00279 } 00280 } 00281 } 00282 } 00283 if (!silent) 00284 printf("- Reading rows with key\n"); 00285 for (i=0 ; i <= 25 ; i++) 00286 { 00287 create_key(key,i); 00288 my_errno=0; 00289 error=mi_rkey(file,read_record,0,key,0,HA_READ_KEY_EXACT); 00290 if (verbose || 00291 (error == 0 && flags[i] == 0 && unique_key) || 00292 (error && (flags[i] != 0 || my_errno != HA_ERR_KEY_NOT_FOUND))) 00293 { 00294 printf("key: '%.*s' mi_rkey: %3d errno: %3d record: %s\n", 00295 (int) key_length,key+test(null_fields),error,my_errno,record+1); 00296 } 00297 } 00298 00299 if (!silent) 00300 printf("- Reading rows with position\n"); 00301 for (i=1,found=0 ; i <= 30 ; i++) 00302 { 00303 my_errno=0; 00304 if ((error=mi_rrnd(file,read_record,i == 1 ? 0L : HA_OFFSET_ERROR)) == -1) 00305 { 00306 if (found != row_count-deleted) 00307 printf("Found only %ld of %ld rows\n", (ulong) found, 00308 (ulong) (row_count - deleted)); 00309 break; 00310 } 00311 if (!error) 00312 found++; 00313 if (verbose || (error != 0 && error != HA_ERR_RECORD_DELETED && 00314 error != HA_ERR_END_OF_FILE)) 00315 { 00316 printf("pos: %2d mi_rrnd: %3d errno: %3d record: %s\n", 00317 i-1,error,my_errno,read_record+1); 00318 } 00319 } 00320 if (mi_close(file)) goto err; 00321 my_end(MY_CHECK_ERROR); 00322 00323 return (0); 00324 err: 00325 printf("got error: %3d when using myisam-database\n",my_errno); 00326 return 1; /* skip warning */ 00327 }
Here is the call graph for this function:

| static void update_record | ( | char * | record | ) | [static] |
Definition at line 463 of file mi_test1.c.
References bfill, blob_key, blob_record, my_charset_handler_st::casedn, charset_info_st::cset, default_charset_info, FIELD_BLOB, FIELD_VARCHAR, HA_KEYTYPE_NUM, HA_VARCHAR_PACKLENGTH, int2store, int4store, keyinfo, st_columndef::length, memcpy, memcpy_fixed, pos(), recinfo, uint2korr, and uint4korr.
Referenced by run_test().
00464 { 00465 char *pos=record+1; 00466 if (recinfo[1].type == FIELD_BLOB) 00467 { 00468 char *column,*ptr; 00469 int length; 00470 length=uint4korr(pos); /* Long blob */ 00471 memcpy_fixed(&column,pos+4,sizeof(char*)); 00472 memcpy(blob_key,column,length); /* Move old key */ 00473 ptr=blob_key; 00474 memcpy_fixed(pos+4,&ptr,sizeof(char*)); /* Store pointer to new key */ 00475 if (keyinfo[0].seg[0].type != HA_KEYTYPE_NUM) 00476 default_charset_info->cset->casedn(default_charset_info, 00477 blob_key, length, blob_key, length); 00478 pos+=recinfo[1].length; 00479 } 00480 else if (recinfo[1].type == FIELD_VARCHAR) 00481 { 00482 uint pack_length= HA_VARCHAR_PACKLENGTH(recinfo[1].length-1); 00483 uint length= pack_length == 1 ? (uint) *(uchar*) pos : uint2korr(pos); 00484 default_charset_info->cset->casedn(default_charset_info, 00485 pos + pack_length, length, 00486 pos + pack_length, length); 00487 pos+=recinfo[1].length; 00488 } 00489 else 00490 { 00491 if (keyinfo[0].seg[0].type != HA_KEYTYPE_NUM) 00492 default_charset_info->cset->casedn(default_charset_info, 00493 pos, keyinfo[0].seg[0].length, 00494 pos, keyinfo[0].seg[0].length); 00495 pos+=recinfo[1].length; 00496 } 00497 00498 if (recinfo[2].type == FIELD_BLOB) 00499 { 00500 char *column; 00501 int length; 00502 length=uint4korr(pos); 00503 memcpy_fixed(&column,pos+4,sizeof(char*)); 00504 memcpy(blob_record,column,length); 00505 bfill(blob_record+length,20,'.'); /* Make it larger */ 00506 length+=20; 00507 int4store(pos,length); 00508 column=blob_record; 00509 memcpy_fixed(pos+4,&column,sizeof(char*)); 00510 } 00511 else if (recinfo[2].type == FIELD_VARCHAR) 00512 { 00513 /* Second field is longer than 10 characters */ 00514 uint pack_length= HA_VARCHAR_PACKLENGTH(recinfo[1].length-1); 00515 uint length= pack_length == 1 ? (uint) *(uchar*) pos : uint2korr(pos); 00516 bfill(pos+pack_length+length,recinfo[2].length-length-pack_length,'.'); 00517 length=recinfo[2].length-pack_length; 00518 if (pack_length == 1) 00519 *(uchar*) pos= (uchar) length; 00520 else 00521 int2store(pos,length); 00522 } 00523 else 00524 { 00525 bfill(pos+recinfo[2].length-10,10,'.'); 00526 } 00527 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void usage | ( | ) | [static] |
Definition at line 3308 of file mysqltest.c.
03309 { 03310 print_version(); 03311 printf("MySQL AB, by Sasha, Matt, Monty & Jani\n"); 03312 printf("This software comes with ABSOLUTELY NO WARRANTY\n\n"); 03313 printf("Runs a test against the mysql server and compares output with a results file.\n\n"); 03314 printf("Usage: %s [OPTIONS] [database] < test_file\n", my_progname); 03315 my_print_help(my_long_options); 03316 printf(" --no-defaults Don't read default options from any options file.\n"); 03317 my_print_variables(my_long_options); 03318 }
char blob_key[MAX_REC_LENGTH] [static] |
Definition at line 393 of file mi_test1.c.
char blob_record[MAX_REC_LENGTH+20 *20] [static] |
Definition at line 394 of file mi_test1.c.
int create_flag = 0 [static] |
Definition at line 30 of file mi_test1.c.
int extra_field = FIELD_SKIP_ENDSPACE [static] |
Definition at line 28 of file mi_test1.c.
int flags[50] [static] |
Definition at line 27 of file mi_test1.c.
uint insert_count [static] |
my_bool key_cacheing [static] |
Definition at line 35 of file mi_test1.c.
Referenced by get_one_option(), get_options(), main(), and start_test().
int key_field = FIELD_SKIP_PRESPACE [static] |
Definition at line 28 of file mi_test1.c.
uint key_length [static] |
Definition at line 33 of file mi_test1.c.
int key_type = HA_KEYTYPE_NUM [static] |
Definition at line 29 of file mi_test1.c.
Definition at line 38 of file mi_test1.c.
Definition at line 39 of file mi_test1.c.
struct my_option my_long_options[] [static] |
Definition at line 530 of file mi_test1.c.
my_bool null_fields [static] |
Definition at line 35 of file mi_test1.c.
Referenced by calc_used_field_length(), get_addon_fields(), mysql_prepare_table(), pack_header(), and run_test().
my_bool opt_unique [static] |
uint pack_keys = 0 [static] |
Definition at line 33 of file mi_test1.c.
Referenced by get_one_option(), mysql_create_frm(), and run_test().
Definition at line 33 of file mi_test1.c.
Referenced by get_one_option(), get_options(), main(), and run_test().
int rec_pointer_size = 0 [static] |
Definition at line 27 of file mi_test1.c.
Referenced by get_one_option(), get_options(), main(), and run_test().
MI_COLUMNDEF recinfo[4] [static] |
Definition at line 37 of file mi_test1.c.
uint remove_count [static] |
Definition at line 35 of file mi_test1.c.
my_bool skip_update [static] |
Definition at line 35 of file mi_test1.c.
uint unique_key = HA_NOSAME [static] |
Definition at line 34 of file mi_test1.c.
Referenced by create_key_part(), get_one_option(), and run_test().
uint update_count [static] |
Definition at line 35 of file mi_test1.c.
1.4.7

