MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / act_set_names

Function act_set_names

src/gpre/sql.cpp:4263–4335  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4261//
4262
4263static act* act_set_names()
4264{
4265 if (gpreGlob.sw_auto)
4266 CPR_warn("SET NAMES requires -manual switch to gpre.");
4267
4268 act* action = (act*) MSC_alloc(ACT_LEN);
4269 action->act_type = ACT_noop;
4270
4271 if (MSC_match(KW_COLON))
4272 {
4273 // User is specifying a host variable or string as
4274 // the character set. Make this the run-time set.
4275
4276 TEXT* value = PAR_native_value(false, false);
4277 for (gpre_dbb* db = gpreGlob.isc_databases; db; db = db->dbb_next)
4278 {
4279 if (db->dbb_r_lc_ctype)
4280 {
4281 char buffer[ERROR_LENGTH];
4282 fb_utils::snprintf(buffer, sizeof(buffer),
4283 "Supersedes runtime character set for database %s",
4284 db->dbb_filename ? db->dbb_filename : db->dbb_name->sym_string);
4285 CPR_warn(buffer);
4286 }
4287 db->dbb_r_lc_ctype = value;
4288 }
4289 }
4290 else if (gpreGlob.token_global.tok_type == tok_ident)
4291 {
4292 // User is specifying the name of a character set
4293 // Make this the compile time character set
4294
4295 TEXT* value = (TEXT*) MSC_alloc(gpreGlob.token_global.tok_length + 1);
4296 MSC_copy(gpreGlob.token_global.tok_string, gpreGlob.token_global.tok_length, value);
4297 value[gpreGlob.token_global.tok_length] = '\0';
4298
4299 // Due to the ambiguities involved in having modules expressed
4300 // in multiple compile-time character sets, we disallow it.
4301
4302 if (gpreGlob.module_lc_ctype && strcmp(gpreGlob.module_lc_ctype, value) != 0)
4303 PAR_error("Duplicate declaration of module CHARACTER SET");
4304
4305 gpreGlob.module_lc_ctype = value;
4306 for (gpre_dbb* db = gpreGlob.isc_databases; db; db = db->dbb_next)
4307 {
4308 if (db->dbb_c_lc_ctype)
4309 {
4310 char buffer[ERROR_LENGTH];
4311 fb_utils::snprintf(buffer, sizeof(buffer),
4312 "Supersedes character set for database %s",
4313 db->dbb_filename ? db->dbb_filename : db->dbb_name->sym_string);
4314 CPR_warn(buffer);
4315 }
4316
4317 db->dbb_c_lc_ctype = value;
4318 if (!(db->dbb_flags & DBB_sqlca))
4319 {
4320 // Verify that character set name is valid,

Callers 1

act_setFunction · 0.85

Calls 10

CPR_warnFunction · 0.85
MSC_allocFunction · 0.85
MSC_matchFunction · 0.85
PAR_native_valueFunction · 0.85
MSC_copyFunction · 0.85
MSC_find_symbolFunction · 0.85
CPR_tokenFunction · 0.85
CPR_s_errorFunction · 0.85
PAR_errorFunction · 0.70
snprintfFunction · 0.50

Tested by

no test coverage detected