18 #include "myisamdef.h"
22 void _mi_print_key(FILE *stream,
register HA_KEYSEG *keyseg,
23 const uchar *key, uint length)
31 const uchar *key_end=key+length;
33 (void) fputs(
"Key: \"",stream);
35 for (; keyseg->type && key < key_end ;keyseg++)
38 (void) putc(
'-',stream);
39 if (keyseg->flag & HA_NULL_PART)
44 fprintf(stream,
"NULL");
48 end= key + keyseg->length;
50 switch (keyseg->type) {
51 case HA_KEYTYPE_BINARY:
52 if (!(keyseg->flag & HA_SPACE_PACK) && keyseg->length == 1)
54 (void) fprintf(stream,
"%d",(uint) *key++);
60 if (keyseg->flag & HA_SPACE_PACK)
62 (void) fprintf(stream,
"%.*s",(
int) *key,key+1);
67 (void) fprintf(stream,
"%.*s",(
int) keyseg->length,key);
72 (void) fprintf(stream,
"%d",(
int) *((
signed char*) key));
75 case HA_KEYTYPE_SHORT_INT:
76 s_1= mi_sint2korr(key);
77 (void) fprintf(stream,
"%d",(
int) s_1);
80 case HA_KEYTYPE_USHORT_INT:
83 u_1= mi_uint2korr(key);
84 (void) fprintf(stream,
"%u",(uint) u_1);
88 case HA_KEYTYPE_LONG_INT:
89 l_1=mi_sint4korr(key);
90 (void) fprintf(stream,
"%ld",l_1);
93 case HA_KEYTYPE_ULONG_INT:
94 l_1=mi_sint4korr(key);
95 (void) fprintf(stream,
"%lu",(ulong) l_1);
98 case HA_KEYTYPE_INT24:
99 (void) fprintf(stream,
"%ld",(
long) mi_sint3korr(key));
102 case HA_KEYTYPE_UINT24:
103 (void) fprintf(stream,
"%lu",(ulong) mi_uint3korr(key));
106 case HA_KEYTYPE_FLOAT:
107 mi_float4get(f_1,key);
108 (void) fprintf(stream,
"%g",(
double) f_1);
111 case HA_KEYTYPE_DOUBLE:
112 mi_float8get(d_1,key);
113 (void) fprintf(stream,
"%g",d_1);
116 #ifdef HAVE_LONG_LONG
117 case HA_KEYTYPE_LONGLONG:
120 longlong2str(mi_sint8korr(key),buff,-10);
121 (void) fprintf(stream,
"%s",buff);
125 case HA_KEYTYPE_ULONGLONG:
128 longlong2str(mi_sint8korr(key),buff,10);
129 (void) fprintf(stream,
"%s",buff);
137 for (i=0 ; i < keyseg->length ; i++)
138 fprintf(stream,
"%02x", (uint) *key++);
144 case HA_KEYTYPE_VARTEXT1:
145 case HA_KEYTYPE_VARTEXT2:
146 case HA_KEYTYPE_VARBINARY1:
147 case HA_KEYTYPE_VARBINARY2:
150 get_key_length(tmp_length,key);
155 (void) fprintf(stream,
"%.*s",(
int) tmp_length,key);
162 (void) fputs(
"\"\n",stream);
181 my_bool check_table_is_closed(
const char *
name,
const char *where)
183 char filename[FN_REFLEN];
185 DBUG_ENTER(
"check_table_is_closed");
187 (void) fn_format(filename,name,
"",MI_NAME_IEXT,4+16+32);
189 for (pos=myisam_open_list ; pos ; pos=pos->next)
193 if (!strcmp(share->unique_file_name,filename))
195 if (share->last_version)
198 fprintf(stderr,
"Warning: Table: %s is open on %s\n", name,where);
199 DBUG_PRINT(
"warning",(
"Table: %s is open on %s", name,where));