From: Dmitry Y. <di...@us...> - 2002-07-01 15:46:10
|
Update of /cvsroot/firebird/firebird2/src/jrd In directory usw-pr-cvs1:/tmp/cvs-serv17887/jrd Modified Files: grant.epp inf.cpp inf.h ini.h Log Message: Merging changes from fb1. Index: grant.epp =================================================================== RCS file: /cvsroot/firebird/firebird2/src/jrd/grant.epp,v retrieving revision 1.4 retrieving revision 1.5 diff -U3 -r1.4 -r1.5 --- grant.epp 4 Apr 2002 07:10:40 -0000 1.4 +++ grant.epp 1 Jul 2002 15:46:06 -0000 1.5 @@ -84,7 +84,6 @@ TEXT *, TEXT *, USHORT, ULONG *); static void save_security_class(TDBB, TEXT *, UCHAR *, USHORT); static USHORT trans_sql_priv(TEXT *); -static USHORT terminate(TEXT *); static SLONG squeeze_acl(UCHAR *, UCHAR **, TEXT *, SSHORT); static BOOLEAN check_string(TEXT *, TEXT *); @@ -314,15 +313,9 @@ dbb = tdbb->tdbb_database; if (!*default_class) { -#ifndef EXACT_NUMERICS - sprintf(default_class, "%s%ld\0", DEFAULT_CLASS, - DPM_gen_id(tdbb, MET_lookup_generator(tdbb, DEFAULT_CLASS), 0, - (SLONG) 1)); -#else sprintf(default_class, "%s%" QUADFORMAT "d\0", DEFAULT_CLASS, DPM_gen_id(tdbb, MET_lookup_generator(tdbb, DEFAULT_CLASS), 0, (SINT64) 1)); -#endif request = (BLK) CMP_find_request(tdbb, irq_grant7, IRQ_REQUESTS); @@ -499,11 +492,11 @@ if (!REQUEST(irq_grant1)) REQUEST(irq_grant1) = request; - terminate(REL.RDB$SECURITY_CLASS); + DYN_terminate(REL.RDB$SECURITY_CLASS, sizeof(REL.RDB$SECURITY_CLASS)); strcpy(s_class, REL.RDB$SECURITY_CLASS); - terminate(REL.RDB$DEFAULT_CLASS); + DYN_terminate(REL.RDB$DEFAULT_CLASS, sizeof(REL.RDB$DEFAULT_CLASS)); strcpy(default_class, REL.RDB$DEFAULT_CLASS); - terminate(REL.RDB$OWNER_NAME); + DYN_terminate(REL.RDB$OWNER_NAME, sizeof(REL.RDB$OWNER_NAME)); strcpy(owner, REL.RDB$OWNER_NAME); *view = (REL.RDB$VIEW_BLR.gds_quad_high || REL.RDB$VIEW_BLR.gds_quad_low) ? TRUE : FALSE; @@ -521,10 +514,10 @@ if (!REQUEST(irq_grant9)) REQUEST(irq_grant9) = request; - terminate(REL.RDB$SECURITY_CLASS); + DYN_terminate(REL.RDB$SECURITY_CLASS, sizeof(REL.RDB$SECURITY_CLASS)); strcpy(s_class, REL.RDB$SECURITY_CLASS); strcpy(default_class, ""); - terminate(REL.RDB$OWNER_NAME); + DYN_terminate(REL.RDB$OWNER_NAME, sizeof(REL.RDB$OWNER_NAME)); strcpy(owner, REL.RDB$OWNER_NAME); *view = FALSE; END_FOR; @@ -581,7 +574,7 @@ if (!REQUEST(irq_grant2)) REQUEST(irq_grant2) = request; - terminate(PRV.RDB$USER); + DYN_terminate(PRV.RDB$USER, sizeof(PRV.RDB$USER)); if (strcmp(PRV.RDB$USER, user) || PRV.RDB$USER_TYPE != user_type) { if (user[0]) @@ -736,7 +729,7 @@ if (!REQUEST(irq_grant8)) REQUEST(irq_grant8) = request; - terminate(REL.RDB$DEFAULT_CLASS); + DYN_terminate(REL.RDB$DEFAULT_CLASS, sizeof(REL.RDB$DEFAULT_CLASS)); delete_security_class(tdbb, REL.RDB$DEFAULT_CLASS); MODIFY REL USING @@ -841,8 +834,8 @@ if (!REQUEST(irq_grant6)) REQUEST(irq_grant6) = request; - terminate(PRV.RDB$USER); - terminate(PRV.RDB$FIELD_NAME); + DYN_terminate(PRV.RDB$USER, sizeof(PRV.RDB$USER)); + DYN_terminate(PRV.RDB$FIELD_NAME, sizeof(PRV.RDB$FIELD_NAME)); /* create a control break on field_name,user */ @@ -918,32 +911,23 @@ /* initialize for new field */ strcpy(field_name, PRV.RDB$FIELD_NAME); - terminate(FLD.RDB$SECURITY_CLASS); + DYN_terminate(FLD.RDB$SECURITY_CLASS, sizeof(FLD.RDB$SECURITY_CLASS)); strcpy(s_class, FLD.RDB$SECURITY_CLASS); if (!s_class[0]) { - /* There is no security class name for this field, then make one. - Note that the field security class name is set here and in the - pre-store trigger for rdb$user_privileges. This field security - class name is removed in the pre erase trigger for - rdb$user_privileges. */ + /* We should never get here (I think) because this + value is set by dyn.e when the rdb$user_privileges + record is stored. There's also a before store trigger + on rdb$user_privileges, but it isn't so smart. -- AWH + */ + sprintf(s_class, "%s%" QUADFORMAT "d\0", "SQL$GRANT", + DPM_gen_id(tdbb, MET_lookup_generator(tdbb, "RDB$SECURITY_CLASS"), + 0, (SINT64) 1)); + FOR(REQUEST_HANDLE request2) FLD2 IN RDB$RELATION_FIELDS WITH FLD2.RDB$RELATION_NAME EQ FLD.RDB$RELATION_NAME AND FLD2.RDB$FIELD_NAME EQ FLD.RDB$FIELD_NAME MODIFY FLD2 -#ifndef EXACT_NUMERICS - sprintf(s_class, "%s%ld\0", "SQL$GRANT", - DPM_gen_id(tdbb, - MET_lookup_generator(tdbb, - "RDB$SECURITY_CLASS"), - 0, (SLONG) 1)); -#else - sprintf(s_class, "%s%" QUADFORMAT "d\0", "SQL$GRANT", - DPM_gen_id(tdbb, - MET_lookup_generator(tdbb, - "RDB$SECURITY_CLASS"), - 0, (SINT64) 1)); -#endif jrd_vtof(s_class, FLD2.RDB$SECURITY_CLASS, sizeof(FLD2.RDB$SECURITY_CLASS)); END_MODIFY; @@ -1148,35 +1132,6 @@ } return priv; -} - - -static USHORT terminate( TEXT * string) -{ -/************************************** - * - * t e r m i n a t e - * - ************************************** - * - * Functional description - * Zap trailing blank or null terminated string to null terminated string. - * Return length. - * - **************************************/ - TEXT *p, *q; -#define BLANK '\040' - -/* Scan forwards to end-of-string -- record the last non-BLANK we saw */ - q = string - 1; - for (p = string; *p; p++) { - if (*p != BLANK) - q = p; - } - - *(q + 1) = '\0'; - - return (q + 1) - string; } Index: inf.cpp =================================================================== RCS file: /cvsroot/firebird/firebird2/src/jrd/inf.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -U3 -r1.6 -r1.7 --- inf.cpp 28 Jun 2002 13:58:53 -0000 1.6 +++ inf.cpp 1 Jul 2002 15:46:06 -0000 1.7 @@ -22,6 +22,17 @@ * 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE" * conditionals, as the engine now fully supports * readonly databases. + * 2001.08.09 Claudio Valderrama - Added new isc_info_* tokens to INF_database_info(): + * oldest_transaction, oldest_active, oldest_snapshot and next_transaction. + * Make INF_put_item() to reserve 4 bytes: item + length as short + info_end; + * otherwise to signal output buffer truncation. + * + * 2001.11.28 Ann Harrison - the dbb has to be refreshed before reporting + * oldest_transaction, oldest_active, oldest_snapshot and next_transaction. + * + * 2001.11.29 Paul Reeves - Added refresh of dbb to ensure forced_writes + * reports correctly when called immediately after a create database + * operation. */ #include "firebird.h" @@ -191,7 +202,8 @@ TDBB tdbb; DBB dbb; TRA transaction; - STR file; + STR str; + FIL file; SCHAR item, *end_items, *end, buffer[256], *p, *q; SCHAR site[256]; SSHORT length, l; @@ -202,6 +214,7 @@ ATT err_att, att; USR user; SLONG err_val; + BOOLEAN header_refreshed = FALSE; tdbb = GET_THREAD_DATA; dbb = tdbb->tdbb_database; @@ -220,30 +233,30 @@ while (items < end_items && *items != gds_info_end) { p = buffer; switch ((item = *items++)) { - case gds_info_end: + case isc_info_end: break; - case gds_info_reads: + case isc_info_reads: length = INF_convert(dbb->dbb_reads, buffer); break; - case gds_info_writes: + case isc_info_writes: length = INF_convert(dbb->dbb_writes, buffer); break; - case gds_info_fetches: + case isc_info_fetches: length = INF_convert(dbb->dbb_fetches, buffer); break; - case gds_info_marks: + case isc_info_marks: length = INF_convert(dbb->dbb_marks, buffer); break; - case gds_info_page_size: + case isc_info_page_size: length = INF_convert(dbb->dbb_page_size, buffer); break; - case gds_info_num_buffers: + case isc_info_num_buffers: length = INF_convert(dbb->dbb_bcb->bcb_count, buffer); break; @@ -251,11 +264,11 @@ length = INF_convert(dbb->dbb_page_buffers, buffer); break; - case gds_info_logfile: + case isc_info_logfile: length = INF_convert((dbb->dbb_wal) ? TRUE : FALSE, buffer); break; - case gds_info_cur_logfile_name: + case isc_info_cur_logfile_name: wal_name[0] = 0; if (WAL_segment) strcpy(wal_name, WAL_segment->wals_logname); @@ -265,28 +278,28 @@ length = p - buffer; break; - case gds_info_cur_log_part_offset: + case isc_info_cur_log_part_offset: wal_p_offset = 0; if (WAL_segment) wal_p_offset = WAL_segment->wals_log_partition_offset; length = INF_convert(wal_p_offset, buffer); break; - case gds_info_num_wal_buffers: + case isc_info_num_wal_buffers: if (WAL_segment) length = INF_convert(WAL_segment->wals_maxbufs, buffer); else length = 0; break; - case gds_info_wal_buffer_size: + case isc_info_wal_buffer_size: if (WAL_segment) length = INF_convert(WAL_segment->wals_bufsize, buffer); else length = 0; break; - case gds_info_wal_ckpt_length: + case isc_info_wal_ckpt_length: if (WAL_segment) /* User specified checkpoint length multiplied by 1024 (OneK) is kept in WAL_segment */ @@ -297,7 +310,7 @@ length = 0; break; - case gds_info_wal_cur_ckpt_interval: + case isc_info_wal_cur_ckpt_interval: if (WAL_segment) length = INF_convert(WAL_segment->wals_cur_ckpt_intrvl, buffer); @@ -305,7 +318,7 @@ length = 0; break; - case gds_info_wal_prv_ckpt_fname: + case isc_info_wal_prv_ckpt_fname: wal_name[0] = 0; if (WAL_segment) strcpy(wal_name, WAL_segment->wals_ckpt_logname); @@ -315,24 +328,24 @@ length = p - buffer; break; - case gds_info_wal_prv_ckpt_poffset: + case isc_info_wal_prv_ckpt_poffset: wal_p_offset = 0; if (WAL_segment) wal_p_offset = WAL_segment->wals_ckpt_log_p_offset; length = INF_convert(wal_p_offset, buffer); break; - case gds_info_wal_recv_ckpt_fname: + case isc_info_wal_recv_ckpt_fname: /* Get the information from the header or wal page */ length = 0; break; - case gds_info_wal_recv_ckpt_poffset: + case isc_info_wal_recv_ckpt_poffset: /* Get the information from the header or wal page */ length = 0; break; - case gds_info_wal_grpc_wait_usecs: + case isc_info_wal_grpc_wait_usecs: if (WAL_segment) length = INF_convert(WAL_segment->wals_grpc_wait_usecs, buffer); @@ -340,14 +353,14 @@ length = 0; break; - case gds_info_wal_num_io: + case isc_info_wal_num_io: if (WAL_segment) length = INF_convert(WAL_segment->wals_IO_count, buffer); else length = 0; break; - case gds_info_wal_avg_io_size: + case isc_info_wal_avg_io_size: if (WAL_segment) length = INF_convert(WAL_segment->wals_total_IO_bytes / (WAL_segment->wals_IO_count ? @@ -357,14 +370,14 @@ length = 0; break; - case gds_info_wal_num_commits: + case isc_info_wal_num_commits: if (WAL_segment) length = INF_convert(WAL_segment->wals_commit_count, buffer); else length = 0; break; - case gds_info_wal_avg_grpc_size: + case isc_info_wal_avg_grpc_size: if (WAL_segment) length = INF_convert(WAL_segment->wals_commit_count / (WAL_segment->wals_grpc_count ? @@ -374,99 +387,99 @@ length = 0; break; - case gds_info_current_memory: + case isc_info_current_memory: length = INF_convert(dbb->dbb_current_memory, buffer); break; - case gds_info_max_memory: + case isc_info_max_memory: length = INF_convert(dbb->dbb_max_memory, buffer); break; - case gds_info_attachment_id: + case isc_info_attachment_id: length = INF_convert(PAG_attachment_id(), buffer); break; - case gds_info_ods_version: + case isc_info_ods_version: length = INF_convert(dbb->dbb_ods_version, buffer); break; - case gds_info_ods_minor_version: + case isc_info_ods_minor_version: length = INF_convert(dbb->dbb_minor_version, buffer); break; - case gds_info_allocation: + case isc_info_allocation: CCH_flush(tdbb, (USHORT) FLUSH_ALL, 0L); length = INF_convert(PIO_max_alloc(dbb), buffer); break; - case gds_info_sweep_interval: + case isc_info_sweep_interval: length = INF_convert(dbb->dbb_sweep_interval, buffer); break; - case gds_info_read_seq_count: + case isc_info_read_seq_count: length = get_counts(DBB_read_seq_count, reinterpret_cast < UCHAR * >(buffer), sizeof(buffer)); break; - case gds_info_read_idx_count: + case isc_info_read_idx_count: length = get_counts(DBB_read_idx_count, reinterpret_cast < UCHAR * >(buffer), sizeof(buffer)); break; - case gds_info_update_count: + case isc_info_update_count: length = get_counts(DBB_update_count, reinterpret_cast < UCHAR * >(buffer), sizeof(buffer)); break; - case gds_info_insert_count: + case isc_info_insert_count: length = get_counts(DBB_insert_count, reinterpret_cast < UCHAR * >(buffer), sizeof(buffer)); break; - case gds_info_delete_count: + case isc_info_delete_count: length = get_counts(DBB_delete_count, reinterpret_cast < UCHAR * >(buffer), sizeof(buffer)); break; - case gds_info_backout_count: + case isc_info_backout_count: length = get_counts(DBB_backout_count, reinterpret_cast < UCHAR * >(buffer), sizeof(buffer)); break; - case gds_info_purge_count: + case isc_info_purge_count: length = get_counts(DBB_purge_count, reinterpret_cast < UCHAR * >(buffer), sizeof(buffer)); break; - case gds_info_expunge_count: + case isc_info_expunge_count: length = get_counts(DBB_expunge_count, reinterpret_cast < UCHAR * >(buffer), sizeof(buffer)); break; - case gds_info_implementation: + case isc_info_implementation: STUFF(p, 1); /* Count */ STUFF(p, IMPLEMENTATION); STUFF(p, 1); /* Class */ length = p - buffer; break; - case gds_info_base_level: + case isc_info_base_level: /* info_base_level is used by the client to represent * what the server is capable of. It is equivalent to the * ods version of a database. For example, @@ -484,7 +497,7 @@ length = p - buffer; break; - case gds_info_version: + case isc_info_isc_version: STUFF(p, 1); STUFF(p, sizeof(GDS_VERSION) - 1); for (q = GDS_VERSION; *q;) @@ -492,11 +505,19 @@ length = p - buffer; break; - case gds_info_db_id: - file = tdbb->tdbb_attachment->att_filename; + case isc_info_firebird_version: + STUFF(p, 1); + STUFF(p, sizeof(FB_VERSION) - 1); + for (q = FB_VERSION; *q;) + STUFF(p, *q++); + length = p - buffer; + break; + + case isc_info_db_id: + str = tdbb->tdbb_attachment->att_filename; STUFF(p, 2); - *p++ = l = file->str_length; - for (q = reinterpret_cast<SCHAR*>(file->str_data); *q;) + *p++ = l = str->str_length; + for (q = reinterpret_cast<SCHAR*>(str->str_data); *q;) *p++ = *q++; ISC_get_host(site, sizeof(site)); *p++ = l = strlen(site); @@ -505,17 +526,23 @@ length = p - buffer; break; - case gds_info_no_reserve: + case isc_info_no_reserve: *p++ = (dbb->dbb_flags & DBB_no_reserve) ? 1 : 0; length = p - buffer; break; - case gds_info_forced_writes: + case isc_info_forced_writes: + if (!header_refreshed) + { + file = dbb->dbb_file; + PAG_header(file->fil_string, file->fil_length); + header_refreshed = TRUE; + } *p++ = (dbb->dbb_flags & DBB_force_write) ? 1 : 0; length = p - buffer; break; - case gds_info_limbo: + case isc_info_limbo: if (!transaction) transaction = TRA_start(tdbb, 0, NULL); for (id = transaction->tra_oldest; @@ -706,6 +733,54 @@ length = INF_convert(PIO_act_alloc(dbb), buffer); break; + case isc_info_oldest_transaction: + if (!header_refreshed) + { + file = dbb->dbb_file; + PAG_header(file->fil_string, file->fil_length); + header_refreshed = TRUE; + } + length = INF_convert(dbb->dbb_oldest_transaction, buffer); + break; + + case isc_info_oldest_active: + if (!header_refreshed) + { + file = dbb->dbb_file; + PAG_header(file->fil_string, file->fil_length); + header_refreshed = TRUE; + } + length = INF_convert(dbb->dbb_oldest_active, buffer); + break; + + case isc_info_oldest_snapshot: + if (!header_refreshed) + { + file = dbb->dbb_file; + PAG_header(file->fil_string, file->fil_length); + header_refreshed = TRUE; + } + length = INF_convert(dbb->dbb_oldest_snapshot, buffer); + break; + + case isc_info_next_transaction: + if (!header_refreshed) + { + file = dbb->dbb_file; + PAG_header(file->fil_string, file->fil_length); + header_refreshed = TRUE; + } + length = INF_convert(dbb->dbb_next_transaction, buffer); + break; + + case isc_info_db_provider: + length = INF_convert(isc_info_db_code_firebird, buffer); + break; + + case isc_info_db_class: + length = INF_convert(FB_ARCHITECTURE, buffer); + break; + case frb_info_att_charset: length = INF_convert(tdbb->tdbb_attachment->att_charset, buffer); break; @@ -888,7 +963,7 @@ * **************************************/ - if (ptr + length + 3 >= end) { + if (ptr + length + 4 >= end) { *ptr = gds_info_truncated; return NULL; } @@ -1004,8 +1079,8 @@ case gds_info_message_number: case gds_info_message_size: if (!(request->req_flags & req_active) || - request->req_operation != req::req_receive && - request->req_operation != req::req_send) { + (request->req_operation != req::req_receive && + request->req_operation != req::req_send)) { buffer_ptr[0] = item; item = gds_info_error; length = 1 + INF_convert(gds_infinap, buffer_ptr + 1); Index: inf.h =================================================================== RCS file: /cvsroot/firebird/firebird2/src/jrd/inf.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -U3 -r1.1.1.1 -r1.2 --- inf.h 23 May 2001 13:26:18 -0000 1.1.1.1 +++ inf.h 1 Jul 2002 15:46:06 -0000 1.2 @@ -19,6 +19,8 @@ * * All Rights Reserved. * Contributor(s): ______________________________________. + * + * 2001.07.28: John Bellardo: Added gds__info_rsb_skip to support LIMIT. */ #ifndef _JRD_INF_H_ @@ -132,6 +134,7 @@ #define gds__info_rsb_sim_cross 19 #define gds__info_rsb_once 20 #define gds__info_rsb_procedure 21 +#define gds__info_rsb_skip 22 /* bitmap expressions */ Index: ini.h =================================================================== RCS file: /cvsroot/firebird/firebird2/src/jrd/ini.h,v retrieving revision 1.2 retrieving revision 1.3 diff -U3 -r1.2 -r1.3 --- ini.h 24 Dec 2001 02:50:51 -0000 1.2 +++ ini.h 1 Jul 2002 15:46:06 -0000 1.3 @@ -28,6 +28,7 @@ #include "../jrd/intl.h" #include "../intl/country_codes.h" #include "../intl/charsets.h" +#include "../jrd/obj.h" /* Define name ids */ |