| 204 | */ |
| 205 | |
| 206 | static my_bool put_dbopt(const char *dbname, HA_CREATE_INFO *create) |
| 207 | { |
| 208 | my_dbopt_t *opt; |
| 209 | uint length; |
| 210 | my_bool error= 0; |
| 211 | DBUG_ENTER("put_dbopt"); |
| 212 | |
| 213 | length= (uint) strlen(dbname); |
| 214 | |
| 215 | mysql_rwlock_wrlock(&LOCK_dboptions); |
| 216 | if (!(opt= (my_dbopt_t*) my_hash_search(&dboptions, (uchar*) dbname, |
| 217 | length))) |
| 218 | { |
| 219 | /* Options are not in the hash, insert them */ |
| 220 | char *tmp_name; |
| 221 | if (!my_multi_malloc(MYF(MY_WME | MY_ZEROFILL), |
| 222 | &opt, (uint) sizeof(*opt), &tmp_name, (uint) length+1, |
| 223 | NullS)) |
| 224 | { |
| 225 | error= 1; |
| 226 | goto end; |
| 227 | } |
| 228 | |
| 229 | opt->name= tmp_name; |
| 230 | strmov(opt->name, dbname); |
| 231 | opt->name_length= length; |
| 232 | |
| 233 | if ((error= my_hash_insert(&dboptions, (uchar*) opt))) |
| 234 | { |
| 235 | my_free(opt); |
| 236 | goto end; |
| 237 | } |
| 238 | } |
| 239 | |
| 240 | /* Update / write options in hash */ |
| 241 | opt->charset= create->default_table_charset; |
| 242 | |
| 243 | end: |
| 244 | mysql_rwlock_unlock(&LOCK_dboptions); |
| 245 | DBUG_RETURN(error); |
| 246 | } |
| 247 | |
| 248 | |
| 249 | /* |
no test coverage detected