mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 00:03:02 +01:00
Improved code to ensure better compatibility with engine12. Improvements for older engines are also included though full compatibility is still missing.
This commit is contained in:
parent
5042772c57
commit
3be789b2f7
@ -401,7 +401,10 @@ int BACKUP_backup(const TEXT* dbb_file, const TEXT* file_name)
|
||||
BURP_verbose(296);
|
||||
// msg 296 writing mapping
|
||||
write_mapping();
|
||||
}
|
||||
|
||||
if (tdgbl->runtimeODS >= DB_VERSION_DDL12)
|
||||
{
|
||||
// Write database creators
|
||||
write_db_creators();
|
||||
}
|
||||
@ -4133,47 +4136,44 @@ void write_db_creators()
|
||||
|
||||
BurpGlobals* tdgbl = BurpGlobals::getSpecific();
|
||||
|
||||
if (tdgbl->runtimeODS >= DB_VERSION_DDL12)
|
||||
{
|
||||
FOR (REQUEST_HANDLE req_handle)
|
||||
C IN RDB$DB_CREATORS
|
||||
FOR (REQUEST_HANDLE req_handle)
|
||||
C IN RDB$DB_CREATORS
|
||||
|
||||
if (first)
|
||||
{
|
||||
BURP_verbose(391);
|
||||
// msg 391 writing database create grants
|
||||
first = false;
|
||||
}
|
||||
if (first)
|
||||
{
|
||||
BURP_verbose(391);
|
||||
// msg 391 writing database create grants
|
||||
first = false;
|
||||
}
|
||||
|
||||
bool fl = true;
|
||||
bool fl = true;
|
||||
|
||||
if (!C.RDB$USER_TYPE.NULL)
|
||||
{
|
||||
if (!C.RDB$USER_TYPE.NULL)
|
||||
{
|
||||
put(tdgbl, rec_db_creator);
|
||||
fl = false;
|
||||
put_int32(att_dbc_type, C.RDB$USER_TYPE);
|
||||
}
|
||||
|
||||
if (!C.RDB$USER.NULL)
|
||||
{
|
||||
if (fl)
|
||||
put(tdgbl, rec_db_creator);
|
||||
fl = false;
|
||||
put_int32(att_dbc_type, C.RDB$USER_TYPE);
|
||||
}
|
||||
fl = false;
|
||||
const SSHORT l = PUT_TEXT(att_dbc_user, C.RDB$USER);
|
||||
|
||||
if (!C.RDB$USER.NULL)
|
||||
{
|
||||
if (fl)
|
||||
put(tdgbl, rec_db_creator);
|
||||
fl = false;
|
||||
const SSHORT l = PUT_TEXT(att_dbc_user, C.RDB$USER);
|
||||
MISC_terminate (C.RDB$USER, temp, l, sizeof(temp));
|
||||
BURP_verbose (392, temp);
|
||||
// msg 392 writing db creator %s
|
||||
}
|
||||
|
||||
MISC_terminate (C.RDB$USER, temp, l, sizeof(temp));
|
||||
BURP_verbose (392, temp);
|
||||
// msg 392 writing db creator %s
|
||||
}
|
||||
if (!fl)
|
||||
put(tdgbl, att_end);
|
||||
|
||||
if (!fl)
|
||||
put(tdgbl, att_end);
|
||||
|
||||
END_FOR;
|
||||
ON_ERROR
|
||||
general_on_error();
|
||||
END_ERROR;
|
||||
}
|
||||
END_FOR;
|
||||
ON_ERROR
|
||||
general_on_error();
|
||||
END_ERROR;
|
||||
|
||||
MISC_release_request_silent(req_handle);
|
||||
}
|
||||
|
@ -8843,8 +8843,18 @@ bool get_mapping(BurpGlobals* tdgbl)
|
||||
general_on_error ();
|
||||
END_ERROR;
|
||||
}
|
||||
else if (tdgbl->runtimeODS >= DB_VERSION_DDL11_1)
|
||||
else
|
||||
{
|
||||
int match = 0;
|
||||
const unsigned MATCH_FROM = 0x01;
|
||||
const unsigned MATCH_FROM_TYPE = 0x02;
|
||||
const unsigned MATCH_USING = 0x04;
|
||||
const unsigned MATCH_PLUGIN = 0x08;
|
||||
const unsigned MATCH_TO_TYPE = 0x10;
|
||||
const unsigned MATCH_TO = 0x20;
|
||||
const unsigned MATCH_ALL = 0x3f;
|
||||
Firebird::NoCaseString txt;
|
||||
|
||||
skip_init(&scan_next_attr);
|
||||
while (skip_scan(&scan_next_attr), get_attribute(&attribute, tdgbl) != att_end)
|
||||
{
|
||||
@ -8856,7 +8866,8 @@ bool get_mapping(BurpGlobals* tdgbl)
|
||||
break;
|
||||
|
||||
case att_map_to_type:
|
||||
get_int32(tdgbl);
|
||||
if (get_int32(tdgbl) == 1)
|
||||
match |= MATCH_TO_TYPE;
|
||||
break;
|
||||
|
||||
case att_map_name:
|
||||
@ -8866,7 +8877,37 @@ bool get_mapping(BurpGlobals* tdgbl)
|
||||
case att_map_from_type:
|
||||
case att_map_from:
|
||||
case att_map_to:
|
||||
GET_TEXT(temp);
|
||||
l = GET_TEXT(temp);
|
||||
txt.assign(temp, l);
|
||||
|
||||
switch(attribute)
|
||||
{
|
||||
case att_map_using:
|
||||
if (txt == "P")
|
||||
match |= MATCH_USING;
|
||||
break;
|
||||
|
||||
case att_map_plugin:
|
||||
if (txt == "Win_Sspi")
|
||||
match |= MATCH_PLUGIN;
|
||||
break;
|
||||
|
||||
case att_map_from_type:
|
||||
if (txt == FB_PREDEFINED_GROUP)
|
||||
match |= MATCH_FROM_TYPE;
|
||||
break;
|
||||
|
||||
case att_map_from:
|
||||
if (txt == FB_DOMAIN_ANY_RID_ADMINS)
|
||||
match |= MATCH_FROM;
|
||||
break;
|
||||
|
||||
case att_map_to:
|
||||
if (txt == ADMIN_ROLE)
|
||||
match |= MATCH_TO;
|
||||
break;
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case att_map_description:
|
||||
@ -8891,6 +8932,9 @@ bool get_mapping(BurpGlobals* tdgbl)
|
||||
// msg 301, restoring names mapping
|
||||
}
|
||||
|
||||
if (match == MATCH_ALL)
|
||||
role = ADMIN_ROLE;
|
||||
|
||||
if (role != ADMIN_ROLE)
|
||||
{
|
||||
BURP_error(300, false);
|
||||
@ -8932,51 +8976,62 @@ bool get_db_creator(BurpGlobals* tdgbl)
|
||||
**************************************/
|
||||
att_type attribute;
|
||||
scan_attr_t scan_next_attr;
|
||||
TEXT temp[GDS_NAME_LEN];
|
||||
SSHORT l;
|
||||
Firebird::string role;
|
||||
TEXT usr[GDS_NAME_LEN];
|
||||
SSHORT uType;
|
||||
bool userSet, typeSet;
|
||||
|
||||
if (tdgbl->runtimeODS >= DB_VERSION_DDL12)
|
||||
skip_init(&scan_next_attr);
|
||||
while (skip_scan(&scan_next_attr), get_attribute(&attribute, tdgbl) != att_end)
|
||||
{
|
||||
STORE (REQUEST_HANDLE tdgbl->handles_db_creators_req_handle1)
|
||||
C IN RDB$DB_CREATORS
|
||||
userSet = typeSet = false;
|
||||
|
||||
C.RDB$USER.NULL = TRUE;
|
||||
C.RDB$USER_TYPE.NULL = TRUE;
|
||||
switch (attribute)
|
||||
{
|
||||
case att_dbc_user:
|
||||
userSet = true;
|
||||
GET_TEXT(usr);
|
||||
break;
|
||||
|
||||
skip_init(&scan_next_attr);
|
||||
while (skip_scan(&scan_next_attr), get_attribute(&attribute, tdgbl) != att_end)
|
||||
case att_dbc_type:
|
||||
typeSet = true;
|
||||
uType = (SSHORT) get_int32(tdgbl);
|
||||
break;
|
||||
|
||||
default:
|
||||
// msg 395 database creator
|
||||
bad_attribute(scan_next_attr, attribute, 395);
|
||||
break;
|
||||
}
|
||||
|
||||
if (tdgbl->runtimeODS >= DB_VERSION_DDL12)
|
||||
{
|
||||
if (tdgbl->firstDbc)
|
||||
{
|
||||
switch (attribute)
|
||||
{
|
||||
case att_dbc_user:
|
||||
C.RDB$USER.NULL = FALSE;
|
||||
GET_TEXT(C.RDB$USER);
|
||||
if (tdgbl->firstDbc)
|
||||
{
|
||||
tdgbl->firstDbc = false;
|
||||
BURP_verbose(394);
|
||||
// msg 394 restoring database creators
|
||||
}
|
||||
BURP_verbose (393, C.RDB$USER);
|
||||
break;
|
||||
|
||||
case att_dbc_type:
|
||||
C.RDB$USER_TYPE.NULL = FALSE;
|
||||
C.RDB$USER_TYPE = (USHORT) get_int32(tdgbl);
|
||||
break;
|
||||
|
||||
default:
|
||||
// msg 395 database creator
|
||||
bad_attribute(scan_next_attr, attribute, 395);
|
||||
break;
|
||||
}
|
||||
tdgbl->firstDbc = false;
|
||||
BURP_verbose(394);
|
||||
// msg 394 restoring database creators
|
||||
}
|
||||
|
||||
END_STORE;
|
||||
ON_ERROR
|
||||
general_on_error ();
|
||||
END_ERROR;
|
||||
STORE (REQUEST_HANDLE tdgbl->handles_db_creators_req_handle1)
|
||||
C IN RDB$DB_CREATORS
|
||||
|
||||
BURP_verbose (393, usr);
|
||||
if (strlen(usr) > sizeof(C.RDB$USER))
|
||||
BURP_error_redirect(NULL, 46);
|
||||
|
||||
C.RDB$USER.NULL = userSet ? FALSE : TRUE;
|
||||
if (userSet)
|
||||
strncpy(C.RDB$USER, usr, sizeof(C.RDB$USER));
|
||||
|
||||
C.RDB$USER_TYPE.NULL = typeSet ? FALSE : TRUE;
|
||||
if (typeSet)
|
||||
C.RDB$USER_TYPE = uType;
|
||||
|
||||
END_STORE;
|
||||
ON_ERROR
|
||||
general_on_error ();
|
||||
END_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -10125,6 +10180,12 @@ bool get_user_privilege(BurpGlobals* tdgbl)
|
||||
|
||||
END_STORE;
|
||||
ON_ERROR
|
||||
if (tdgbl->status_vector->getErrors()[1] == isc_integ_fail)
|
||||
{
|
||||
BURP_print_status(false, &tdgbl->status_vector);
|
||||
tdgbl->flag_on_line = false;
|
||||
return true;
|
||||
}
|
||||
general_on_error ();
|
||||
END_ERROR;
|
||||
}
|
||||
@ -11756,7 +11817,14 @@ void fix_generator(BurpGlobals* tdgbl, const FixGenerator* g)
|
||||
catch (const Firebird::FbException& ex)
|
||||
{
|
||||
fb_utils::copyStatus(&tdgbl->status_vector, ex.getStatus());
|
||||
general_on_error ();
|
||||
|
||||
if (tdgbl->status_vector->getErrors()[1] == isc_dsql_error)
|
||||
{
|
||||
BURP_print_status(false, &tdgbl->status_vector);
|
||||
tdgbl->flag_on_line = false;
|
||||
}
|
||||
else
|
||||
general_on_error();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user