8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 21:23:04 +01:00

New C++ memory pool

This commit is contained in:
tamlin 2001-12-24 02:51:06 +00:00
parent 3ec803105f
commit 80f7fb6dd4
365 changed files with 23055 additions and 16557 deletions

View File

@ -24,7 +24,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: alice.cpp,v 1.4 2001-07-29 23:43:20 skywalker Exp $ // $Id: alice.cpp,v 1.5 2001-12-24 02:50:47 tamlin Exp $
// //
// 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE" // 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE"
// conditionals, as the engine now fully supports // conditionals, as the engine now fully supports
@ -72,10 +72,6 @@
#endif #endif
#ifndef MAXPATHLEN
#define MAXPATHLEN 1024
#endif
static USHORT val_err_table[] = { static USHORT val_err_table[] = {
0, 0,
55, /* msg 55: \n\tNumber of record level errors\t: %ld */ 55, /* msg 55: \n\tNumber of record level errors\t: %ld */
@ -232,38 +228,8 @@ int DLL_EXPORT ALICE_gfix(
tdgbl->output_data = output_data; tdgbl->output_data = output_data;
tdgbl->ALICE_permanent_pool = NULL; tdgbl->ALICE_permanent_pool = NULL;
tdgbl->ALICE_default_pool = NULL; tdgbl->ALICE_default_pool = NULL;
tdgbl->pools = NULL;
if (SETJMP(env)) {
int exit_code;
/* All calls to EXIT(), normal and error exits, wind up here */
SVC_STARTED(tdgbl->service_blk);
tdgbl->alice_env = NULL;
exit_code = tdgbl->exit_code;
/* Close the status output file */
if (tdgbl->sw_redirect == TRUE && tdgbl->output_file != NULL) {
ib_fclose(tdgbl->output_file);
tdgbl->output_file = NULL;
}
/* Free all unfreed memory used by Gfix itself */
ALLA_fini();
RESTORE_THREAD_DATA;
if (tdgbl != NULL) {
gds__free((SLONG *) tdgbl);
}
#if defined(DEBUG_GDS_ALLOC) && !defined(SUPERSERVER)
gds_alloc_report(0, __FILE__, __LINE__);
#endif
/* All returns occur from this point - even normal returns */
return exit_code;
}
try {
#ifdef VMS #ifdef VMS
argc = VMS_parse(&argv, argc); argc = VMS_parse(&argv, argc);
@ -333,10 +299,13 @@ int DLL_EXPORT ALICE_gfix(
database = NULL; database = NULL;
argv++; argv++;
while (--argc > 0) { while (--argc > 0)
if ((*argv)[0] != '-') { {
if (database) if ((*argv)[0] != '-')
{
if (database) {
ALICE_error(1, database, 0, 0, 0, 0); /* msg 1: "data base file name (%s) already given", */ ALICE_error(1, database, 0, 0, 0, 0); /* msg 1: "data base file name (%s) already given", */
}
database = *argv++; database = *argv++;
#if defined (WIN95) && !defined (GUI_TOOLS) #if defined (WIN95) && !defined (GUI_TOOLS)
@ -577,6 +546,38 @@ int DLL_EXPORT ALICE_gfix(
EXIT(FINI_OK); EXIT(FINI_OK);
} // try
catch (...)
{
int exit_code;
/* All calls to EXIT(), normal and error exits, wind up here */
SVC_STARTED(tdgbl->service_blk);
tdgbl->alice_env = NULL;
exit_code = tdgbl->exit_code;
/* Close the status output file */
if (tdgbl->sw_redirect == TRUE && tdgbl->output_file != NULL) {
ib_fclose(tdgbl->output_file);
tdgbl->output_file = NULL;
}
/* Free all unfreed memory used by Gfix itself */
ALLA_fini();
RESTORE_THREAD_DATA;
if (tdgbl != NULL) {
gds__free((SLONG *) tdgbl);
}
#if defined(DEBUG_GDS_ALLOC) && !defined(SUPERSERVER)
gds_alloc_report(0, __FILE__, __LINE__);
#endif
/* All returns occur from this point - even normal returns */
return exit_code;
} // catch
return 0; // compiler silencer return 0; // compiler silencer
} }

View File

@ -21,8 +21,8 @@
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
*/ */
#ifndef _ALICE_ALICE_H_ #ifndef ALICE_ALICE_H
#define _ALICE_ALICE_H_ #define ALICE_ALICE_H
#include "../jrd/ib_stdio.h" #include "../jrd/ib_stdio.h"
@ -31,22 +31,22 @@
#include "../jrd/thd.h" #include "../jrd/thd.h"
#include "../alice/all.h" #include "../alice/all.h"
#include "../alice/alice_proto.h" #include "../alice/alice_proto.h"
#include "../include/fb_blk.h"
#include "../common/memory/allocators.h"
#include <vector>
#ifdef __cplusplus
//extern "C" {
#endif
#ifndef MAXPATHLEN #ifndef MAXPATHLEN
#define MAXPATHLEN 1024 #define MAXPATHLEN 1024
#endif #endif
#define BLKDEF(type, root, tail) type, #define BLKDEF(type, root, tail) type,
enum blk_t { enum alice_blk_t
type_MIN = 0, {
alice_type_MIN = 0,
#include "../alice/blk.h" #include "../alice/blk.h"
type_MAX alice_type_MAX
}; };
#undef BLKDEF #undef BLKDEF
#define VAL_INVALID_DB_VERSION 0 #define VAL_INVALID_DB_VERSION 0
@ -82,18 +82,18 @@ typedef struct user_action
/* String block: used to store a string of constant length. */ /* String block: used to store a string of constant length. */
typedef struct str { class str : public pool_alloc_rpt<UCHAR, alice_type_str>
struct blk str_header; {
public:
USHORT str_length; USHORT str_length;
UCHAR str_data[2]; UCHAR str_data[2];
} *STR; };
typedef str *STR;
/* Transaction block: used to store info about a multidatabase transaction. */ /* Transaction block: used to store info about a multidatabase transaction. */
typedef struct tdr typedef struct tdr
{ {
struct blk tdr_header;
struct tdr *tdr_next; /* next subtransaction */ struct tdr *tdr_next; /* next subtransaction */
SLONG tdr_id; /* database-specific transaction id */ SLONG tdr_id; /* database-specific transaction id */
struct str *tdr_fullpath; /* full (possibly) remote pathname */ struct str *tdr_fullpath; /* full (possibly) remote pathname */
@ -131,32 +131,38 @@ typedef struct tdr
/* a couple of obscure blocks used only in data allocator routines */ /* a couple of obscure blocks used only in data allocator routines */
typedef struct vec class vec : public pool_alloc_rpt<class blk*, alice_type_vec>
{ {
struct blk vec_header; public:
ULONG vec_count; ULONG vec_count;
struct blk *vec_object[1]; struct blk *vec_object[1];
} *VEC; };
typedef vec *VEC;
typedef struct vcl class vcl : public pool_alloc_rpt<SLONG, alice_type_vcl>
{ {
struct blk vcl_header;
ULONG vcl_count; ULONG vcl_count;
SLONG vcl_long[1]; SLONG vcl_long[1];
} *VCL; };
typedef vcl *VCL;
/* Global switches and data */ /* Global switches and data */
#include "../jrd/svc.h" #include "../jrd/svc.h"
typedef struct tgbl class tgbl
{ {
public:
tgbl(AliceMemoryPool *p) : pools(0, (AliceMemoryPool*)0,
pool_vec_t::allocator_type(*p)) {}
struct thdd tgbl_thd_data; struct thdd tgbl_thd_data;
struct user_action ALICE_data; struct user_action ALICE_data;
PLB ALICE_permanent_pool; AliceMemoryPool *ALICE_permanent_pool;
PLB ALICE_default_pool; AliceMemoryPool *ALICE_default_pool;
STATUS status_vector[ISC_STATUS_LENGTH]; STATUS status_vector[ISC_STATUS_LENGTH];
VEC pools; typedef std::vector<AliceMemoryPool*, Firebird::allocator<AliceMemoryPool*> > pool_vec_t;
pool_vec_t pools;
UCHAR* alice_env; UCHAR* alice_env;
int exit_code; int exit_code;
OUTPUTPROC output_proc; OUTPUTPROC output_proc;
@ -169,10 +175,8 @@ typedef struct tgbl
USHORT sw_redirect; USHORT sw_redirect;
USHORT sw_service; USHORT sw_service;
USHORT sw_service_thd; USHORT sw_service_thd;
};
typedef tgbl *TGBL;
} *TGBL;
#ifdef GET_THREAD_DATA #ifdef GET_THREAD_DATA
#undef GET_THREAD_DATA #undef GET_THREAD_DATA
@ -212,17 +216,11 @@ extern struct tgbl *gdgbl;
#if defined(__cplusplus) #if defined(__cplusplus)
#define EXIT(code) { tdgbl->exit_code = (code); \ #define EXIT(code) { tdgbl->exit_code = (code); \
if (tdgbl->alice_env != NULL) \ if (tdgbl->alice_env != NULL) \
LONGJMP((jmp_buf)(tdgbl->alice_env), 1); } Firebird::status_longjmp_error::raise(1); }
#else #else
#define EXIT(code) { tdgbl->exit_code = (code); \ #error Dont do this, it hurts!
if (tdgbl->alice_env != NULL) \ #endif // __cplusplus
LONGJMP(tdgbl->alice_env, 1); }
#endif /* __cplusplus */
#define NOOUTPUT 2 #define NOOUTPUT 2
#ifdef __cplusplus #endif // ALICE_ALICE_H
//} /* extern "C" */
#endif
#endif /* _ALICE_ALICE_H_ */

View File

@ -27,7 +27,7 @@
* *
*____________________________________________________________ *____________________________________________________________
* *
* $Id: alice_meta.epp,v 1.2 2001-07-29 23:43:20 skywalker Exp $ * $Id: alice_meta.epp,v 1.3 2001-12-24 02:50:47 tamlin Exp $
*/ */
#include "firebird.h" #include "firebird.h"
@ -38,11 +38,11 @@
#include "../jrd/license.h" #include "../jrd/license.h"
#include "../alice/alice.h" #include "../alice/alice.h"
#include "../alice/all.h" #include "../alice/all.h"
#include "../alice/alloc.h"
#include "../alice/all_proto.h"
#include "../alice/alice_meta.h" #include "../alice/alice_meta.h"
#include "../jrd/gds_proto.h" #include "../jrd/gds_proto.h"
#include "../jrd/thd_proto.h" #include "../jrd/thd_proto.h"
#include "../include/fb_exception.h"
#include "../common/memory/allocators.h"
#include <string.h> #include <string.h>
@ -91,11 +91,13 @@ static struct rfr_tab_t rfr_table[] = {
#ifdef GUI_TOOLS #ifdef GUI_TOOLS
#define RETURN_ERROR(user_status) \ #define RETURN_ERROR(user_status) \
{ memcpy (user_status, gds_status, sizeof (gds_status)); \ { memcpy (user_status, gds_status, sizeof (gds_status)); \
LONGJMP ((JMP_BUF)tdgbl->alice_env, 1); } Firebird::status_longjmp_error::raise(0); }
// LONGJMP ((JMP_BUF)tdgbl->alice_env, 1); }
#else #else
#define RETURN_ERROR(user_status) \ #define RETURN_ERROR(user_status) \
{ ALICE_print_status (gds_status); \ { ALICE_print_status (gds_status); \
LONGJMP ((JMP_BUF)tdgbl->alice_env, 1); } Firebird::status_longjmp_error::raise(0); }
// LONGJMP ((JMP_BUF)tdgbl->alice_env, 1); }
#endif #endif
@ -245,7 +247,7 @@ static STR alloc_string(TEXT ** ptr)
p = *ptr; p = *ptr;
length = (USHORT) * p++; length = (USHORT) * p++;
string = (STR) ALLOCDV(type_str, length + 1); string = new(*tdgbl->ALICE_default_pool, length + 1) str;
q = (TEXT *) string->str_data; q = (TEXT *) string->str_data;
while (length--) while (length--)
@ -342,9 +344,9 @@ static TDR get_description(SLONG blob_id[2])
id = gds__vax_integer((UCHAR*) p, id_length); id = gds__vax_integer((UCHAR*) p, id_length);
p += id_length; p += id_length;
if (!trans) if (!trans)
trans = ptr = (TDR) ALLOCD(type_tdr); trans = ptr = new(*tdgbl->ALICE_default_pool) tdr;
else { else {
ptr->tdr_next = (TDR) ALLOCD(type_tdr); ptr->tdr_next = new(*tdgbl->ALICE_default_pool) tdr;
ptr = ptr->tdr_next; ptr = ptr->tdr_next;
} }
ptr->tdr_host_site = host_site; ptr->tdr_host_site = host_site;
@ -405,7 +407,7 @@ static void parse_fullpath(TDR trans)
if (*q) { if (*q) {
trans->tdr_filename = q + 1; trans->tdr_filename = q + 1;
trans->tdr_remote_site = (STR) ALLOCDV(type_str, q - p + 1); trans->tdr_remote_site = new(*tdgbl->ALICE_default_pool, q - p + 1) str;
strncpy((char*) trans->tdr_remote_site->str_data, (char*) p, q - p); strncpy((char*) trans->tdr_remote_site->str_data, (char*) p, q - p);
trans->tdr_remote_site->str_data[q - p] = '\0'; trans->tdr_remote_site->str_data[q - p] = '\0';
} }
@ -431,7 +433,7 @@ static void parse_fullpath(TDR trans)
p++; p++;
if (length) { if (length) {
trans->tdr_remote_site = (STR) ALLOCDV(type_str, length + 1); trans->tdr_remote_site = new(*tdgbl->ALICE_default_pool, length + 1) str;
q = (TEXT *) trans->tdr_remote_site->str_data; q = (TEXT *) trans->tdr_remote_site->str_data;
while (length--) while (length--)
*q++ = *p++; *q++ = *p++;

View File

@ -24,173 +24,22 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: all.cpp,v 1.2 2001-07-29 23:43:20 skywalker Exp $ // $Id: all.cpp,v 1.3 2001-12-24 02:50:47 tamlin Exp $
// //
#include "firebird.h"
#include "../jrd/ib_stdio.h"
#include "../jrd/common.h"
#include "../jrd/ibsetjmp.h"
#include "../alice/alice.h"
#include "../alice/all.h" #include "../alice/all.h"
#include "../alice/alloc.h" //#include "firebird.h"
#include "../alice/lls.h" //#include "../jrd/ib_stdio.h"
#include "../alice/all_proto.h" //#include "../jrd/common.h"
#include "../jrd/gds_proto.h" //#include "../jrd/ibsetjmp.h"
#include "../alice/alice.h"
//#include "../alice/all.h"
//#include "../alice/alloc.h"
//#include "../alice/lls.h"
//#include "../alice/all_proto.h"
//#include "../jrd/gds_proto.h"
#include "../jrd/thd_proto.h" #include "../jrd/thd_proto.h"
#include "../common/memory/allocators.h"
#define BLKDEF(type, root, tail) sizeof (struct root), tail,
static struct {
SSHORT typ_root_length;
SSHORT typ_tail_length;
} block_sizes[] = {
0, 0,
#include "../alice/blk.h"
0};
#undef BLKDEF
static void extend_pool(PLB, SLONG);
static PLB find_pool(BLK);
static void release(FRB, PLB);
//____________________________________________________________
//
// Allocate a block from a given pool and initialize the block.
// This is the primary block allocation routine.
//
BLK ALLA_alloc(PLB pool, UCHAR type, int count)
{
register BLK block;
FRB free, *best, *ptr;
SLONG best_tail, tail;
USHORT units;
register SLONG size;
register USHORT *p;
TGBL tdgbl;
tdgbl = GET_THREAD_DATA;
if (type <= (UCHAR) type_MIN || type >= (SCHAR) type_MAX)
ALICE_error(62, 0, 0, 0, 0, 0); /* msg 62: bad block type */
// Compute block length
size = block_sizes[type].typ_root_length;
if ((tail = block_sizes[type].typ_tail_length) && count >= FUDGE)
size += (count - FUDGE) * tail;
size = (size + MIN_ALLOC - 1) & ~((ULONG) MIN_ALLOC - 1);
// TMN: Here we should probably have the following assert
// assert((size >> SHIFT) <= MAX_USHORT);
units = (USHORT) (size >> SHIFT);
if (size >= MAX_BLOCK)
ALICE_error(63, 0, 0, 0, 0, 0); /* msg 63:internal block exceeds maximum size */
// Find best fit. Best fit is defined to be the free block of shortest
// tail. If there isn't a fit, extend the pool and try, try again.
while (TRUE) {
best = NULL;
best_tail = MAX_BLOCK;
for (ptr = &pool->plb_free; (free = *ptr); ptr = &free->frb_next) {
if (free == free->frb_next)
ALICE_error(64, 0, 0, 0, 0, 0); /* msg 64: corrupt pool */
if ((tail = (int) free->frb_header.blk_length - (int) units) >= 0
&& tail < best_tail) {
best = ptr;
best_tail = tail;
if (tail == 0)
break;
}
}
if (best)
break;
extend_pool(pool, size);
}
// We've got our free block. If there's enough left of the free block
// after taking out our block, chop out out block. If not, allocate
// the entire free block as our block (a little extra won't hurt).
best_tail <<= SHIFT;
free = *best;
if (best_tail > sizeof(struct frb)) {
block =
(BLK) ((SCHAR *) free + (free->frb_header.blk_length << SHIFT));
block = (BLK) ((SCHAR *) block - size);
free->frb_header.blk_length -= units;
}
else {
*best = free->frb_next;
units = free->frb_header.blk_length;
size = units << SHIFT;
block = (BLK) free;
}
// zero out the allocated memory
size >>= 1;
p = (USHORT *) block;
do
*p++ = 0;
while (--size);
block->blk_type = type;
// TMN: Here we should probably have the following assert
// assert(pool->plb_pool_id <= MAX_UCHAR);
block->blk_pool_id = (UCHAR) pool->plb_pool_id;
block->blk_length = units;
return block;
}
//____________________________________________________________
//
// Extend a repeating block, copying the constant part.
//
BLK ALLA_extend(BLK * pointer, int size)
{
BLK block;
PLB pool;
SLONG old_length, new_length;
register SCHAR *from, *to;
register SSHORT length;
block = *pointer;
pool = find_pool(block);
BLK new_ = ALLA_alloc(pool, block->blk_type, size);
old_length = block->blk_length << SHIFT;
new_length = new_->blk_length << SHIFT;
from = (SCHAR *) block + sizeof(struct blk);
to = (SCHAR *) new_ + sizeof(struct blk);
length = MIN(old_length, new_length) - sizeof(struct blk);
if (length)
do
*to++ = *from++;
while (--length);
release(reinterpret_cast < frb * >(block), pool);
if (new_->blk_type == (UCHAR) type_vec)
((VEC) new_)->vec_count = size;
else if (new_->blk_type == (UCHAR) type_vcl)
((VCL) new_)->vcl_count = size;
*pointer = new_;
return new_;
}
//____________________________________________________________ //____________________________________________________________
@ -200,36 +49,17 @@ BLK ALLA_extend(BLK * pointer, int size)
void ALLA_fini(void) void ALLA_fini(void)
{ {
register PLB pool, *vector, *until; TGBL tdgbl = GET_THREAD_DATA;
register HNK hunks, hunk;
TGBL tdgbl;
tdgbl = GET_THREAD_DATA; for(tgbl::pool_vec_t::iterator curr = tdgbl->pools.begin();
curr != tdgbl->pools.end(); ++curr)
if (tdgbl->pools) { {
for (vector = delete *curr;
(PLB *) tdgbl->pools->vec_object + tdgbl->pools->vec_count, *curr = 0;
until = (PLB *) tdgbl->pools->vec_object; --vector >= until;)
if (pool = *vector)
for (hunks = pool->plb_hunks; hunk = hunks;) {
hunks = hunk->hnk_next;
ALLA_free(hunk->hnk_address);
}
} }
tdgbl->pools.clear();
tdgbl->pools = NULL; tdgbl->ALICE_default_pool = tdgbl->ALICE_permanent_pool = NULL;
}
//____________________________________________________________
//
// Give space back to system.
//
void ALLA_free(SCHAR * memory)
{
gds__free(memory);
} }
@ -240,310 +70,130 @@ void ALLA_free(SCHAR * memory)
void ALLA_init(void) void ALLA_init(void)
{ {
SLONG temp_vector[20];
VEC vector;
PLB pool;
TGBL tdgbl; TGBL tdgbl;
tdgbl = GET_THREAD_DATA; tdgbl = GET_THREAD_DATA;
tdgbl->pools = vector = (VEC) temp_vector; #if 0
vector->vec_count = 1; tdgbl->ALICE_default_pool = tdgbl->ALICE_permanent_pool =
vector->vec_object[0] = NULL; AliceMemoryPool::create_new_pool();
#else
tdgbl->ALICE_default_pool = tdgbl->ALICE_permanent_pool = pool = tdgbl->ALICE_default_pool = tdgbl->ALICE_permanent_pool =
ALLA_pool(); new(*FB_MemoryPool) AliceMemoryPool;
tdgbl->pools = vector = (VEC) ALLA_alloc(pool, type_vec, 10); #endif
vector->vec_count = 10;
vector->vec_object[0] = (BLK) pool;
} }
//____________________________________________________________
//
// Get memory from system.
//
SCHAR *ALLA_malloc(SLONG size) void AliceMemoryPool::ALLA_push(class blk *object, class lls** stack)
{ {
register SCHAR *memory; /**************************************
TGBL tdgbl; *
* A L L _ p u s h
tdgbl = GET_THREAD_DATA; *
**************************************
if (memory = (SCHAR *) gds__alloc(size)) *
return memory; * Functional description
* Push an object on an LLS stack.
ALICE_error(65, 0, 0, 0, 0, 0); /* msg 65: virtual memory exhausted */ *
return (SCHAR *) 0; /* Keep compilers happy. ALICE_error() never returns. */ **************************************/
} class lls* node;
AliceMemoryPool* pool;
//____________________________________________________________
//
// Allocate a new pool. This is done by creating a tempory
// pool block on the stack, then allocating a real pool block.
// In USHORT, by mirrors.
//
PLB ALLA_pool(void)
{
struct plb temp_pool;
register VEC vector;
register PLB pool;
register int pool_id;
TGBL tdgbl;
tdgbl = GET_THREAD_DATA;
// Start by assigning a pool id
vector = tdgbl->pools;
for (pool_id = 0; pool_id < (int) vector->vec_count; pool_id++)
if (!(vector->vec_object[pool_id]))
break;
if (pool_id >= (int) vector->vec_count)
vector =
(VEC) ALLA_extend(reinterpret_cast < blk ** >(&(tdgbl->pools)),
pool_id + 10);
vector->vec_object[pool_id] = (BLK) & temp_pool;
temp_pool.plb_free = NULL;
temp_pool.plb_hunks = NULL;
temp_pool.plb_pool_id = pool_id;
if (pool_id == 0)
tdgbl->ALICE_permanent_pool = &temp_pool;
pool = (PLB) ALLA_alloc(&temp_pool, type_plb, 0);
pool->plb_pool_id = pool_id;
pool->plb_free = temp_pool.plb_free;
pool->plb_hunks = temp_pool.plb_hunks;
vector->vec_object[pool_id] = (BLK) pool;
if (pool_id == 0)
tdgbl->ALICE_permanent_pool = pool;
return pool;
}
//____________________________________________________________
//
// Push an object on an LLS stack.
//
void ALLA_push(BLK object, register LLS * stack)
{
register LLS node;
PLB pool;
TGBL tdgbl;
tdgbl = GET_THREAD_DATA;
TGBL tdgbl = GET_THREAD_DATA;
pool = tdgbl->ALICE_default_pool; pool = tdgbl->ALICE_default_pool;
if (node = pool->plb_lls) node = pool->lls_cache.newBlock();
pool->plb_lls = node->lls_next;
else
node = (LLS) ALLA_alloc(pool, type_lls, 0);
node->lls_object = object; node->lls_object = object;
node->lls_next = *stack; node->lls_next = *stack;
*stack = node; *stack = node;
} }
//____________________________________________________________ BLK AliceMemoryPool::ALLA_pop(register LLS *stack)
//
// Pop an object off a linked list stack. Save the node for
// further use.
//
BLK ALLA_pop(register LLS * stack)
{ {
/**************************************
*
* A L L _ p o p
*
**************************************
*
* Functional description
* Pop an object off a linked list stack. Save the node for
* further use.
*
**************************************/
register LLS node; register LLS node;
register PLB pool; AliceMemoryPool* pool;
TGBL tdgbl; BLK object;
tdgbl = GET_THREAD_DATA;
node = *stack; node = *stack;
pool = (PLB) tdgbl->pools->vec_object[node->lls_header.blk_pool_id];
*stack = node->lls_next; *stack = node->lls_next;
node->lls_next = pool->plb_lls; object = node->lls_object;
pool->plb_lls = node;
return node->lls_object; pool = (AliceMemoryPool*)MemoryPool::blk_pool(node);
pool->lls_cache.returnBlock(node);
return object;
} }
#if 0
//____________________________________________________________ AliceMemoryPool* AliceMemoryPool::create_new_pool(MemoryPool* parent)
//
// Release a block to its pool. If it is contiguous to
// another free block, combine them. Otherwise link it
// into the free block linked list (kept in ascending order
// of addresses).
//
void ALLA_release(register FRB block)
{ {
/**************************************
*
* A L L _ p o o l
*
**************************************
*
* Functional description
* Allocate a new pool.
*
**************************************/
release(block, find_pool(block ? &block->frb_header : (BLK) 0)); TGBL tdgbl = GET_THREAD_DATA;
}
// TMN: John, is this correct?
AliceMemoryPool* pool = new(0, parent) AliceMemoryPool(parent);
tgbl::pool_vec_t::iterator curr;
//____________________________________________________________ for(curr = tdgbl->pools.begin(); curr != tdgbl->pools.end(); ++curr)
// {
// Release a storage pool. This involves nothing more than returning if (!*curr)
// hunks to the free hunk list. {
// *curr = pool;
void ALLA_rlpool(PLB pool)
{
register HNK hunk, hunks;
TGBL tdgbl;
tdgbl = GET_THREAD_DATA;
tdgbl->pools->vec_object[pool->plb_pool_id] = NULL;
for (hunks = pool->plb_hunks; hunk = hunks;) {
hunks = hunk->hnk_next;
ALLA_free(hunk->hnk_address);
}
}
//____________________________________________________________
//
// Allocate, extend, or no-op a vector making sure it is "long enough".
//
VEC ALLA_vector(PLB pool, VEC * ptr, USHORT count)
{
VEC vector;
++count;
if (!(vector = *ptr)) {
vector = *ptr = (VEC) ALLA_alloc(pool, type_vec, count);
vector->vec_count = count;
return vector;
}
if (vector->vec_count >= count)
return vector;
return (VEC) ALLA_extend(reinterpret_cast < blk ** >(ptr), count);
}
//____________________________________________________________
//
// Extend a pool by at least enough to accomodate a block
// of given size.
//
static void extend_pool(PLB pool, SLONG size)
{
register HNK hunk;
register BLK block;
size =
(size + sizeof(struct hnk) + MIN_ALLOCATION -
1) & ~((ULONG) MIN_ALLOCATION - 1);
block = (BLK) ALLA_malloc((SLONG) size);
// TMN: Here we should probably have the following assert
// assert((size >> SHIFT) <= MAX_USHORT);
block->blk_length = (USHORT) size >> SHIFT;
block->blk_type = (UCHAR) type_frb;
// TMN: Here we should probably have the following assert
// assert(pool->plb_pool_id <= MAX_UCHAR);
block->blk_pool_id = (UCHAR) pool->plb_pool_id;
release(reinterpret_cast < frb * >(block), pool);
hunk = (HNK) ALLA_alloc(pool, type_hnk, 0);
hunk->hnk_address = (SCHAR *) block;
hunk->hnk_length = size;
hunk->hnk_next = pool->plb_hunks;
pool->plb_hunks = hunk;
}
//____________________________________________________________
//
// Find pool associate with block.
//
static PLB find_pool(BLK block)
{
PLB pool;
HNK hunk;
USHORT pool_id;
TGBL tdgbl;
tdgbl = GET_THREAD_DATA;
for (pool_id = block->blk_pool_id;
pool_id < tdgbl->pools->vec_count
&& (pool = (PLB) tdgbl->pools->vec_object[pool_id]); pool_id += 256)
for (hunk = pool->plb_hunks; hunk; hunk = hunk->hnk_next)
if ((SCHAR *) block >= hunk->hnk_address
&& (SCHAR *) block < hunk->hnk_address + hunk->hnk_length)
return pool; return pool;
}
}
ALICE_error(66, 0, 0, 0, 0, 0); /* msg 66: bad pool id */ tdgbl->pools.resize(tdgbl->pools.size() + 10);
return (PLB) 0; /* Keep compilers happy. ALICE_error() never returns. */ for(curr = tdgbl->pools.begin(); curr != tdgbl->pools.end(); ++curr)
{
if (!*curr)
{
*curr = pool;
return pool;
}
}
//assert(0);
//BUGCHECK ("ALLA_fini - finishing before starting");
return 0;//pool; // Never reached, but makes the compiler happy.
} }
#endif
AliceMemoryPool::~AliceMemoryPool()
//____________________________________________________________
//
// Release a block to its pool. If it is contiguous to
// another free block, combine them. Otherwise link it
// into the free block linked list (kept in ascending order
// of addresses).
//
static void release(FRB block, PLB pool)
{ {
register FRB prior, free; TGBL tdgbl = GET_THREAD_DATA;
FRB *ptr;
SLONG length;
block->frb_header.blk_type = (UCHAR) type_frb; tgbl::pool_vec_t::iterator curr;
prior = NULL; for(curr = tdgbl->pools.begin(); curr != tdgbl->pools.end(); ++curr)
{
for (ptr = &pool->plb_free; free = *ptr; if (*curr == this)
prior = free, ptr = &free->frb_next) if (block < free) {
break; *curr = 0;
return;
// Merge block into list first, then try to combine blocks
block->frb_next = free;
*ptr = block;
// Try to merge the free block with the next one down.
length = block->frb_header.blk_length << SHIFT;
if (free && (SCHAR *) block + length == (SCHAR *) free) {
block->frb_header.blk_length += free->frb_header.blk_length;
block->frb_next = free->frb_next;
} }
// Try and merge the block with the prior free block
if (prior &&
(length = prior->frb_header.blk_length << SHIFT) &&
(SCHAR *) prior + length == (SCHAR *) block) {
prior->frb_header.blk_length += block->frb_header.blk_length;
prior->frb_next = block->frb_next;
} }
} }

View File

@ -24,53 +24,35 @@
#ifndef _ALICE_ALL_H_ #ifndef _ALICE_ALL_H_
#define _ALICE_ALL_H_ #define _ALICE_ALL_H_
#if ALIGNMENT == 8 #include "../common/memory/memory_pool.h"
#define MIN_ALLOC 8 #include "../jrd/block_cache.h"
#else #include "../alice/lls.h"
#define MIN_ALLOC 4
#endif
#define MAX_BLOCK 256000 void ALLA_init(); /* initialize pool system */
#define FUDGE 1 void ALLA_fini(); /* get rid of everything */
#define SHIFT 2
#define MIN_ALLOCATION 1024 /* Minimin allocation from operating system */ class AliceMemoryPool : public MemoryPool
/* This is the header to be used by all blocks to
specify the type of block, the pool in which it has
been allocated, and the length of its tail. */
#ifndef INCLUDE_FB_BLK
#include "../include/fb_blk.h"
#endif
/* Free block */
typedef struct frb
{ {
struct blk frb_header; public:
struct frb *frb_next; /* Next free block in pool */ // static AliceMemoryPool *create_new_pool(MemoryPool* = 0);
} *FRB; // AliceMemoryPool(MemoryPool* p = 0)
// : MemoryPool(0, p),
// lls_cache(*this)
// {}
AliceMemoryPool(int extSize = 0, MemoryPool* p = FB_MemoryPool)
: MemoryPool(extSize, p),
lls_cache(*this)
{
}
/* Pool block */
typedef struct plb ~AliceMemoryPool();
{
struct blk plb_header;
USHORT plb_pool_id; /* pool id */
struct frb *plb_free; /* first free block */
struct hnk *plb_hunks; /* first hunk block */
struct lls *plb_lls; /* avaiable linked list stack nodes */
} *PLB;
/* Hunk blocks */ static class blk* ALLA_pop(class lls**);
static void ALLA_push(class blk*, class lls**);
typedef struct hnk private:
{ BlockCache<class lls> lls_cache; /* Was plb_lls */
struct blk hnk_header; };
SCHAR *hnk_address; /* start of memory hunk */
SLONG hnk_length; /* length of memory hunk */
struct hnk *hnk_next; /* next memory hunk in structure */
} *HNK;
#endif /* _ALICE_ALL_H_ */ #endif /* _ALICE_ALL_H_ */

View File

@ -21,30 +21,9 @@
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
*/ */
#ifndef _ALICE_ALL_PROTO_H_ #ifndef ALICE_ALL_PROTO_H
#define _ALICE_ALL_PROTO_H_ #define ALICE_ALL_PROTO_H
#include "../alice/lls.h" #include "../alice/all.h"
#ifdef __cplusplus #endif /* ALICE_ALL_PROTO_H */
extern "C" {
#endif
BLK ALLA_alloc(PLB, UCHAR, int);
BLK ALLA_extend(BLK *, int);
void ALLA_fini(void);
void ALLA_free(SCHAR *);
void ALLA_init(void);
SCHAR* ALLA_malloc(SLONG);
PLB ALLA_pool(void);
void ALLA_push(BLK, register LLS *);
BLK ALLA_pop(register LLS *);
void ALLA_release(register FRB);
void ALLA_rlpool(PLB);
VEC ALLA_vector(PLB, VEC *, USHORT);
#ifdef __cplusplus
};
#endif
#endif /* _ALICE_ALL_PROTO_H_ */

View File

@ -24,6 +24,7 @@
#ifndef _ALICE_ALLOC_H_ #ifndef _ALICE_ALLOC_H_
#define _ALICE_ALLOC_H_ #define _ALICE_ALLOC_H_
/*
#define ALL_release(blk) ALLA_release (blk) #define ALL_release(blk) ALLA_release (blk)
#define ALLOCD(type) ALLA_alloc (tdgbl->ALICE_default_pool, type, 0) #define ALLOCD(type) ALLA_alloc (tdgbl->ALICE_default_pool, type, 0)
#define ALLOCDV(type,repeat) ALLA_alloc (tdgbl->ALICE_default_pool, type, repeat) #define ALLOCDV(type,repeat) ALLA_alloc (tdgbl->ALICE_default_pool, type, repeat)
@ -31,5 +32,6 @@
#define ALLOCPV(type,repeat) ALLA_alloc (tdgbl->ALICE_permanent_pool, type, repeat) #define ALLOCPV(type,repeat) ALLA_alloc (tdgbl->ALICE_permanent_pool, type, repeat)
#define ALLOC(type,pool) ALLA_alloc (pool, type, 0) #define ALLOC(type,pool) ALLA_alloc (pool, type, 0)
#define ALLOCV(type,pool,repeat) ALLA_alloc (pool, type, repeat) #define ALLOCV(type,pool,repeat) ALLA_alloc (pool, type, repeat)
*/
#endif /* _ALICE_ALLOC_H_ */ #endif /* _ALICE_ALLOC_H_ */

View File

@ -21,11 +21,11 @@
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
*/ */
BLKDEF(type_frb, frb, 0) BLKDEF(alice_type_frb, frb, 0)
BLKDEF(type_hnk, hnk, 0) BLKDEF(alice_type_hnk, hnk, 0)
BLKDEF(type_plb, plb, 0) BLKDEF(alice_type_plb, plb, 0)
BLKDEF(type_vec, vec, sizeof(((VEC) 0)->vec_object[0])) BLKDEF(alice_type_vec, vec, sizeof(((VEC) 0)->vec_object[0]))
BLKDEF(type_vcl, vcl, sizeof(((VCL) 0)->vcl_long[0])) BLKDEF(alice_type_vcl, vcl, sizeof(((VCL) 0)->vcl_long[0]))
BLKDEF(type_tdr, tdr, 0) /* transaction description */ BLKDEF(alice_type_tdr, tdr, 0) /* transaction description */
BLKDEF(type_str, str, 1) /* general string block */ BLKDEF(alice_type_str, str, 1) /* general string block */
BLKDEF(type_lls, lls, 0) BLKDEF(alice_type_lls, lls, 0)

View File

@ -24,7 +24,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: exe.cpp,v 1.3 2001-07-29 23:43:21 skywalker Exp $ // $Id: exe.cpp,v 1.4 2001-12-24 02:50:47 tamlin Exp $
// //
// 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE" // 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE"
// conditionals, as the engine now fully supports // conditionals, as the engine now fully supports

View File

@ -21,16 +21,15 @@
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
*/ */
#ifndef _ALICE_LLS_H_ #ifndef ALICE_LLS_H
#define _ALICE_LLS_H_ #define ALICE_LLS_H
#define LLS_PUSH(object, stack) ALL_push (object, stack) #define LLS_PUSH(object, stack) AliceMemoryPool::ALLA_push(object, stack)
#define LLS_POP(stack) ALL_pop (stack) #define LLS_POP(stack) AliceMemoryPool::ALLA_pop(stack)
typedef struct lls { typedef struct lls {
struct blk lls_header;
struct blk *lls_object; struct blk *lls_object;
struct lls *lls_next; struct lls *lls_next;
} *LLS; } *LLS;
#endif /* _ALICE_LLS_H_ */ #endif // ALICE_LLS_H

View File

@ -24,7 +24,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: tdr.cpp,v 1.3 2001-07-29 23:43:21 skywalker Exp $ // $Id: tdr.cpp,v 1.4 2001-12-24 02:50:47 tamlin Exp $
// //
#include "firebird.h" #include "firebird.h"
@ -923,15 +923,15 @@ static void reattach_database(TDR trans)
p = buffer; p = buffer;
while (*p == ' ') while (*p == ' ')
*p++; *p++;
if (TDR_attach_database if (TDR_attach_database(status_vector,
(status_vector, trans, reinterpret_cast < char *>(p))) { trans,
string = reinterpret_cast<char*>(p)))
(STR) ALLOCDV(type_str, {
strlen(reinterpret_cast < string = new(*tdgbl->ALICE_default_pool,
const char *>(p)) + 1); strlen(reinterpret_cast<const char*>(p)) + 1) str;
strcpy(reinterpret_cast < char *>(string->str_data), strcpy(reinterpret_cast<char*>(string->str_data),
reinterpret_cast < const char *>(p)); reinterpret_cast<const char*>(p));
string->str_length = strlen(reinterpret_cast < const char *>(p)); string->str_length = strlen(reinterpret_cast<const char*>(p));
trans->tdr_fullpath = string; trans->tdr_fullpath = string;
trans->tdr_filename = (TEXT *) string->str_data; trans->tdr_filename = (TEXT *) string->str_data;
return; return;

View File

@ -22,7 +22,7 @@
* Toni Martir: Added verbose backup records as BACKUP_VERBOSE_INTERVAL * Toni Martir: Added verbose backup records as BACKUP_VERBOSE_INTERVAL
*/ */
/* /*
$Id: backup.epp,v 1.2 2001-07-29 23:43:21 skywalker Exp $ $Id: backup.epp,v 1.3 2001-12-24 02:50:47 tamlin Exp $
*/ */
#include "firebird.h" #include "firebird.h"
@ -33,6 +33,7 @@ $Id: backup.epp,v 1.2 2001-07-29 23:43:21 skywalker Exp $
#include "../jrd/ods.h" #include "../jrd/ods.h"
#include "../jrd/align.h" #include "../jrd/align.h"
#include "../jrd/gdsassert.h" #include "../jrd/gdsassert.h"
#include "../jrd/thd_proto.h"
#include "../burp/backu_proto.h" #include "../burp/backu_proto.h"
#include "../burp/burp_proto.h" #include "../burp/burp_proto.h"
#include "../burp/canon_proto.h" #include "../burp/canon_proto.h"

View File

@ -134,9 +134,6 @@ struct tgbl *gdgbl;
#endif #endif
extern "C" {
#define OUTPUT_SUPPRESS "SUPPRESS" #define OUTPUT_SUPPRESS "SUPPRESS"
#define BURP_MSG_FAC 12 #define BURP_MSG_FAC 12
@ -439,6 +436,8 @@ static int output_svc( SLONG output_data, UCHAR * output_buf)
return 0; return 0;
} }
extern "C" {
int DLL_EXPORT BURP_gbak(int argc, int DLL_EXPORT BURP_gbak(int argc,
char* argv[], char* argv[],
OUTPUTPROC output_proc, OUTPUTPROC output_proc,
@ -503,66 +502,11 @@ int DLL_EXPORT BURP_gbak(int argc,
tdgbl->output_data = output_data; tdgbl->output_data = output_data;
/* Initialize static data. */ /* Initialize static data. */
for (in_sw_tab = burp_in_sw_table; in_sw_tab->in_sw_name; in_sw_tab++) for (in_sw_tab = burp_in_sw_table; in_sw_tab->in_sw_name; in_sw_tab++) {
in_sw_tab->in_sw_state = FALSE; in_sw_tab->in_sw_state = FALSE;
if (SETJMP(env)) {
int exit_code;
UCHAR *mem;
/* All calls to EXIT(), normal and error exits, wind up here */
tdgbl->burp_env = NULL;
exit_code = tdgbl->exit_code;
/* Close the gbak file handles if they still open */
for (file = tdgbl->gbl_sw_backup_files; file; file = file->fil_next) {
if (file->fil_fd != INVALID_HANDLE_VALUE)
CLOSE(file->fil_fd);
if (exit_code != 0
&& (tdgbl->action->act_action == ACT_backup_split
|| tdgbl->action->act_action == ACT_backup))
UNLINK(file->fil_name);
} }
/* Detach from database to release system resources */ try {
if (tdgbl->db_handle != 0) {
close_out_transaction(action,
const_cast<isc_tr_handle*>(&tdgbl->tr_handle));
close_out_transaction(action,
const_cast<isc_tr_handle*>(&tdgbl->global_trans));
if (isc_detach_database(const_cast<ISC_STATUS*>(tdgbl->status_vector),
const_cast<isc_db_handle*>(&tdgbl->db_handle)))
{
BURP_print_status(const_cast<STATUS*>(tdgbl->status_vector));
}
}
/* Close the status output file */
if (tdgbl->sw_redirect == TRUE && tdgbl->output_file != NULL) {
ib_fclose(tdgbl->output_file);
tdgbl->output_file = NULL;
}
/* Free all unfreed memory used by Gbak itself */
while (tdgbl->head_of_mem_list != NULL) {
mem = tdgbl->head_of_mem_list;
tdgbl->head_of_mem_list = *((UCHAR **) tdgbl->head_of_mem_list);
gds__free(mem);
}
RESTORE_THREAD_DATA;
if (tdgbl != NULL) {
gds__free((SLONG *) tdgbl);
}
#if defined(DEBUG_GDS_ALLOC) && !defined(SUPERSERVER)
gds_alloc_report(0, __FILE__, __LINE__);
#endif
/* All returns occur from this point - even normal returns */
return exit_code;
}
#ifdef VMS #ifdef VMS
argc = VMS_parse(&argv, argc); argc = VMS_parse(&argv, argc);
@ -1101,9 +1045,70 @@ int DLL_EXPORT BURP_gbak(int argc,
EXIT(result); EXIT(result);
return result; return result;
} // try
catch (...)
{
int exit_code;
UCHAR *mem;
/* All calls to EXIT(), normal and error exits, wind up here */
tdgbl->burp_env = NULL;
exit_code = tdgbl->exit_code;
/* Close the gbak file handles if they still open */
for (file = tdgbl->gbl_sw_backup_files; file; file = file->fil_next) {
if (file->fil_fd != INVALID_HANDLE_VALUE)
CLOSE(file->fil_fd);
if (exit_code != 0
&& (tdgbl->action->act_action == ACT_backup_split
|| tdgbl->action->act_action == ACT_backup))
UNLINK(file->fil_name);
}
/* Detach from database to release system resources */
if (tdgbl->db_handle != 0) {
close_out_transaction(action,
const_cast<isc_tr_handle*>(&tdgbl->tr_handle));
close_out_transaction(action,
const_cast<isc_tr_handle*>(&tdgbl->global_trans));
if (isc_detach_database(const_cast<ISC_STATUS*>(tdgbl->status_vector),
const_cast<isc_db_handle*>(&tdgbl->db_handle)))
{
BURP_print_status(const_cast<STATUS*>(tdgbl->status_vector));
}
}
/* Close the status output file */
if (tdgbl->sw_redirect == TRUE && tdgbl->output_file != NULL) {
ib_fclose(tdgbl->output_file);
tdgbl->output_file = NULL;
}
/* Free all unfreed memory used by Gbak itself */
while (tdgbl->head_of_mem_list != NULL) {
mem = tdgbl->head_of_mem_list;
tdgbl->head_of_mem_list = *((UCHAR **) tdgbl->head_of_mem_list);
gds__free(mem);
}
RESTORE_THREAD_DATA;
if (tdgbl != NULL) {
gds__free((SLONG *) tdgbl);
}
#if defined(DEBUG_GDS_ALLOC) && !defined(SUPERSERVER)
gds_alloc_report(0, __FILE__, __LINE__);
#endif
/* All returns occur from this point - even normal returns */
return exit_code;
}
} }
void BURP_abort(void) void BURP_abort(void)
{ {
/************************************** /**************************************
@ -1440,6 +1445,8 @@ void BURP_verbose(USHORT number,
burp_output(""); burp_output("");
} }
} // extern "C"
static void close_out_transaction(VOLATILE SSHORT action, static void close_out_transaction(VOLATILE SSHORT action,
isc_tr_handle* handle) isc_tr_handle* handle)
@ -2256,5 +2263,3 @@ static int api_gbak(int argc,
#endif // !SUPERSERVER #endif // !SUPERSERVER
} // extern "C"

View File

@ -603,6 +603,10 @@ typedef struct gfld {
#define MAX_FILE_NAME_LENGTH 256 #define MAX_FILE_NAME_LENGTH 256
#ifdef __cplusplus
} /* extern "C" */
#endif
/* Note that this typedef is also defined in JRD.H and REMOTE.H */ /* Note that this typedef is also defined in JRD.H and REMOTE.H */
/* but for some reason we are avoiding including JRD.H */ /* but for some reason we are avoiding including JRD.H */
/* and this typedef is needed to include SVC.H */ /* and this typedef is needed to include SVC.H */
@ -613,10 +617,6 @@ typedef struct gfld {
#endif #endif
#ifdef __cplusplus
} /* extern "C" */
#endif
#include "../jrd/svc.h" #include "../jrd/svc.h"
#include "../jrd/svc_proto.h" #include "../jrd/svc_proto.h"
@ -865,11 +865,11 @@ extern struct tgbl *gdgbl;
// I had funnies with this cast // I had funnies with this cast
#define EXIT(code) { tdgbl->exit_code = ((volatile int)code); \ #define EXIT(code) { tdgbl->exit_code = ((volatile int)code); \
if (tdgbl->burp_env != NULL) \ if (tdgbl->burp_env != NULL) \
LONGJMP((jmp_buf)(const_cast<UCHAR*>(tdgbl->burp_env)), 1); } Firebird::status_longjmp_error::raise(1); }
#else #else
#define EXIT(code) { tdgbl->exit_code = ((volatile int)code); \
if (tdgbl->burp_env != NULL) \ #error Dont do this, it hurts!
LONGJMP(tdgbl->burp_env, 1); }
#endif /* __cplusplus */ #endif /* __cplusplus */
#define FINI_DB_NOT_ONLINE 2 /* database is not on-line due to #define FINI_DB_NOT_ONLINE 2 /* database is not on-line due to

View File

@ -21,13 +21,12 @@
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
*/ */
/* /*
$Id: canonical.cpp,v 1.2 2001-07-29 23:43:21 skywalker Exp $ $Id: canonical.cpp,v 1.3 2001-12-24 02:50:48 tamlin Exp $
*/ */
#include "firebird.h" #include "firebird.h"
#include "../jrd/ib_stdio.h" #include "../jrd/ib_stdio.h"
#include <string.h> #include <string.h>
#include "../remote/remote.h"
#include "../burp/burp.h" #include "../burp/burp.h"
#include "../jrd/align.h" #include "../jrd/align.h"
#include "../jrd/sdl.h" #include "../jrd/sdl.h"
@ -35,6 +34,16 @@ $Id: canonical.cpp,v 1.2 2001-07-29 23:43:21 skywalker Exp $
#include "../jrd/sdl_proto.h" #include "../jrd/sdl_proto.h"
#include "../remote/xdr_proto.h" #include "../remote/xdr_proto.h"
#include "../jrd/gdsassert.h" #include "../jrd/gdsassert.h"
#include "../include/fb_types.h"
// TMN: Currently we can't include remote/remote.h because we'd get
// conflicting blk_t definitions (we are gonna fix this, in due time).
// Because this file needs the remote definition of VARY, which
// coincidentally is different from _all_ other modules in the code,
// we have to make the type definition here.
typedef vary* VARY;
#ifdef PC_PLATFORM #ifdef PC_PLATFORM
#ifndef NETWARE_386 #ifndef NETWARE_386

View File

@ -1,6 +1,6 @@
/* /*
* PROGRAM: JRD Backup and Restore Program * PROGRAM: JRD Backup and Restore Program
* MODULE: restore.e * MODULE: restore.epp
* DESCRIPTION: Restore routine * DESCRIPTION: Restore routine
* *
* The contents of this file are subject to the Interbase Public * The contents of this file are subject to the Interbase Public
@ -21,9 +21,10 @@
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
* Toni Martir: Verbose records restored as RESTORE_VERBOSE_INTERVAL, * Toni Martir: Verbose records restored as RESTORE_VERBOSE_INTERVAL,
* also verbose restoring indexes as DEFERRED when verbose * also verbose restoring indexes as DEFERRED when verbose
*
*/ */
/* /*
$Id: restore.epp,v 1.2 2001-07-29 23:43:21 skywalker Exp $ $Id: restore.epp,v 1.3 2001-12-24 02:50:48 tamlin Exp $
*/ */
#include "firebird.h" #include "firebird.h"
@ -37,6 +38,7 @@ $Id: restore.epp,v 1.2 2001-07-29 23:43:21 skywalker Exp $
#include "../jrd/license.h" #include "../jrd/license.h"
#include "../jrd/obj.h" #include "../jrd/obj.h"
#include "../jrd/ods.h" #include "../jrd/ods.h"
#include "../jrd/thd_proto.h"
#include "../burp/burp_proto.h" #include "../burp/burp_proto.h"
#include "../burp/canon_proto.h" #include "../burp/canon_proto.h"
#include "../burp/misc_proto.h" #include "../burp/misc_proto.h"
@ -44,18 +46,6 @@ $Id: restore.epp,v 1.2 2001-07-29 23:43:21 skywalker Exp $
#include "../burp/resto_proto.h" #include "../burp/resto_proto.h"
#include "../intl/charsets.h" #include "../intl/charsets.h"
#include "../jrd/gdsassert.h" #include "../jrd/gdsassert.h"
/* this typedef is required to avoid compilation warnings in
* protocol.h.
*
* REMOVED 6/26 JMB. Not needed anymore with C++
*
typedef struct bid {
ULONG bid_relation_id; // Relation id (or null)
ULONG bid_number; // Record number
} *BID;
*/
#include "../remote/protocol.h" #include "../remote/protocol.h"
/* For netware the follow DB handle is #defined to be a value stored */ /* For netware the follow DB handle is #defined to be a value stored */
@ -206,6 +196,7 @@ static CONST SSHORT old_sparcs[] =
#define GET_BLOCK(p,n) MVOL_read_block (tdgbl, (p), (n)) #define GET_BLOCK(p,n) MVOL_read_block (tdgbl, (p), (n))
#define GET_ATTRIBUTE(att) ((att) = (ATT_TYPE) GET()) #define GET_ATTRIBUTE(att) ((att) = (ATT_TYPE) GET())
#define GET_RECORD(att) ((att) = (REC_TYPE) GET()) #define GET_RECORD(att) ((att) = (REC_TYPE) GET())
#define GET_TEXT(text) get_text((text), sizeof(text))
/* When skipping started, scan_next_attr will be changed from NO_SKIP */ /* When skipping started, scan_next_attr will be changed from NO_SKIP */
/* to BEFORE_SKIP. When scanning for next valid attribute after skipping, */ /* to BEFORE_SKIP. When scanning for next valid attribute after skipping, */
@ -257,7 +248,7 @@ long db_handle;
UCHAR dpb[128], *d, *q; UCHAR dpb[128], *d, *q;
SSHORT l; SSHORT l;
isc_req_handle req_handle3 = NULL; isc_req_handle req_handle3 = NULL;
TEXT index_name[32]; BASED_ON RDB$INDICES.RDB$INDEX_NAME index_name;
long error_code; long error_code;
tdgbl = GET_THREAD_DATA; tdgbl = GET_THREAD_DATA;
@ -1254,8 +1245,9 @@ while ((item = *p++) != gds_info_end)
** in one big segment ** in one big segment
** **
*/ */
if (num_segments > 1) if (num_segments > 1) {
assert (num_segments > 1); assert (num_segments > 1);
}
break; break;
default: default:
@ -2103,13 +2095,13 @@ STORE (REQUEST_HANDLE tdgbl->handles_get_character_sets_req_handle1)
case att_charset_name: case att_charset_name:
X.RDB$CHARACTER_SET_NAME.NULL = FALSE; X.RDB$CHARACTER_SET_NAME.NULL = FALSE;
get_text (X.RDB$CHARACTER_SET_NAME, sizeof (X.RDB$CHARACTER_SET_NAME)); GET_TEXT(X.RDB$CHARACTER_SET_NAME);
BURP_verbose (msgVerbose_restore_charset, X.RDB$CHARACTER_SET_NAME, NULL_PTR, NULL_PTR, NULL_PTR, NULL_PTR); BURP_verbose (msgVerbose_restore_charset, X.RDB$CHARACTER_SET_NAME, NULL_PTR, NULL_PTR, NULL_PTR, NULL_PTR);
break; break;
case att_charset_form: case att_charset_form:
X.RDB$FORM_OF_USE.NULL = FALSE; X.RDB$FORM_OF_USE.NULL = FALSE;
get_text (X.RDB$FORM_OF_USE, sizeof (X.RDB$FORM_OF_USE)); GET_TEXT(X.RDB$FORM_OF_USE);
break; break;
case att_charset_numchar: case att_charset_numchar:
@ -2119,7 +2111,7 @@ STORE (REQUEST_HANDLE tdgbl->handles_get_character_sets_req_handle1)
case att_charset_coll: case att_charset_coll:
X.RDB$DEFAULT_COLLATE_NAME.NULL = FALSE; X.RDB$DEFAULT_COLLATE_NAME.NULL = FALSE;
get_text (X.RDB$DEFAULT_COLLATE_NAME, sizeof (X.RDB$DEFAULT_COLLATE_NAME)); GET_TEXT(X.RDB$DEFAULT_COLLATE_NAME);
break; break;
case att_charset_id: case att_charset_id:
@ -2139,7 +2131,7 @@ STORE (REQUEST_HANDLE tdgbl->handles_get_character_sets_req_handle1)
case att_charset_funct: case att_charset_funct:
X.RDB$FUNCTION_NAME.NULL = FALSE; X.RDB$FUNCTION_NAME.NULL = FALSE;
get_text (X.RDB$FUNCTION_NAME, sizeof (X.RDB$FUNCTION_NAME)); GET_TEXT(X.RDB$FUNCTION_NAME);
break; break;
case att_charset_bytes_char: case att_charset_bytes_char:
@ -2188,12 +2180,12 @@ STORE (REQUEST_HANDLE tdgbl->handles_get_chk_constraint_req_handle1)
{ {
case att_chk_constraint_name: case att_chk_constraint_name:
X.RDB$CONSTRAINT_NAME.NULL = FALSE; X.RDB$CONSTRAINT_NAME.NULL = FALSE;
get_text (X.RDB$CONSTRAINT_NAME, sizeof (X.RDB$CONSTRAINT_NAME)); GET_TEXT(X.RDB$CONSTRAINT_NAME);
break; break;
case att_chk_trigger_name: case att_chk_trigger_name:
X.RDB$TRIGGER_NAME.NULL = FALSE; X.RDB$TRIGGER_NAME.NULL = FALSE;
get_text (X.RDB$TRIGGER_NAME, sizeof (X.RDB$TRIGGER_NAME)); GET_TEXT(X.RDB$TRIGGER_NAME);
break; break;
default: default:
@ -2244,7 +2236,7 @@ STORE (REQUEST_HANDLE tdgbl->handles_get_collation_req_handle1)
case att_coll_name: case att_coll_name:
X.RDB$COLLATION_NAME.NULL = FALSE; X.RDB$COLLATION_NAME.NULL = FALSE;
get_text (X.RDB$COLLATION_NAME, sizeof (X.RDB$COLLATION_NAME)); GET_TEXT(X.RDB$COLLATION_NAME);
BURP_verbose (msgVerbose_restore_collation, X.RDB$COLLATION_NAME, NULL_PTR, NULL_PTR, NULL_PTR, NULL_PTR); BURP_verbose (msgVerbose_restore_collation, X.RDB$COLLATION_NAME, NULL_PTR, NULL_PTR, NULL_PTR, NULL_PTR);
break; break;
@ -2281,7 +2273,7 @@ STORE (REQUEST_HANDLE tdgbl->handles_get_collation_req_handle1)
case att_coll_funct: case att_coll_funct:
X.RDB$FUNCTION_NAME.NULL = FALSE; X.RDB$FUNCTION_NAME.NULL = FALSE;
get_text (X.RDB$FUNCTION_NAME, sizeof (X.RDB$FUNCTION_NAME)); GET_TEXT(X.RDB$FUNCTION_NAME);
break; break;
default: default:
@ -2325,7 +2317,7 @@ SLONG *blob_id;
REC_TYPE record; REC_TYPE record;
TGBL tdgbl; TGBL tdgbl;
isc_req_handle req_handle = NULL; isc_req_handle req_handle = NULL;
TEXT index_name[32]; BASED_ON RDB$INDICES.RDB$INDEX_NAME index_name;
long error_code; long error_code;
tdgbl = GET_THREAD_DATA; tdgbl = GET_THREAD_DATA;
@ -2421,7 +2413,7 @@ for (field = relation->rel_fields; field; field = field->fld_next)
default: default:
#ifdef SUPERSERVER #ifdef SUPERSERVER
BURP_svc_error (26, isc_arg_number, field->fld_type, BURP_svc_error (26, isc_arg_number, (void*)field->fld_type,
0, NULL, 0, NULL, 0, NULL, 0, NULL); 0, NULL, 0, NULL, 0, NULL, 0, NULL);
#else #else
BURP_error (26, (void*) field->fld_type, 0, 0, 0, 0); BURP_error (26, (void*) field->fld_type, 0, 0, 0, 0);
@ -2533,7 +2525,8 @@ while (TRUE)
old_length = recompute_length (relation); old_length = recompute_length (relation);
if (l != old_length) if (l != old_length)
#ifdef SUPERSERVER #ifdef SUPERSERVER
BURP_svc_error (40, isc_arg_number, length, isc_arg_number, l, BURP_svc_error(40, isc_arg_number, (void*)length,
isc_arg_number, (void*)l,
0, NULL, 0, NULL, 0, NULL); 0, NULL, 0, NULL, 0, NULL);
#else #else
BURP_error (40, (void*) length, (void*) l, 0, 0, 0); BURP_error (40, (void*) length, (void*) l, 0, 0, 0);
@ -2742,7 +2735,7 @@ STORE (REQUEST_HANDLE tdgbl->handles_get_exception_req_handle1)
switch (attribute) switch (attribute)
{ {
case att_exception_name: case att_exception_name:
l = get_text (X.RDB$EXCEPTION_NAME, sizeof (X.RDB$EXCEPTION_NAME)); l = GET_TEXT(X.RDB$EXCEPTION_NAME);
MISC_terminate ((UCHAR*) X.RDB$EXCEPTION_NAME, (UCHAR*) temp, l, sizeof (temp)); MISC_terminate ((UCHAR*) X.RDB$EXCEPTION_NAME, (UCHAR*) temp, l, sizeof (temp));
BURP_verbose (199, temp, NULL_PTR, NULL_PTR, NULL_PTR, NULL_PTR); BURP_verbose (199, temp, NULL_PTR, NULL_PTR, NULL_PTR, NULL_PTR);
/* msg 199 restoring exception %s */ /* msg 199 restoring exception %s */
@ -2759,7 +2752,7 @@ STORE (REQUEST_HANDLE tdgbl->handles_get_exception_req_handle1)
break; break;
case att_exception_msg: case att_exception_msg:
get_text (X.RDB$MESSAGE, sizeof (X.RDB$MESSAGE)); GET_TEXT(X.RDB$MESSAGE);
X.RDB$MESSAGE.NULL = FALSE; X.RDB$MESSAGE.NULL = FALSE;
break; break;
@ -2939,23 +2932,23 @@ STORE (TRANSACTION_HANDLE local_trans
{ {
case att_field_name: case att_field_name:
field->fld_name_length = field->fld_name_length =
get_text (field->fld_name, sizeof (field->fld_name)); GET_TEXT(field->fld_name);
BURP_verbose (115, field->fld_name, NULL_PTR, NULL_PTR, NULL_PTR, NULL_PTR); BURP_verbose (115, field->fld_name, NULL_PTR, NULL_PTR, NULL_PTR, NULL_PTR);
/* msg 115 restoring field %s */ /* msg 115 restoring field %s */
strcpy (X.RDB$FIELD_NAME, field->fld_name); strcpy (X.RDB$FIELD_NAME, field->fld_name);
break; break;
case att_field_source: case att_field_source:
get_text (X.RDB$FIELD_SOURCE, sizeof (X.RDB$FIELD_SOURCE)); GET_TEXT(X.RDB$FIELD_SOURCE);
break; break;
case att_field_security_class: case att_field_security_class:
get_text (X.RDB$SECURITY_CLASS, sizeof (X.RDB$SECURITY_CLASS)); GET_TEXT(X.RDB$SECURITY_CLASS);
X.RDB$SECURITY_CLASS.NULL = FALSE; X.RDB$SECURITY_CLASS.NULL = FALSE;
break; break;
case att_field_query_name: case att_field_query_name:
get_text (X.RDB$QUERY_NAME, sizeof (X.RDB$QUERY_NAME)); GET_TEXT(X.RDB$QUERY_NAME);
X.RDB$QUERY_NAME.NULL = FALSE; X.RDB$QUERY_NAME.NULL = FALSE;
break; break;
@ -2965,7 +2958,7 @@ STORE (TRANSACTION_HANDLE local_trans
break; break;
case att_field_edit_string: case att_field_edit_string:
get_text (X.RDB$EDIT_STRING, sizeof (X.RDB$EDIT_STRING)); GET_TEXT(X.RDB$EDIT_STRING);
X.RDB$EDIT_STRING.NULL = FALSE; X.RDB$EDIT_STRING.NULL = FALSE;
break; break;
@ -3010,7 +3003,7 @@ STORE (TRANSACTION_HANDLE local_trans
break; break;
case att_base_field: case att_base_field:
get_text (X.RDB$BASE_FIELD, sizeof (X.RDB$BASE_FIELD)); GET_TEXT(X.RDB$BASE_FIELD);
X.RDB$BASE_FIELD.NULL = FALSE; X.RDB$BASE_FIELD.NULL = FALSE;
break; break;
@ -3025,7 +3018,7 @@ STORE (TRANSACTION_HANDLE local_trans
break; break;
case att_field_complex_name: case att_field_complex_name:
get_text (X.RDB$COMPLEX_NAME, sizeof (X.RDB$COMPLEX_NAME)); GET_TEXT(X.RDB$COMPLEX_NAME);
X.RDB$COMPLEX_NAME.NULL = FALSE; X.RDB$COMPLEX_NAME.NULL = FALSE;
break; break;
@ -3140,7 +3133,7 @@ STORE (REQUEST_HANDLE tdgbl->handles_get_field_dimensions_req_handle1)
switch (attribute) switch (attribute)
{ {
case att_field_name: case att_field_name:
get_text (X.RDB$FIELD_NAME, sizeof (X.RDB$FIELD_NAME)); GET_TEXT(X.RDB$FIELD_NAME);
break; break;
case att_field_dimensions: case att_field_dimensions:
@ -3196,7 +3189,7 @@ STORE (REQUEST_HANDLE tdgbl->handles_get_files_req_handle1)
switch (attribute) switch (attribute)
{ {
case att_file_filename: case att_file_filename:
get_text (X.RDB$FILE_NAME, sizeof (X.RDB$FILE_NAME)); GET_TEXT(X.RDB$FILE_NAME);
BURP_verbose (116, BURP_verbose (116,
/* msg 116 restoring file %s */ /* msg 116 restoring file %s */
X.RDB$FILE_NAME, NULL_PTR, NULL_PTR, NULL_PTR, NULL_PTR); X.RDB$FILE_NAME, NULL_PTR, NULL_PTR, NULL_PTR, NULL_PTR);
@ -3264,7 +3257,7 @@ STORE (REQUEST_HANDLE tdgbl->handles_get_filter_req_handle1)
switch (attribute) switch (attribute)
{ {
case att_filter_name: case att_filter_name:
get_text (X.RDB$FUNCTION_NAME, sizeof (X.RDB$FUNCTION_NAME)); GET_TEXT(X.RDB$FUNCTION_NAME);
BURP_verbose (117, X.RDB$FUNCTION_NAME, NULL_PTR, NULL_PTR, NULL_PTR, NULL_PTR); BURP_verbose (117, X.RDB$FUNCTION_NAME, NULL_PTR, NULL_PTR, NULL_PTR, NULL_PTR);
/* msg 117 restoring filter %s */ /* msg 117 restoring filter %s */
break; break;
@ -3280,11 +3273,11 @@ STORE (REQUEST_HANDLE tdgbl->handles_get_filter_req_handle1)
break; break;
case att_filter_module_name: case att_filter_module_name:
get_text (X.RDB$MODULE_NAME, sizeof (X.RDB$MODULE_NAME)); GET_TEXT(X.RDB$MODULE_NAME);
break; break;
case att_filter_entrypoint: case att_filter_entrypoint:
get_text (X.RDB$ENTRYPOINT, sizeof (X.RDB$ENTRYPOINT)); GET_TEXT(X.RDB$ENTRYPOINT);
break; break;
case att_filter_input_sub_type: case att_filter_input_sub_type:
@ -3337,7 +3330,7 @@ STORE (REQUEST_HANDLE tdgbl->handles_get_function_req_handle1)
switch (attribute) switch (attribute)
{ {
case att_function_name: case att_function_name:
l = get_text (X.RDB$FUNCTION_NAME, sizeof (X.RDB$FUNCTION_NAME)); l = GET_TEXT(X.RDB$FUNCTION_NAME);
MISC_terminate ((UCHAR*) X.RDB$FUNCTION_NAME, (UCHAR*) temp, l, sizeof (temp)); MISC_terminate ((UCHAR*) X.RDB$FUNCTION_NAME, (UCHAR*) temp, l, sizeof (temp));
BURP_verbose (118, temp, NULL_PTR, NULL_PTR, NULL_PTR, NULL_PTR); BURP_verbose (118, temp, NULL_PTR, NULL_PTR, NULL_PTR, NULL_PTR);
/* msg 118 restoring function %s */ /* msg 118 restoring function %s */
@ -3352,11 +3345,11 @@ STORE (REQUEST_HANDLE tdgbl->handles_get_function_req_handle1)
break; break;
case att_function_module_name: case att_function_module_name:
get_text (X.RDB$MODULE_NAME, sizeof (X.RDB$MODULE_NAME)); GET_TEXT(X.RDB$MODULE_NAME);
break; break;
case att_function_entrypoint: case att_function_entrypoint:
get_text (X.RDB$ENTRYPOINT, sizeof (X.RDB$ENTRYPOINT)); GET_TEXT(X.RDB$ENTRYPOINT);
break; break;
case att_function_return_arg: case att_function_return_arg:
@ -3364,7 +3357,7 @@ STORE (REQUEST_HANDLE tdgbl->handles_get_function_req_handle1)
break; break;
case att_function_query_name: case att_function_query_name:
get_text (X.RDB$QUERY_NAME, sizeof (X.RDB$QUERY_NAME)); GET_TEXT(X.RDB$QUERY_NAME);
break; break;
case att_function_type: case att_function_type:
@ -3424,7 +3417,7 @@ if (tdgbl->RESTORE_format >= 6)
switch (attribute) switch (attribute)
{ {
case att_functionarg_name: case att_functionarg_name:
l = get_text (X.RDB$FUNCTION_NAME, sizeof (X.RDB$FUNCTION_NAME)); l = GET_TEXT(X.RDB$FUNCTION_NAME);
MISC_terminate ((UCHAR*) X.RDB$FUNCTION_NAME, (UCHAR*) temp, l, sizeof (temp)); MISC_terminate ((UCHAR*) X.RDB$FUNCTION_NAME, (UCHAR*) temp, l, sizeof (temp));
BURP_verbose (119, temp, NULL_PTR, NULL_PTR, NULL_PTR, NULL_PTR); BURP_verbose (119, temp, NULL_PTR, NULL_PTR, NULL_PTR, NULL_PTR);
/* msg 119 restoring argument for function %s */ /* msg 119 restoring argument for function %s */
@ -3488,7 +3481,7 @@ else
switch (attribute) switch (attribute)
{ {
case att_functionarg_name: case att_functionarg_name:
l = get_text (X.RDB$FUNCTION_NAME, sizeof (X.RDB$FUNCTION_NAME)); l = GET_TEXT(X.RDB$FUNCTION_NAME);
MISC_terminate ((UCHAR*) X.RDB$FUNCTION_NAME, (UCHAR*) temp, l, sizeof (temp)); MISC_terminate ((UCHAR*) X.RDB$FUNCTION_NAME, (UCHAR*) temp, l, sizeof (temp));
BURP_verbose (119, temp, NULL_PTR, NULL_PTR, NULL_PTR, NULL_PTR); BURP_verbose (119, temp, NULL_PTR, NULL_PTR, NULL_PTR, NULL_PTR);
/* msg 119 restoring argument for function %s */ /* msg 119 restoring argument for function %s */
@ -3552,7 +3545,7 @@ static BOOLEAN get_generator (void)
* *
**************************************/ **************************************/
SINT64 value; SINT64 value;
TEXT name [32]; BASED_ON RDB$GENERATORS.RDB$GENERATOR_NAME name;
ATT_TYPE attribute; ATT_TYPE attribute;
UCHAR scan_next_attr; UCHAR scan_next_attr;
TGBL tdgbl; TGBL tdgbl;
@ -3564,7 +3557,7 @@ while (SKIP_SCAN, GET_ATTRIBUTE (attribute) != att_end)
switch (attribute) switch (attribute)
{ {
case att_gen_generator: case att_gen_generator:
get_text (name, sizeof (name)); GET_TEXT(name);
break; break;
case att_gen_value: case att_gen_value:
@ -3652,19 +3645,19 @@ if (tdgbl->RESTORE_format >= 6)
switch (attribute) switch (attribute)
{ {
case att_field_name: case att_field_name:
l = get_text (X.RDB$FIELD_NAME, sizeof (X.RDB$FIELD_NAME)); l = GET_TEXT(X.RDB$FIELD_NAME);
MISC_terminate ((UCHAR*) X.RDB$FIELD_NAME, (UCHAR*) temp, l, sizeof (temp)); MISC_terminate ((UCHAR*) X.RDB$FIELD_NAME, (UCHAR*) temp, l, sizeof (temp));
BURP_verbose (121, temp, NULL_PTR, NULL_PTR, NULL_PTR, NULL_PTR); BURP_verbose (121, temp, NULL_PTR, NULL_PTR, NULL_PTR, NULL_PTR);
/* msg 121 restoring global field %s */ /* msg 121 restoring global field %s */
break; break;
case att_field_query_name: case att_field_query_name:
get_text (X.RDB$QUERY_NAME, sizeof (X.RDB$QUERY_NAME)); GET_TEXT(X.RDB$QUERY_NAME);
X.RDB$QUERY_NAME.NULL = FALSE; X.RDB$QUERY_NAME.NULL = FALSE;
break; break;
case att_field_edit_string: case att_field_edit_string:
get_text (X.RDB$EDIT_STRING, sizeof (X.RDB$EDIT_STRING)); GET_TEXT(X.RDB$EDIT_STRING);
X.RDB$EDIT_STRING.NULL = FALSE; X.RDB$EDIT_STRING.NULL = FALSE;
break; break;
@ -3963,19 +3956,19 @@ else /* RESTORE_format < 6 */
switch (attribute) switch (attribute)
{ {
case att_field_name: case att_field_name:
l = get_text (X.RDB$FIELD_NAME, sizeof (X.RDB$FIELD_NAME)); l = GET_TEXT(X.RDB$FIELD_NAME);
MISC_terminate ((UCHAR*) X.RDB$FIELD_NAME, (UCHAR*) temp, l, sizeof (temp)); MISC_terminate ((UCHAR*) X.RDB$FIELD_NAME, (UCHAR*) temp, l, sizeof (temp));
BURP_verbose (121, temp, NULL_PTR, NULL_PTR, NULL_PTR, NULL_PTR); BURP_verbose (121, temp, NULL_PTR, NULL_PTR, NULL_PTR, NULL_PTR);
/* msg 121 restoring global field %s */ /* msg 121 restoring global field %s */
break; break;
case att_field_query_name: case att_field_query_name:
get_text (X.RDB$QUERY_NAME, sizeof (X.RDB$QUERY_NAME)); GET_TEXT(X.RDB$QUERY_NAME);
X.RDB$QUERY_NAME.NULL = FALSE; X.RDB$QUERY_NAME.NULL = FALSE;
break; break;
case att_field_edit_string: case att_field_edit_string:
get_text (X.RDB$EDIT_STRING, sizeof (X.RDB$EDIT_STRING)); GET_TEXT(X.RDB$EDIT_STRING);
X.RDB$EDIT_STRING.NULL = FALSE; X.RDB$EDIT_STRING.NULL = FALSE;
break; break;
@ -4255,7 +4248,7 @@ static BOOLEAN get_index (
* *
**************************************/ **************************************/
SSHORT count, segments; SSHORT count, segments;
TEXT index_name [32]; BASED_ON RDB$INDICES.RDB$INDEX_NAME index_name;
ATT_TYPE attribute; ATT_TYPE attribute;
BOOLEAN foreign_index = FALSE; BOOLEAN foreign_index = FALSE;
UCHAR scan_next_attr; UCHAR scan_next_attr;
@ -4283,7 +4276,7 @@ STORE (REQUEST_HANDLE tdgbl->handles_get_index_req_handle1)
switch (attribute) switch (attribute)
{ {
case att_index_name: case att_index_name:
(void) get_text (X.RDB$INDEX_NAME, sizeof (X.RDB$INDEX_NAME)); GET_TEXT(X.RDB$INDEX_NAME);
strcpy (index_name, X.RDB$INDEX_NAME); strcpy (index_name, X.RDB$INDEX_NAME);
BURP_verbose (122, X.RDB$INDEX_NAME, NULL_PTR, NULL_PTR, NULL_PTR, NULL_PTR); BURP_verbose (122, X.RDB$INDEX_NAME, NULL_PTR, NULL_PTR, NULL_PTR, NULL_PTR);
break; break;
@ -4322,7 +4315,7 @@ STORE (REQUEST_HANDLE tdgbl->handles_get_index_req_handle1)
case att_index_field_name: case att_index_field_name:
STORE (REQUEST_HANDLE tdgbl->handles_get_index_req_handle2) STORE (REQUEST_HANDLE tdgbl->handles_get_index_req_handle2)
Y IN RDB$INDEX_SEGMENTS Y IN RDB$INDEX_SEGMENTS
get_text (Y.RDB$FIELD_NAME, sizeof (Y.RDB$FIELD_NAME)); GET_TEXT(Y.RDB$FIELD_NAME);
strcpy (Y.RDB$INDEX_NAME, X.RDB$INDEX_NAME); strcpy (Y.RDB$INDEX_NAME, X.RDB$INDEX_NAME);
Y.RDB$FIELD_POSITION = count++; Y.RDB$FIELD_POSITION = count++;
END_STORE; END_STORE;
@ -4370,7 +4363,7 @@ STORE (REQUEST_HANDLE tdgbl->handles_get_index_req_handle1)
if (tdgbl->gbl_sw_deactivate_indexes) if (tdgbl->gbl_sw_deactivate_indexes)
X.RDB$INDEX_INACTIVE = TRUE; X.RDB$INDEX_INACTIVE = TRUE;
X.RDB$FOREIGN_KEY.NULL = FALSE; X.RDB$FOREIGN_KEY.NULL = FALSE;
get_text (X.RDB$FOREIGN_KEY, sizeof (X.RDB$FOREIGN_KEY)); GET_TEXT(X.RDB$FOREIGN_KEY);
} }
break; break;
@ -4502,12 +4495,15 @@ static SLONG get_numeric (void)
* Get a numeric value from the input stream. * Get a numeric value from the input stream.
* *
**************************************/ **************************************/
SLONG value [2]; SLONG value[2];
SSHORT length;
length = get_text ((TEXT *) value, sizeof (value)); // get_text needs additional space for the terminator,
// because it treats everything as strings.
assert(sizeof(value) > sizeof(SLONG));
return isc_vax_integer ((SCHAR *) value, length); SSHORT length = get_text((TEXT*) value, sizeof (value));
return isc_vax_integer ((SCHAR *) value, length);
} }
static SINT64 get_int64 (void) static SINT64 get_int64 (void)
@ -4522,12 +4518,15 @@ static SINT64 get_int64 (void)
* Get a possibly-64-bit numeric value from the input stream. * Get a possibly-64-bit numeric value from the input stream.
* *
**************************************/ **************************************/
SLONG value [4]; SLONG value [4];
SSHORT length;
length = get_text ((TEXT *) value, sizeof (value)); // get_text needs additional space for the terminator,
// because it treats everything as strings.
assert (sizeof(value) > sizeof(SINT64));
return isc_portable_integer ((UCHAR *) value, length); SSHORT length = get_text ((TEXT *) value, sizeof (value));
return isc_portable_integer ((UCHAR *) value, length);
} }
static BOOLEAN get_procedure (void) static BOOLEAN get_procedure (void)
@ -4574,7 +4573,7 @@ STORE (TRANSACTION_HANDLE local_trans
switch (attribute) switch (attribute)
{ {
case att_procedure_name: case att_procedure_name:
l = get_text (X.RDB$PROCEDURE_NAME, sizeof (X.RDB$PROCEDURE_NAME)); l = GET_TEXT(X.RDB$PROCEDURE_NAME);
procedure->prc_name_length = l; procedure->prc_name_length = l;
strcpy (procedure->prc_name, X.RDB$PROCEDURE_NAME); strcpy (procedure->prc_name, X.RDB$PROCEDURE_NAME);
MISC_terminate ((UCHAR*) X.RDB$PROCEDURE_NAME, (UCHAR*) temp, l, sizeof (temp)); MISC_terminate ((UCHAR*) X.RDB$PROCEDURE_NAME, (UCHAR*) temp, l, sizeof (temp));
@ -4607,12 +4606,12 @@ STORE (TRANSACTION_HANDLE local_trans
break; break;
case att_procedure_security_class: case att_procedure_security_class:
get_text (X.RDB$SECURITY_CLASS, sizeof (X.RDB$SECURITY_CLASS)); GET_TEXT(X.RDB$SECURITY_CLASS);
X.RDB$SECURITY_CLASS.NULL = FALSE; X.RDB$SECURITY_CLASS.NULL = FALSE;
break; break;
case att_procedure_owner_name: case att_procedure_owner_name:
get_text (procedure->prc_owner, sizeof (procedure->prc_owner)); GET_TEXT(procedure->prc_owner);
break; break;
case att_procedure_inputs: case att_procedure_inputs:
@ -4683,7 +4682,7 @@ STORE (TRANSACTION_HANDLE local_trans
switch (attribute) switch (attribute)
{ {
case att_procedureprm_name: case att_procedureprm_name:
l = get_text (X.RDB$PARAMETER_NAME, sizeof (X.RDB$PARAMETER_NAME)); l = GET_TEXT(X.RDB$PARAMETER_NAME);
MISC_terminate ((UCHAR*) X.RDB$PARAMETER_NAME, (UCHAR*) temp, l, sizeof (temp)); MISC_terminate ((UCHAR*) X.RDB$PARAMETER_NAME, (UCHAR*) temp, l, sizeof (temp));
BURP_verbose (196, temp, NULL_PTR, NULL_PTR, NULL_PTR, NULL_PTR); BURP_verbose (196, temp, NULL_PTR, NULL_PTR, NULL_PTR, NULL_PTR);
/* msg 196 restoring parameter %s for stored procedure */ /* msg 196 restoring parameter %s for stored procedure */
@ -4698,7 +4697,7 @@ STORE (TRANSACTION_HANDLE local_trans
break; break;
case att_procedureprm_field_source: case att_procedureprm_field_source:
get_text (X.RDB$FIELD_SOURCE, sizeof (X.RDB$FIELD_SOURCE)); GET_TEXT(X.RDB$FIELD_SOURCE);
break; break;
case att_procedureprm_description: case att_procedureprm_description:
@ -4755,27 +4754,27 @@ STORE (REQUEST_HANDLE tdgbl->handles_get_ref_constraint_req_handle1)
{ {
case att_ref_constraint_name: case att_ref_constraint_name:
X.RDB$CONSTRAINT_NAME.NULL = FALSE; X.RDB$CONSTRAINT_NAME.NULL = FALSE;
get_text (X.RDB$CONSTRAINT_NAME, sizeof (X.RDB$CONSTRAINT_NAME)); GET_TEXT(X.RDB$CONSTRAINT_NAME);
break; break;
case att_ref_unique_const_name: case att_ref_unique_const_name:
X.RDB$CONST_NAME_UQ.NULL = FALSE; X.RDB$CONST_NAME_UQ.NULL = FALSE;
get_text (X.RDB$CONST_NAME_UQ, sizeof (X.RDB$CONST_NAME_UQ)); GET_TEXT(X.RDB$CONST_NAME_UQ);
break; break;
case att_ref_match_option: case att_ref_match_option:
X.RDB$MATCH_OPTION.NULL = FALSE; X.RDB$MATCH_OPTION.NULL = FALSE;
get_text (X.RDB$MATCH_OPTION, sizeof (X.RDB$MATCH_OPTION)); GET_TEXT(X.RDB$MATCH_OPTION);
break; break;
case att_ref_update_rule: case att_ref_update_rule:
X.RDB$UPDATE_RULE.NULL = FALSE; X.RDB$UPDATE_RULE.NULL = FALSE;
get_text (X.RDB$UPDATE_RULE, sizeof (X.RDB$UPDATE_RULE)); GET_TEXT(X.RDB$UPDATE_RULE);
break; break;
case att_ref_delete_rule: case att_ref_delete_rule:
X.RDB$DELETE_RULE.NULL = FALSE; X.RDB$DELETE_RULE.NULL = FALSE;
get_text (X.RDB$DELETE_RULE, sizeof (X.RDB$DELETE_RULE)); GET_TEXT(X.RDB$DELETE_RULE);
break; break;
default: default:
@ -4823,9 +4822,11 @@ SLONG rel_flags, sys_flag;
short rel_flags_null, sys_flag_null; short rel_flags_null, sys_flag_null;
GDS_QUAD view_blr, view_src, rel_desc, ext_desc; GDS_QUAD view_blr, view_src, rel_desc, ext_desc;
USHORT view_blr_null, view_src_null, rel_desc_null, ext_desc_null; USHORT view_blr_null, view_src_null, rel_desc_null, ext_desc_null;
char sec_class[32];
BASED_ON RDB$RELATIONS.RDB$SECURITY_CLASS sec_class;
short sec_class_null; short sec_class_null;
TEXT ext_file_name [253];
BASED_ON RDB$RELATIONS.RDB$EXTERNAL_FILE ext_file_name;
short ext_file_name_null; short ext_file_name_null;
isc_tr_handle local_trans; isc_tr_handle local_trans;
@ -4872,7 +4873,7 @@ while (SKIP_SCAN, GET_ATTRIBUTE (attribute) != att_end)
switch (attribute) switch (attribute)
{ {
case att_relation_name: case att_relation_name:
l = get_text (relation->rel_name, 31); l = GET_TEXT(relation->rel_name);
relation->rel_name_length = l; relation->rel_name_length = l;
MISC_terminate ((UCHAR*) relation->rel_name, (UCHAR*) temp, l, sizeof (temp)); MISC_terminate ((UCHAR*) relation->rel_name, (UCHAR*) temp, l, sizeof (temp));
BURP_verbose (167, temp, NULL_PTR, NULL_PTR, NULL_PTR, NULL_PTR); BURP_verbose (167, temp, NULL_PTR, NULL_PTR, NULL_PTR, NULL_PTR);
@ -4881,7 +4882,7 @@ while (SKIP_SCAN, GET_ATTRIBUTE (attribute) != att_end)
case att_relation_security_class: case att_relation_security_class:
sec_class_null = FALSE; sec_class_null = FALSE;
get_text (sec_class, sizeof (sec_class)); GET_TEXT(sec_class);
break; break;
case att_relation_view_blr: case att_relation_view_blr:
@ -4932,12 +4933,12 @@ while (SKIP_SCAN, GET_ATTRIBUTE (attribute) != att_end)
break; break;
case att_relation_owner_name: case att_relation_owner_name:
get_text (relation->rel_owner, sizeof (relation->rel_owner)); GET_TEXT(relation->rel_owner);
break; break;
case att_relation_ext_file_name: case att_relation_ext_file_name:
ext_file_name_null = FALSE; ext_file_name_null = FALSE;
get_text (ext_file_name, sizeof (ext_file_name)); GET_TEXT(ext_file_name);
break; break;
default: default:
@ -5024,7 +5025,7 @@ while (GET_RECORD (record) != rec_data)
default: default:
#ifdef SUPERSERVER #ifdef SUPERSERVER
BURP_svc_error (43, isc_arg_number, (void *) record, BURP_svc_error (43, isc_arg_number, (void*) record,
0, NULL, 0, NULL, 0, NULL, 0, NULL); 0, NULL, 0, NULL, 0, NULL, 0, NULL);
#else #else
BURP_error (43, (void*) record, 0, 0, 0, 0); BURP_error (43, (void*) record, 0, 0, 0, 0);
@ -5087,32 +5088,32 @@ STORE (REQUEST_HANDLE tdgbl->handles_get_rel_constraint_req_handle1)
{ {
case att_rel_constraint_name: case att_rel_constraint_name:
X.RDB$CONSTRAINT_NAME.NULL = FALSE; X.RDB$CONSTRAINT_NAME.NULL = FALSE;
get_text (X.RDB$CONSTRAINT_NAME, sizeof (X.RDB$CONSTRAINT_NAME)); GET_TEXT(X.RDB$CONSTRAINT_NAME);
break; break;
case att_rel_constraint_type: case att_rel_constraint_type:
X.RDB$CONSTRAINT_TYPE.NULL = FALSE; X.RDB$CONSTRAINT_TYPE.NULL = FALSE;
get_text (X.RDB$CONSTRAINT_TYPE, sizeof (X.RDB$CONSTRAINT_TYPE)); GET_TEXT(X.RDB$CONSTRAINT_TYPE);
break; break;
case att_rel_constraint_rel_name: case att_rel_constraint_rel_name:
X.RDB$RELATION_NAME.NULL = FALSE; X.RDB$RELATION_NAME.NULL = FALSE;
get_text (X.RDB$RELATION_NAME, sizeof (X.RDB$RELATION_NAME)); GET_TEXT(X.RDB$RELATION_NAME);
break; break;
case att_rel_constraint_defer: case att_rel_constraint_defer:
X.RDB$DEFERRABLE.NULL = FALSE; X.RDB$DEFERRABLE.NULL = FALSE;
get_text (X.RDB$DEFERRABLE, sizeof (X.RDB$DEFERRABLE)); GET_TEXT(X.RDB$DEFERRABLE);
break; break;
case att_rel_constraint_init: case att_rel_constraint_init:
X.RDB$INITIALLY_DEFERRED.NULL = FALSE; X.RDB$INITIALLY_DEFERRED.NULL = FALSE;
get_text (X.RDB$INITIALLY_DEFERRED, sizeof (X.RDB$INITIALLY_DEFERRED)); GET_TEXT(X.RDB$INITIALLY_DEFERRED);
break; break;
case att_rel_constraint_index: case att_rel_constraint_index:
X.RDB$INDEX_NAME.NULL = FALSE; X.RDB$INDEX_NAME.NULL = FALSE;
get_text (X.RDB$INDEX_NAME, sizeof (X.RDB$INDEX_NAME)); GET_TEXT(X.RDB$INDEX_NAME);
break; break;
default: default:
@ -5143,7 +5144,7 @@ static BOOLEAN get_relation_data (void)
* *
**************************************/ **************************************/
REL relation; REL relation;
TEXT name [32]; BASED_ON RDB$RELATIONS.RDB$RELATION_NAME name;
SLONG gen_id; SLONG gen_id;
ATT_TYPE attribute; ATT_TYPE attribute;
REC_TYPE record; REC_TYPE record;
@ -5159,7 +5160,7 @@ while (SKIP_SCAN, GET_ATTRIBUTE (attribute) != att_end)
switch (attribute) switch (attribute)
{ {
case att_relation_name: case att_relation_name:
get_text (name, sizeof (name)); GET_TEXT(name);
relation = find_relation (name); relation = find_relation (name);
break; break;
@ -5245,7 +5246,7 @@ STORE (REQUEST_HANDLE tdgbl->handles_get_sql_roles_req_handle1)
{ {
case att_role_name: case att_role_name:
X.RDB$ROLE_NAME.NULL = FALSE; X.RDB$ROLE_NAME.NULL = FALSE;
l = get_text (X.RDB$ROLE_NAME, sizeof (X.RDB$ROLE_NAME)); l = GET_TEXT(X.RDB$ROLE_NAME);
MISC_terminate ((UCHAR*) X.RDB$ROLE_NAME, (UCHAR*) temp, l, sizeof (temp)); MISC_terminate ((UCHAR*) X.RDB$ROLE_NAME, (UCHAR*) temp, l, sizeof (temp));
/************************************************ /************************************************
** **
@ -5258,7 +5259,7 @@ STORE (REQUEST_HANDLE tdgbl->handles_get_sql_roles_req_handle1)
case att_role_owner_name: case att_role_owner_name:
X.RDB$OWNER_NAME.NULL = FALSE; X.RDB$OWNER_NAME.NULL = FALSE;
get_text (X.RDB$OWNER_NAME, sizeof (X.RDB$OWNER_NAME)); GET_TEXT(X.RDB$OWNER_NAME);
break; break;
default: default:
@ -5334,8 +5335,7 @@ STORE (REQUEST_HANDLE tdgbl->handles_get_security_class_req_handle1)
switch (attribute) switch (attribute)
{ {
case att_class_security_class: case att_class_security_class:
l = get_text (X.RDB$SECURITY_CLASS, l = GET_TEXT(X.RDB$SECURITY_CLASS);
sizeof (X.RDB$SECURITY_CLASS));
/* Bug fix for bug_no 7299: There was a V3 bug that inserted /* Bug fix for bug_no 7299: There was a V3 bug that inserted
garbage security class entry when doing GBAK. In order to garbage security class entry when doing GBAK. In order to
@ -5636,7 +5636,7 @@ static BOOLEAN get_trigger (void)
* *
**************************************/ **************************************/
ATT_TYPE attribute; ATT_TYPE attribute;
TEXT name [32]; BASED_ON RDB$TRIGGERS.RDB$TRIGGER_NAME name;
UCHAR scan_next_attr; UCHAR scan_next_attr;
isc_tr_handle local_trans; isc_tr_handle local_trans;
TGBL tdgbl; TGBL tdgbl;
@ -5683,14 +5683,14 @@ STORE (TRANSACTION_HANDLE local_trans
break; break;
case att_trig_name: case att_trig_name:
get_text (X.RDB$TRIGGER_NAME, sizeof (X.RDB$TRIGGER_NAME)); GET_TEXT(X.RDB$TRIGGER_NAME);
strcpy (name, X.RDB$TRIGGER_NAME); strcpy (name, X.RDB$TRIGGER_NAME);
BURP_verbose (126, X.RDB$TRIGGER_NAME, NULL_PTR, NULL_PTR, NULL_PTR, NULL_PTR); BURP_verbose (126, X.RDB$TRIGGER_NAME, NULL_PTR, NULL_PTR, NULL_PTR, NULL_PTR);
/* msg 126 restoring trigger %s */ /* msg 126 restoring trigger %s */
break; break;
case att_trig_relation_name: case att_trig_relation_name:
get_text (X.RDB$RELATION_NAME, sizeof (X.RDB$RELATION_NAME)); GET_TEXT(X.RDB$RELATION_NAME);
break; break;
case att_trig_sequence: case att_trig_sequence:
@ -5779,7 +5779,7 @@ while (SKIP_SCAN, GET_ATTRIBUTE (attribute) != att_end)
switch (attribute) switch (attribute)
{ {
case att_trigmsg_name: case att_trigmsg_name:
get_text (name, sizeof (name)); GET_TEXT(name);
flag = FALSE; flag = FALSE;
FOR (REQUEST_HANDLE tdgbl->handles_get_trigger_message_req_handle1) FOR (REQUEST_HANDLE tdgbl->handles_get_trigger_message_req_handle1)
FIRST 1 X IN RDB$TRIGGERS WITH FIRST 1 X IN RDB$TRIGGERS WITH
@ -5798,7 +5798,7 @@ while (SKIP_SCAN, GET_ATTRIBUTE (attribute) != att_end)
break; break;
case att_trigmsg_text: case att_trigmsg_text:
get_text (message, sizeof (message)); GET_TEXT(message);
break; break;
default: default:
@ -5875,7 +5875,7 @@ STORE (REQUEST_HANDLE tdgbl->handles_get_type_req_handle1)
switch (attribute) switch (attribute)
{ {
case att_type_name: case att_type_name:
l = get_text (X.RDB$TYPE_NAME, sizeof (X.RDB$TYPE_NAME)); l = GET_TEXT(X.RDB$TYPE_NAME);
break; break;
case att_type_type: case att_type_type:
@ -5883,7 +5883,7 @@ STORE (REQUEST_HANDLE tdgbl->handles_get_type_req_handle1)
break; break;
case att_type_field_name: case att_type_field_name:
get_text (X.RDB$FIELD_NAME, sizeof (X.RDB$FIELD_NAME)); GET_TEXT(X.RDB$FIELD_NAME);
break; break;
case att_type_description: case att_type_description:
@ -5961,19 +5961,19 @@ while (SKIP_SCAN, GET_ATTRIBUTE (attribute) != att_end)
case att_priv_user: case att_priv_user:
/* default USER_TYPE to USER */ /* default USER_TYPE to USER */
flags |= USER_PRIV_USER; flags |= USER_PRIV_USER;
get_text (user, sizeof (user)); GET_TEXT(user);
BURP_verbose (123, user, NULL_PTR, NULL_PTR, NULL_PTR, NULL_PTR); BURP_verbose (123, user, NULL_PTR, NULL_PTR, NULL_PTR, NULL_PTR);
/* msg 123 restoring privilege for user %s */ /* msg 123 restoring privilege for user %s */
break; break;
case att_priv_grantor: case att_priv_grantor:
flags |= USER_PRIV_GRANTOR; flags |= USER_PRIV_GRANTOR;
get_text (grantor, sizeof (grantor)); GET_TEXT(grantor);
break; break;
case att_priv_privilege: case att_priv_privilege:
flags |= USER_PRIV_PRIVILEGE; flags |= USER_PRIV_PRIVILEGE;
get_text (privilege, sizeof (privilege)); GET_TEXT(privilege);
break; break;
case att_priv_grant_option: case att_priv_grant_option:
@ -5984,12 +5984,12 @@ while (SKIP_SCAN, GET_ATTRIBUTE (attribute) != att_end)
case att_priv_object_name: case att_priv_object_name:
flags |= USER_PRIV_OBJECT_NAME; flags |= USER_PRIV_OBJECT_NAME;
/* default OBJECT_TYPE to RELATION */ /* default OBJECT_TYPE to RELATION */
get_text (relation_name, sizeof (relation_name)); GET_TEXT(relation_name);
break; break;
case att_priv_field_name: case att_priv_field_name:
flags |= USER_PRIV_FIELD_NAME; flags |= USER_PRIV_FIELD_NAME;
get_text (field_name, sizeof (field_name)); GET_TEXT(field_name);
break; break;
case att_priv_user_type: case att_priv_user_type:
@ -6163,11 +6163,11 @@ STORE (TRANSACTION_HANDLE local_trans
switch (attribute) switch (attribute)
{ {
case att_view_relation_name: case att_view_relation_name:
get_text (X.RDB$RELATION_NAME, sizeof (X.RDB$RELATION_NAME)); GET_TEXT(X.RDB$RELATION_NAME);
break; break;
case att_view_context_name: case att_view_context_name:
get_text (X.RDB$CONTEXT_NAME, sizeof (X.RDB$CONTEXT_NAME)); GET_TEXT(X.RDB$CONTEXT_NAME);
break; break;
case att_view_context_id: case att_view_context_id:
@ -6581,7 +6581,7 @@ flag = FALSE;
if (tdgbl->RESTORE_format < 1 || tdgbl->RESTORE_format > ATT_BACKUP_FORMAT) if (tdgbl->RESTORE_format < 1 || tdgbl->RESTORE_format > ATT_BACKUP_FORMAT)
#ifdef SUPERSERVER #ifdef SUPERSERVER
BURP_svc_error (44, isc_arg_number, tdgbl->RESTORE_format, BURP_svc_error (44, isc_arg_number, (void*)tdgbl->RESTORE_format,
0, NULL, 0, NULL, 0, NULL, 0, NULL); 0, NULL, 0, NULL, 0, NULL, 0, NULL);
#else #else
BURP_error (44, (void*) tdgbl->RESTORE_format, 0, 0, 0, 0); BURP_error (44, (void*) tdgbl->RESTORE_format, 0, 0, 0, 0);
@ -6604,7 +6604,7 @@ EXEC SQL SET TRANSACTION NAME tdgbl->global_trans ISOLATION LEVEL READ COMMITTED
db_version = check_db_version(); db_version = check_db_version();
if (db_version < DB_VERSION_CURRENT) if (db_version < DB_VERSION_CURRENT)
#ifdef SUPERSERVER #ifdef SUPERSERVER
BURP_svc_error (51, isc_arg_number, db_version, BURP_svc_error (51, isc_arg_number, (void*)db_version,
0, NULL, 0, NULL, 0, NULL, 0, NULL); 0, NULL, 0, NULL, 0, NULL, 0, NULL);
#else #else
BURP_error (51, (void*) db_version, 0, 0, 0, 0); BURP_error (51, (void*) db_version, 0, 0, 0, 0);
@ -6622,7 +6622,7 @@ while (GET_ATTRIBUTE (attribute) != att_end)
just store the value in tdgbl. It will be updated at just store the value in tdgbl. It will be updated at
the very end to prevent security class validation the very end to prevent security class validation
failures during change table ownership operation */ failures during change table ownership operation */
get_text(tdgbl->database_security_class, sizeof(tdgbl->database_security_class)); GET_TEXT(tdgbl->database_security_class);
break; break;
case att_database_description: case att_database_description:
@ -6648,7 +6648,7 @@ while (GET_ATTRIBUTE (attribute) != att_end)
FOR (REQUEST_HANDLE req_handle3) FOR (REQUEST_HANDLE req_handle3)
X IN RDB$DATABASE X IN RDB$DATABASE
MODIFY X USING MODIFY X USING
get_text (X.RDB$CHARACTER_SET_NAME, sizeof (X.RDB$CHARACTER_SET_NAME)); GET_TEXT(X.RDB$CHARACTER_SET_NAME);
END_MODIFY; END_MODIFY;
ON_ERROR ON_ERROR
general_on_error (); general_on_error ();
@ -6823,7 +6823,7 @@ while (GET_RECORD (record) != rec_end)
default: default:
#ifdef SUPERSERVER #ifdef SUPERSERVER
BURP_svc_error (43, isc_arg_number, (void *) record, BURP_svc_error (43, isc_arg_number, (void*) record,
0, NULL, 0, NULL, 0, NULL, 0, NULL); 0, NULL, 0, NULL, 0, NULL, 0, NULL);
#else #else
BURP_error (43, (void*) record, 0, 0, 0, 0); BURP_error (43, (void*) record, 0, 0, 0, 0);

View File

@ -46,7 +46,8 @@
#endif #endif
#ifdef WIN_NT #ifdef WIN_NT
#include <io.h> /* usage of non-ANSI open/read/write/close functions */ // usage of non-ANSI open/read/write/close functions
#include <io.h>
#endif #endif
#define MODE_READ O_RDONLY #define MODE_READ O_RDONLY
@ -1088,7 +1089,7 @@ SLONG cnt, SLONG * total_int)
break; break;
default: default:
assert(write_cnt == read_cnt); gds_assert(write_cnt == read_cnt);
break; break;
} }

View File

@ -434,7 +434,7 @@ typedef SLONG HANDLE;
/* Block types */ /* Block types */
#ifndef INCLUDE_FB_BLK #ifndef INCLUDE_FB_BLK
#include "../include/fb_blk.h" #include "../include/old_fb_blk.h"
#endif #endif
#define type_rdb 10 #define type_rdb 10

View File

@ -21,7 +21,7 @@
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
*/ */
/* /*
$Id: csu.cpp,v 1.2 2001-07-29 23:43:21 skywalker Exp $ $Id: csu.cpp,v 1.3 2001-12-24 02:50:48 tamlin Exp $
*/ */
#include "firebird.h" #include "firebird.h"

View File

@ -21,7 +21,7 @@
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
*/ */
/* /*
$Id: csv.cpp,v 1.2 2001-07-29 23:43:21 skywalker Exp $ $Id: csv.cpp,v 1.3 2001-12-24 02:50:48 tamlin Exp $
*/ */
#include "firebird.h" #include "firebird.h"

View File

@ -21,20 +21,29 @@
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
*/ */
#include "../dsql/dsql.h" #ifndef DSQL_ALL_H
#define DSQL_ALL_H
/* alloc and init a block from a pool */ #include "../common/memory/memory_pool.h"
BLK ALLD_alloc(PLB pool, UCHAR type, int count); #include "../common/memory/allocators.h"
#include "../jrd/block_cache.h"
/* extend a block by given size */ void ALLD_init(); /* initialize pool system */
BLK ALLD_extend(BLK* pointer, int size); void ALLD_fini(); /* get rid of everything */
int ALLD_fini(); /* get rid of everything */ class DsqlMemoryPool : public MemoryPool
int ALLD_free(void* memory); /* give space back to system */ {
int ALLD_init(); /* initialize pool system */ public:
void* ALLD_malloc(int size); /* get memory from system */ DsqlMemoryPool(int extSize = 0, MemoryPool& p = *FB_MemoryPool);
PLB ALLD_pool(); /* allocate a new pool */ ~DsqlMemoryPool();
int ALLD_push(BLK object, LLS * stack); /* push object on LLS stack */
BLK ALLD_pop(LLS* stack); /* pop object off LLS stack */ static class blk* ALLD_pop(class dsql_lls**);
int ALLD_release(FRB block); /* release a block to its pool */ static void ALLD_push(class blk*, class dsql_lls**);
int ALLD_rlpool(PLB pool); /* release a pool */
private:
BlockCache<class dsql_lls> lls_cache; /* Was plb_lls */
};
extern DsqlMemoryPool *DSQL_permanent_pool;
#endif // DSQL_ALL_H

File diff suppressed because it is too large Load Diff

View File

@ -24,24 +24,6 @@
#ifndef _DSQL_ALLD_PROTO_H_ #ifndef _DSQL_ALLD_PROTO_H_
#define _DSQL_ALLD_PROTO_H_ #define _DSQL_ALLD_PROTO_H_
#ifdef __cplusplus #include "../dsql/all.h"
extern "C" {
#endif
BLK ALLD_alloc(struct plb*, UCHAR, ULONG);
BLK ALLD_extend(struct blk**, ULONG);
void ALLD_fini(void);
void ALLD_free(void*);
USHORT ALLD_init(void);
void* ALLD_malloc(ULONG);
PLB ALLD_pool(void);
BLK ALLD_pop(register struct lls**);
void ALLD_push(struct blk*, register struct lls**);
void ALLD_release(register struct frb*);
void ALLD_rlpool(struct plb*);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* _DSQL_ALLD_PROTO_H_ */ #endif /* _DSQL_ALLD_PROTO_H_ */

View File

@ -1,6 +1,6 @@
/* /*
* PROGRAM: Interbase layered support library * PROGRAM: Interbase layered support library
* MODULE: array.e * MODULE: array.epp
* DESCRIPTION: Dynamic array support * DESCRIPTION: Dynamic array support
* *
* The contents of this file are subject to the Interbase Public * The contents of this file are subject to the Interbase Public
@ -152,7 +152,7 @@ STATUS API_ROUTINE isc_array_lookup_bounds(STATUS * status,
++tail; ++tail;
END_FOR END_FOR
ON_ERROR ON_ERROR
return copy_status(gds__status, status); return copy_status(gds_status, status);
END_ERROR; END_ERROR;
return status[1]; return status[1];
@ -490,7 +490,7 @@ SCHAR * relation_name, ISC_ARRAY_DESC * desc, SCHAR * global)
RELEASE_REQUESTS; RELEASE_REQUESTS;
DB = *db_handle; DB = *db_handle;
gds__trans = *trans_handle; gds_trans = *trans_handle;
get_name(field_name, desc->array_desc_field_name); get_name(field_name, desc->array_desc_field_name);
get_name(relation_name, desc->array_desc_relation_name); get_name(relation_name, desc->array_desc_relation_name);
desc->array_desc_flags = 0; desc->array_desc_flags = 0;
@ -511,7 +511,7 @@ SCHAR * relation_name, ISC_ARRAY_DESC * desc, SCHAR * global)
get_name(Y.RDB$FIELD_NAME, global); get_name(Y.RDB$FIELD_NAME, global);
END_FOR END_FOR
ON_ERROR ON_ERROR
return copy_status(gds__status, status); return copy_status(gds_status, status);
END_ERROR; END_ERROR;
if (!flag) if (!flag)

View File

@ -21,29 +21,25 @@
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
*/ */
BLKDEF(type_ctx, ctx, 0) BLKDEF(dsql_type_ctx, ctx, 0)
BLKDEF(type_par, par, 0) BLKDEF(dsql_type_par, par, 0)
BLKDEF(type_map, map, 0) BLKDEF(dsql_type_map, map, 0) /* Unique */
BLKDEF(type_req, req, 0) BLKDEF(dsql_type_req, req, 0)
BLKDEF(type_dbb, dbb, 0) BLKDEF(dsql_type_dbb, dbb, 0)
BLKDEF(type_dsql_rel, dsql_rel, 1) BLKDEF(dsql_type_dsql_rel, dsql_rel, 1)
BLKDEF(type_fld, fld, 1) BLKDEF(dsql_type_fld, fld, 1)
BLKDEF(type_fil, fil, 0) BLKDEF(dsql_type_fil, fil, 0)
BLKDEF(type_nod, nod, sizeof(((NOD) 0)->nod_arg[0])) BLKDEF(dsql_type_nod, nod, sizeof(((NOD) 0)->nod_arg[0]))
BLKDEF(type_msg, msg, 0) BLKDEF(dsql_type_msg, msg, 0)
BLKDEF(type_frb, frb, 0) BLKDEF(dsql_type_lls, dsql_lls, 0) /* linked list stack */
BLKDEF(type_hnk, hnk, 0) BLKDEF(dsql_type_str, str, 1) /* random string block */
BLKDEF(type_plb, plb, 0) BLKDEF(dsql_type_sym, sym, 1) /* symbol block */
BLKDEF(type_vec, vec, sizeof(((VEC) 0)->vec_object[0])) BLKDEF(dsql_type_err, err, 0)
BLKDEF(type_vcl, vcl, sizeof(((VCL) 0)->vcl_long[0])) BLKDEF(dsql_type_opn, opn, 0)
BLKDEF(type_lls, lls, 0) /* linked list stack */ BLKDEF(dsql_type_tra, tra, 0)
BLKDEF(type_str, str, 1) /* random string block */ BLKDEF(dsql_type_udf, udf, 1)
BLKDEF(type_sym, sym, 1) /* symbol block */ BLKDEF(dsql_type_var, var, 1)
BLKDEF(type_err, err, 0) BLKDEF(dsql_type_blb, blb, 0)
BLKDEF(type_opn, opn, 0) BLKDEF(dsql_type_prc, prc, 1)
BLKDEF(type_tra, tra, 0) BLKDEF(dsql_type_intlsym, intlsym, 1)
BLKDEF(type_udf, udf, 1) BLKDEF(dsql_type_vec, vec, 0)
BLKDEF(type_var, var, 1)
BLKDEF(type_blb, blb, 0)
BLKDEF(type_prc, prc, 1)
BLKDEF(type_intlsym, intlsym, 1)

View File

@ -1,6 +1,6 @@
/* /*
* PROGRAM: InterBase layered support library * PROGRAM: InterBase layered support library
* MODULE: blob.e * MODULE: blob.epp
* DESCRIPTION: Dynamic blob support * DESCRIPTION: Dynamic blob support
* *
* The contents of this file are subject to the Interbase Public * The contents of this file are subject to the Interbase Public
@ -142,7 +142,7 @@ STATUS API_ROUTINE isc_blob_lookup_desc(STATUS * status,
RELEASE_REQUESTS; RELEASE_REQUESTS;
DB = *db_handle; DB = *db_handle;
gds__trans = *trans_handle; gds_trans = *trans_handle;
get_name(field_name, desc->blob_desc_field_name); get_name(field_name, desc->blob_desc_field_name);
get_name(relation_name, desc->blob_desc_relation_name); get_name(relation_name, desc->blob_desc_relation_name);
@ -159,7 +159,7 @@ STATUS API_ROUTINE isc_blob_lookup_desc(STATUS * status,
if (global) if (global)
get_name((UCHAR *) Y.RDB$FIELD_NAME, global); get_name((UCHAR *) Y.RDB$FIELD_NAME, global);
END_FOR ON_ERROR return copy_status(gds__status, status); END_FOR ON_ERROR return copy_status(gds_status, status);
END_ERROR; END_ERROR;
if (!flag) if (!flag)

File diff suppressed because it is too large Load Diff

View File

@ -24,18 +24,11 @@
#ifndef _DSQL_DDL_PROTO_H_ #ifndef _DSQL_DDL_PROTO_H_
#define _DSQL_DDL_PROTO_H_ #define _DSQL_DDL_PROTO_H_
#ifdef __cplusplus void DDL_execute(class req*);
extern "C" { void DDL_generate(class req*, struct nod*);
#endif int DDL_ids(class req*);
void DDL_put_field_dtype(class req*, class fld*, USHORT);
void DDL_resolve_intl_type(class req*, class fld*, class str*);
void DDL_execute(struct req *);
void DDL_generate(struct req *, struct nod *);
int DDL_ids(struct req *);
void DDL_put_field_dtype(struct req *, struct fld *, USHORT);
void DDL_resolve_intl_type(struct req *, struct fld *, struct str *);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* _DSQL_DDL_PROTO_H_ */ #endif /* _DSQL_DDL_PROTO_H_ */

File diff suppressed because it is too large Load Diff

View File

@ -27,144 +27,98 @@
#include "../jrd/ibsetjmp.h" #include "../jrd/ibsetjmp.h"
#include "../jrd/common.h" #include "../jrd/common.h"
#include "../dsql/all.h"
#include <vector>
/* Dynamic SQL Error Status Block */ // Dynamic SQL Error Status Block
typedef struct err { struct err
STATUS *dsql_status; {
STATUS *dsql_user_status; STATUS* dsql_status;
JMP_BUF dsql_env; /* Error return environment */ STATUS* dsql_user_status;
} *ERR; JMP_BUF dsql_env; // Error return environment
};
typedef err* ERR;
/* macros for block allocation */
#define ALL_release(blk) ALLD_release (blk) // this table is used in data allocation to determine
#define ALLOCD(type) ALLD_alloc (tdsql->tsql_default, type, 0) // whether a block has a variable length tail
#define ALLOCDV(type,repeat) ALLD_alloc (tdsql->tsql_default, type, repeat)
#define ALLOCP(type) ALLD_alloc (DSQL_permanent_pool, type, 0)
#define ALLOCPV(type,repeat) ALLD_alloc (DSQL_permanent_pool, type, repeat)
#define ALLOC(type,pool) ALLD_alloc (pool, type, 0)
#define ALLOCV(type,pool,repeat) ALLD_alloc (pool, type, repeat)
/* this table is used in data allocation to determine
whether a block has a variable length tail */
#define BLKDEF(type, root, tail) type, #define BLKDEF(type, root, tail) type,
ENUM blk_t { ENUM blk_t {
type_MIN = 0, dsql_type_MIN = 0,
#include "../dsql/blk.h" #include "../dsql/blk.h"
type_MAX}; dsql_type_MAX};
#undef BLKDEF #undef BLKDEF
/* generic block used as header to all allocated structures */ // generic block used as header to all allocated structures
#ifndef INCLUDE_FB_BLK #ifndef INCLUDE_FB_BLK
#include "../include/fb_blk.h" #include "../include/fb_blk.h"
#endif #endif
/* aggregate blocks to store vectors of objects */ // generic data type used to store strings
typedef struct vec { class str : public pool_alloc_rpt<SCHAR, dsql_type_str>
struct blk vec_header;
ULONG vec_count;
struct blk *vec_object[1];
} *VEC;
typedef struct vcl {
struct blk vcl_header;
ULONG vcl_count;
SLONG vcl_long[1];
} *VCL;
/* generic structure used to store strings */
typedef struct str
{ {
struct blk str_header; public:
TEXT* str_charset; /* ASCIIZ Character set identifier for string */ TEXT* str_charset; // ASCIIZ Character set identifier for string
USHORT str_flags; USHORT str_flags;
USHORT str_length; /* length of string in BYTES */ USHORT str_length; // length of string in BYTES
UCHAR str_data[2]; /* one for ALLOC and one for the NULL */ UCHAR str_data[2]; // one for ALLOC and one for the NULL
} *STR; };
typedef str* STR;
/* values used in str_flags */ // values used in str_flags
#define STR_delimited_id 0x1L #define STR_delimited_id 0x1L
/* macros and block used to implement a generic stack mechanism */ // macros and block used to implement a generic stack mechanism
#define LLS_PUSH(object,stack) ALLD_push ((BLK) object, stack) class dsql_lls : public pool_alloc<dsql_type_lls>
#define LLS_POP(stack) ALLD_pop (stack) {
public:
blk* lls_object;
dsql_lls* lls_next;
};
typedef dsql_lls* DLLS;
typedef struct lls { #define LLS_PUSH(object,stack) DsqlMemoryPool::ALLD_push ((BLK) object, stack)
struct blk lls_header; #define LLS_POP(stack) DsqlMemoryPool::ALLD_pop (stack)
struct blk *lls_object;
struct lls *lls_next;
} *LLS;
/* blocks used internally to the data allocator */
/* free block used to point to an unused block */
typedef struct frb {
struct blk frb_header;
struct frb *frb_next; /* Next free block in pool */
} *FRB;
/* Pool block used to store a set of blocks to be treated as an aggregate */
typedef struct plb {
struct blk plb_header;
USHORT plb_pool_id; /* pool id */
struct frb *plb_free; /* first free block */
struct hnk *plb_hunks; /* first hunk block */
struct lls *plb_lls; /* available linked list stack nodes */
SLONG *plb_blk_type_count; /* array to keep track of block types */
} *PLB;
/* Hunk blocks, used to allow dynamic expansion of an allocated pool */
typedef struct hnk {
struct blk hnk_header;
UCHAR *hnk_address; /* start of memory hunk */
int hnk_length; /* length of memory hunk */
struct hnk *hnk_next; /* next memory hunk in structure */
} *HNK;
/*====================================================================== //======================================================================
remaining node definitions for local processing // remaining node definitions for local processing
*/ //
/* Include definition of descriptor */ /// Include definition of descriptor
#include "../jrd/dsc.h" #include "../jrd/dsc.h"
/* internal DSQL requests */ // internal DSQL requests
#if 0 #if 0
#define irq_relation 0 /* lookup a relation */ #define irq_relation 0 // lookup a relation
#define irq_fields 1 /* lookup a relation's fields */ #define irq_fields 1 // lookup a relation's fields
#define irq_dimensions 2 /* lookup a field's dimensions */ #define irq_dimensions 2 // lookup a field's dimensions
#define irq_primary_key 3 /* lookup a primary key */ #define irq_primary_key 3 // lookup a primary key
#define irq_view 4 /* lookup a view's base relations */ #define irq_view 4 // lookup a view's base relations
#define irq_function 5 /* lookup a user defined function */ #define irq_function 5 // lookup a user defined function
#define irq_func_return 6 /* lookup a function's return argument */ #define irq_func_return 6 // lookup a function's return argument
#define irq_procedure 7 /* lookup a stored procedure */ #define irq_procedure 7 // lookup a stored procedure
#define irq_parameters 8 /* lookup a procedure's parameters */ #define irq_parameters 8 // lookup a procedure's parameters
#define irq_collation 9 /* lookup a collation name */ #define irq_collation 9 // lookup a collation name
#define irq_charset 10 /* lookup a character set name */ #define irq_charset 10 // lookup a character set name
#define irq_trigger 11 /* lookup a trigger */ #define irq_trigger 11 // lookup a trigger
#define irq_domain 12 /* lookup a domain */ #define irq_domain 12 // lookup a domain
#define irq_type 13 /* lookup a symbolic name in RDB$TYPES */ #define irq_type 13 // lookup a symbolic name in RDB$TYPES
#define irq_col_default 14 /* lookup default for a column */ #define irq_col_default 14 // lookup default for a column
#define irq_domain_2 15 /* lookup a domain */ #define irq_domain_2 15 // lookup a domain
#define irq_MAX 16 #define irq_MAX 16
@ -194,130 +148,143 @@ enum irq_type_t {
#endif #endif
/* blocks used to cache metadata */ // blocks used to cache metadata
typedef struct dbb { /* Database Block */ // Database Block
struct blk dbb_header; class dbb : public pool_alloc<dsql_type_dbb>
struct dbb *dbb_next; {
struct dsql_rel *dbb_relations; /* known relations in database */ public:
struct prc *dbb_procedures; /* known procedures in database */ dbb* dbb_next;
struct udf *dbb_functions; /* known functions in database */ class dsql_rel* dbb_relations; // known relations in database
struct plb *dbb_pool; class prc* dbb_procedures; // known procedures in database
SLONG *dbb_database_handle; class udf* dbb_functions; // known functions in database
SLONG *dbb_requests[irq_MAX]; DsqlMemoryPool* dbb_pool; // The current pool for the dbb
struct str *dbb_dfl_charset; SLONG* dbb_database_handle;
USHORT dbb_base_level; /* indicates the version of the engine code itself */ SLONG* dbb_requests[irq_MAX];
str* dbb_dfl_charset;
USHORT dbb_base_level; // indicates the version of the engine code itself
USHORT dbb_flags; USHORT dbb_flags;
USHORT dbb_db_SQL_dialect; USHORT dbb_db_SQL_dialect;
SSHORT dbb_att_charset; /* characterset at time of attachment */ SSHORT dbb_att_charset; // characterset at time of attachment
} *DBB; };
typedef dbb* DBB;
/* values used in dbb_flags */ // values used in dbb_flags
#define DBB_no_arrays 0x1 #define DBB_no_arrays 0x1
#define DBB_v3 0x2 #define DBB_v3 0x2
#define DBB_no_charset 0x4 #define DBB_no_charset 0x4
#define DBB_read_only 0x8 #define DBB_read_only 0x8
typedef struct dsql_rel /* Relation block */ // Relation block
class dsql_rel : public pool_alloc_rpt<SCHAR, dsql_type_dsql_rel>
{ {
struct blk rel_header; public:
struct dsql_rel* rel_next; /* Next relation in database */ dsql_rel* rel_next; // Next relation in database
struct sym* rel_symbol; /* Hash symbol for relation */ struct sym* rel_symbol; // Hash symbol for relation
struct fld* rel_fields; /* Field block */ class fld* rel_fields; // Field block
struct dsql_rel* rel_base_relation; /* base relation for an updatable view */ dsql_rel* rel_base_relation; // base relation for an updatable view
TEXT* rel_name; /* Name of relation */ TEXT* rel_name; // Name of relation
TEXT* rel_owner; /* Owner of relation */ TEXT* rel_owner; // Owner of relation
USHORT rel_id; /* Relation id */ USHORT rel_id; // Relation id
USHORT rel_dbkey_length; USHORT rel_dbkey_length;
USHORT rel_flags; USHORT rel_flags;
TEXT rel_data[3]; TEXT rel_data[3];
} *DSQL_REL; };
typedef dsql_rel* DSQL_REL;
/* rel_flags bits */ // rel_flags bits
#define REL_new_relation 1 /* relation is newly defined, not committed yet */ #define REL_new_relation 1 // relation is newly defined, not committed yet
#define REL_dropped 2 /* relation has been dropped */ #define REL_dropped 2 // relation has been dropped
typedef struct fld /* Field block */ class fld : public pool_alloc_rpt<SCHAR, dsql_type_fld>
{ {
struct blk fld_header; public:
struct fld* fld_next; /* Next field in relation */ fld* fld_next; // Next field in relation
struct dsql_rel* fld_relation; /* Parent relation */ dsql_rel* fld_relation; // Parent relation
struct prc* fld_procedure; /* Parent procedure */ class prc* fld_procedure; // Parent procedure
struct nod* fld_ranges; /* ranges for multi dimension array */ struct nod* fld_ranges; // ranges for multi dimension array
struct nod* fld_character_set; /* null means not specified */ struct nod* fld_character_set; // null means not specified
struct nod* fld_sub_type_name; /* Subtype name for later resolution */ struct nod* fld_sub_type_name; // Subtype name for later resolution
USHORT fld_flags; USHORT fld_flags;
USHORT fld_id; /* Field in in database */ USHORT fld_id; // Field in in database
USHORT fld_dtype; /* Data type of field */ USHORT fld_dtype; // Data type of field
FLD_LENGTH fld_length; /* Length of field */ FLD_LENGTH fld_length; // Length of field
USHORT fld_element_dtype; /* Data type of array element */ USHORT fld_element_dtype; // Data type of array element
USHORT fld_element_length; /* Length of array element */ USHORT fld_element_length; // Length of array element
SSHORT fld_scale; /* Scale factor of field */ SSHORT fld_scale; // Scale factor of field
SSHORT fld_sub_type; /* Subtype for text & blob fields */ SSHORT fld_sub_type; // Subtype for text & blob fields
USHORT fld_precision; /* Precision for exact numeric types */ USHORT fld_precision; // Precision for exact numeric types
USHORT fld_character_length; /* length of field in characters */ USHORT fld_character_length; // length of field in characters
USHORT fld_seg_length; /* Segment length for blobs */ USHORT fld_seg_length; // Segment length for blobs
SSHORT fld_dimensions; /* Non-zero means array */ SSHORT fld_dimensions; // Non-zero means array
SSHORT fld_character_set_id; /* ID of field's character set */ SSHORT fld_character_set_id; // ID of field's character set
SSHORT fld_collation_id; /* ID of field's collation */ SSHORT fld_collation_id; // ID of field's collation
SSHORT fld_ttype; /* ID of field's language_driver */ SSHORT fld_ttype; // ID of field's language_driver
TEXT fld_name[2]; TEXT fld_name[2];
} *FLD; };
typedef fld* FLD;
/* values used in fld_flags */ // values used in fld_flags
#define FLD_computed 1 #define FLD_computed 1
#define FLD_drop 2 #define FLD_drop 2
#define FLD_dbkey 4 #define FLD_dbkey 4
#define FLD_national 8 /* field uses NATIONAL character set */ #define FLD_national 8 // field uses NATIONAL character set
#define FLD_nullable 16 #define FLD_nullable 16
#define MAX_ARRAY_DIMENSIONS 16 /* max array dimensions */ #define MAX_ARRAY_DIMENSIONS 16 // max array dimensions
/* database/log/cache file block */ // database/log/cache file block
typedef struct fil { class fil : public pool_alloc<dsql_type_fil>
struct blk fil_header; {
SLONG fil_length; /* File length in pages */ public:
SLONG fil_start; /* Starting page */ SLONG fil_length; // File length in pages
struct str *fil_name; /* File name */ SLONG fil_start; // Starting page
struct fil *fil_next; /* next file */ str* fil_name; // File name
SSHORT fil_shadow_number; /* shadow number if part of shadow */ fil* fil_next; // next file
SSHORT fil_manual; /* flag to indicate manual shadow */ SSHORT fil_shadow_number; // shadow number if part of shadow
SSHORT fil_partitions; /* number of log file partitions */ SSHORT fil_manual; // flag to indicate manual shadow
SSHORT fil_partitions; // number of log file partitions
USHORT fil_flags; USHORT fil_flags;
} *FIL; };
typedef fil* FIL;
/* Stored Procedure block */ // Stored Procedure block
typedef struct prc { /* Relation block */ // Relation block
struct blk prc_header; class prc : public pool_alloc_rpt<SCHAR, dsql_type_prc>
struct prc *prc_next; /* Next relation in database */ {
struct sym *prc_symbol; /* Hash symbol for procedure */ public:
struct fld *prc_inputs; /* Input parameters */ prc* prc_next; // Next relation in database
struct fld *prc_outputs; /* Output parameters */ struct sym* prc_symbol; // Hash symbol for procedure
TEXT *prc_name; /* Name of procedure */ fld* prc_inputs; // Input parameters
TEXT *prc_owner; /* Owner of procedure */ fld* prc_outputs; // Output parameters
TEXT* prc_name; // Name of procedure
TEXT* prc_owner; // Owner of procedure
SSHORT prc_in_count; SSHORT prc_in_count;
SSHORT prc_out_count; SSHORT prc_out_count;
USHORT prc_id; /* Procedure id */ USHORT prc_id; // Procedure id
USHORT prc_flags; USHORT prc_flags;
TEXT prc_data[3]; TEXT prc_data[3];
} *PRC; };
typedef prc* PRC;
/* prc_flags bits */ // prc_flags bits
#define PRC_new_procedure 1 /* procedure is newly defined, not committed yet */ #define PRC_new_procedure 1 // procedure is newly defined, not committed yet
#define PRC_dropped 2 /* procedure has been dropped */ #define PRC_dropped 2 // procedure has been dropped
/* User defined function block */ // User defined function block
typedef struct udf { class udf : public pool_alloc_rpt<SCHAR, dsql_type_udf>
struct blk udf_header; {
struct udf *udf_next; public:
struct sym *udf_symbol; /* Hash symbol for udf */ udf* udf_next;
struct sym* udf_symbol; // Hash symbol for udf
USHORT udf_dtype; USHORT udf_dtype;
SSHORT udf_scale; SSHORT udf_scale;
SSHORT udf_sub_type; SSHORT udf_sub_type;
@ -325,118 +292,155 @@ typedef struct udf {
SSHORT udf_character_set_id; SSHORT udf_character_set_id;
USHORT udf_character_length; USHORT udf_character_length;
TEXT udf_name[2]; TEXT udf_name[2];
} *UDF; };
typedef udf* UDF;
/* these values are multiplied by -1 to indicate that server frees them // these values are multiplied by -1 to indicate that server frees them
on return from the udf */ // on return from the udf
typedef ENUM { enum FUN_T
{
FUN_value, FUN_value,
FUN_reference, FUN_reference,
FUN_descriptor, FUN_blob_struct, FUN_scalar_array} FUN_T; FUN_descriptor,
FUN_blob_struct,
FUN_scalar_array
};
/* Variables - input, output & local */ // Variables - input, output & local
typedef struct var { /* Variable block */ // Variable block
struct blk var_header; class var : public pool_alloc_rpt<SCHAR, dsql_type_var>
struct fld *var_field; /* Field on which variable is based */ {
public:
fld* var_field; // Field on which variable is based
USHORT var_flags; USHORT var_flags;
USHORT var_msg_number; /* Message number containing variable */ USHORT var_msg_number; // Message number containing variable
USHORT var_msg_item; /* Item number in message */ USHORT var_msg_item; // Item number in message
USHORT var_variable_number; /* Local variable number */ USHORT var_variable_number; // Local variable number
TEXT var_name[2]; TEXT var_name[2];
} *VAR; };
typedef var* VAR;
/* values used in var_flags */ // values used in var_flags
#define VAR_input 1 #define VAR_input 1
#define VAR_output 2 #define VAR_output 2
#define VAR_local 4 #define VAR_local 4
/* Symbolic names for international text types */ // Symbolic names for international text types
/* (either collation or character set name) */ // (either collation or character set name)
typedef struct intlsym { /* International symbol */ // International symbol
struct blk intlsym_header; class intlsym : public pool_alloc_rpt<SCHAR, dsql_type_intlsym>
struct sym *intlsym_symbol; /* Hash symbol for intlsym */ {
USHORT intlsym_type; /* what type of name */ public:
struct sym* intlsym_symbol; // Hash symbol for intlsym
USHORT intlsym_type; // what type of name
USHORT intlsym_flags; USHORT intlsym_flags;
SSHORT intlsym_ttype; /* id of implementation */ SSHORT intlsym_ttype; // id of implementation
SSHORT intlsym_charset_id; SSHORT intlsym_charset_id;
SSHORT intlsym_collate_id; SSHORT intlsym_collate_id;
USHORT intlsym_bytes_per_char; USHORT intlsym_bytes_per_char;
TEXT intlsym_name[2]; TEXT intlsym_name[2];
} *INTLSYM; };
typedef intlsym* INTLSYM;
/* values used in intlsym_type */ // values used in intlsym_type
#define INTLSYM_collation 1 #define INTLSYM_collation 1
#define INTLSYM_charset 2 #define INTLSYM_charset 2
/* values used in intlsym_flags */ // values used in intlsym_flags
/* Request information */ // Request information
typedef enum { enum REQ_TYPE
{
REQ_SELECT, REQ_SELECT_UPD, REQ_INSERT, REQ_DELETE, REQ_UPDATE, REQ_SELECT, REQ_SELECT_UPD, REQ_INSERT, REQ_DELETE, REQ_UPDATE,
REQ_UPDATE_CURSOR, REQ_DELETE_CURSOR, REQ_UPDATE_CURSOR, REQ_DELETE_CURSOR,
REQ_COMMIT, REQ_ROLLBACK, REQ_DDL, REQ_EMBED_SELECT, REQ_COMMIT, REQ_ROLLBACK, REQ_DDL, REQ_EMBED_SELECT,
REQ_START_TRANS, REQ_GET_SEGMENT, REQ_PUT_SEGMENT, REQ_EXEC_PROCEDURE, REQ_START_TRANS, REQ_GET_SEGMENT, REQ_PUT_SEGMENT, REQ_EXEC_PROCEDURE,
REQ_COMMIT_RETAIN, REQ_SET_GENERATOR REQ_COMMIT_RETAIN, REQ_SET_GENERATOR
} REQ_TYPE; };
typedef struct req {
struct blk req_header; class req : public pool_alloc<dsql_type_req>
struct req *req_parent; /* Source request, if cursor update */ {
struct req *req_sibling; /* Next sibling request, if cursor update */ public:
struct req *req_offspring; /* Cursor update requests */ // begin - member functions that should be private
struct plb *req_pool; inline void append_uchar(UCHAR byte);
struct lls *req_context; inline void append_ushort(USHORT val);
struct sym *req_name; /* Name of request */ inline void append_ulong(ULONG val);
struct sym *req_cursor; /* Cursor symbol. if any */ void append_cstring(UCHAR verb, char* string);
struct dbb *req_dbb; /* Database handle */ void append_string(UCHAR verb, char* string, USHORT len);
int *req_trans; /* Database transaction handle */ void append_number(UCHAR verb, SSHORT number);
struct opn *req_open_cursor; void begin_blr(UCHAR verb);
struct nod *req_ddl_node; /* Store metadata request */ void end_blr();
struct blb *req_blob; /* Blob info for blob requests */ void append_uchars(UCHAR byte, UCHAR count);
int *req_handle; /* OSRI request handle */ void append_ushort_with_length(USHORT val);
struct str *req_blr_string; /* String block during BLR generation */ void append_ulong_with_length(ULONG val);
struct msg *req_send; /* Message to be sent to start request */ void append_file_length(ULONG length);
struct msg *req_receive; /* Per record message to be received */ void append_file_start(ULONG start);
struct msg *req_async; /* Message for sending scrolling information */ void generate_unnamed_trigger_beginning( bool on_update_trigger,
struct par *req_eof; /* End of file parameter */ TEXT* prim_rel_name,
struct par *req_dbkey; /* Database key for current of */ struct nod* prim_columns,
struct par *req_rec_version; /* Record Version for current of */ TEXT* for_rel_name,
struct par *req_parent_rec_version; /* parent record version */ struct nod* for_columns);
struct par *req_parent_dbkey; /* Parent database key for current of */ // end - member functions that should be private
struct dsql_rel *req_relation; /* relation created by this request (for DDL) */
struct prc *req_procedure; /* procedure created by this request (for DDL) */ req* req_parent; // Source request, if cursor update
struct ctx *req_outer_agg_context; /* agg context for outer ref */ req* req_sibling; // Next sibling request, if cursor update
BLOB_PTR *req_blr; /* Running blr address */ req* req_offspring; // Cursor update requests
BLOB_PTR *req_blr_yellow; /* Threshold for upping blr buffer size */ DsqlMemoryPool* req_pool;
ULONG req_inserts; /* records processed in request */ DLLS req_context;
struct sym* req_name; // Name of request
struct sym* req_cursor; // Cursor symbol. if any
dbb* req_dbb; // Database handle
int* req_trans; // Database transaction handle
class opn* req_open_cursor;
struct nod* req_ddl_node; // Store metadata request
class blb* req_blob; // Blob info for blob requests
int* req_handle; // OSRI request handle
str* req_blr_string; // String block during BLR generation
class msg* req_send; // Message to be sent to start request
class msg* req_receive; // Per record message to be received
class msg* req_async; // Message for sending scrolling information
class par* req_eof; // End of file parameter
class par* req_dbkey; // Database key for current of
class par* req_rec_version; // Record Version for current of
class par* req_parent_rec_version; // parent record version
class par* req_parent_dbkey; // Parent database key for current of
dsql_rel* req_relation; // relation created by this request (for DDL)
prc* req_procedure; // procedure created by this request (for DDL)
class ctx* req_outer_agg_context; // agg context for outer ref
BLOB_PTR* req_blr; // Running blr address
BLOB_PTR* req_blr_yellow; // Threshold for upping blr buffer size
ULONG req_inserts; // records processed in request
ULONG req_deletes; ULONG req_deletes;
ULONG req_updates; ULONG req_updates;
ULONG req_selects; ULONG req_selects;
REQ_TYPE req_type; /* Type of request */ REQ_TYPE req_type; // Type of request
USHORT req_base_offset; /* place to go back and stuff in blr length */ USHORT req_base_offset; // place to go back and stuff in blr length
USHORT req_context_number; /* Next available context number */ USHORT req_context_number; // Next available context number
USHORT req_scope_level; /* Scope level for parsing aliases in subqueries */ USHORT req_scope_level; // Scope level for parsing aliases in subqueries
USHORT req_message_number; /* Next available message number */ USHORT req_message_number; // Next available message number
USHORT req_loop_number; /* Next available loop number */ USHORT req_loop_number; // Next available loop number
SSHORT req_inhibit_map; /* Map inhibit count */ SSHORT req_inhibit_map; // Map inhibit count
USHORT req_in_select_list; /* now processing "select list" */ USHORT req_in_select_list; // now processing "select list"
USHORT req_in_where_clause; /* processing "where clause" */ USHORT req_in_where_clause; // processing "where clause"
USHORT req_in_having_clause; /* processing "having clause" */ USHORT req_in_having_clause; // processing "having clause"
USHORT req_in_order_by_clause; /* processing "order by clause" */ USHORT req_in_order_by_clause; // processing "order by clause"
USHORT req_error_handlers; /* count of active error handlers */ USHORT req_error_handlers; // count of active error handlers
USHORT req_flags; /* generic flag */ USHORT req_flags; // generic flag
USHORT req_client_dialect; /* dialect passed into the API call */ USHORT req_client_dialect; // dialect passed into the API call
} *REQ; };
typedef req* REQ;
/* values used in req_flags */
// values used in req_flags
#define REQ_cursor_open 1 #define REQ_cursor_open 1
#define REQ_save_metadata 2 #define REQ_save_metadata 2
@ -451,117 +455,135 @@ typedef struct req {
#define REQ_blr_version4 1024 #define REQ_blr_version4 1024
#define REQ_blr_version5 2048 #define REQ_blr_version5 2048
/* Blob */ // Blob
typedef struct blb { class blb : public pool_alloc<dsql_type_blb>
struct blk blb_header; {
struct nod *blb_field; /* Related blob field */ public:
struct par *blb_blob_id; /* Parameter to hold blob id */ struct nod* blb_field; // Related blob field
struct par *blb_segment; /* Parameter for segments */ class par* blb_blob_id; // Parameter to hold blob id
struct nod *blb_from; class par* blb_segment; // Parameter for segments
struct nod *blb_to; struct nod* blb_from;
struct msg *blb_open_in_msg; /* Input message to open cursor */ struct nod* blb_to;
struct msg *blb_open_out_msg; /* Output message from open cursor */ class msg* blb_open_in_msg; // Input message to open cursor
struct msg *blb_segment_msg; /* Segment message */ class msg* blb_open_out_msg; // Output message from open cursor
} *BLB; class msg* blb_segment_msg; // Segment message
};
typedef blb* BLB;
/* List of open cursors */ // List of open cursors
typedef struct opn { class opn : public pool_alloc<dsql_type_opn>
struct blk opn_header; {
struct opn *opn_next; /* Next open cursor */ public:
struct req *opn_request; /* Request owning the cursor */ opn* opn_next; // Next open cursor
SLONG *opn_transaction; /* Transaction executing request */ req* opn_request; // Request owning the cursor
} *OPN; SLONG* opn_transaction; // Transaction executing request
};
typedef opn* OPN;
/* Transaction block */ // Transaction block
typedef struct tra { class tra : public pool_alloc<dsql_type_tra>
struct blk tra_header; {
struct tra *tra_next; /* Next open transaction */ public:
} *TRA; tra* tra_next; // Next open transaction
};
typedef tra* TRA;
/* Context block used to create an instance of a relation reference */ // Context block used to create an instance of a relation reference
typedef struct ctx { class ctx : public pool_alloc<dsql_type_ctx>
struct blk ctx_header; {
struct req *ctx_request; /* Parent request */ public:
struct dsql_rel *ctx_relation; /* Relation for context */ req* ctx_request; // Parent request
struct prc *ctx_procedure; /* Procedure for context */ dsql_rel* ctx_relation; // Relation for context
struct nod *ctx_proc_inputs; /* Procedure input parameters */ prc* ctx_procedure; // Procedure for context
struct map *ctx_map; /* Map for aggregates */ struct nod* ctx_proc_inputs; // Procedure input parameters
struct nod *ctx_rse; /* Sub-rse for aggregates */ class map* ctx_map; // Map for aggregates
struct ctx *ctx_parent; /* Parent context for aggregates */ struct nod* ctx_rse; // Sub-rse for aggregates
TEXT *ctx_alias; /* Context alias */ ctx* ctx_parent; // Parent context for aggregates
USHORT ctx_context; /* Context id */ TEXT* ctx_alias; // Context alias
USHORT ctx_scope_level; /* Subquery level within this request */ USHORT ctx_context; // Context id
USHORT ctx_flags; /* Various flag values */ USHORT ctx_scope_level; // Subquery level within this request
} *CTX; USHORT ctx_flags; // Various flag values
};
typedef ctx* CTX;
/* Flag values for ctx_flags */ // Flag values for ctx_flags
#define CTX_outer_join (1<<0) /* reference is part of an outer join */ #define CTX_outer_join (1<<0) // reference is part of an outer join
/* Aggregate/union map block to map virtual fields to their base */ // Aggregate/union map block to map virtual fields to their base
typedef struct map { // TMN: NOTE! This datatype should definitely be renamed!
struct blk map_header; class map : public pool_alloc<dsql_type_map>
struct map *map_next; /* Next map in item */ {
struct nod *map_node; /* Value for map item */ public:
USHORT map_position; /* Position in map */ map* map_next; // Next map in item
} *MAP; struct nod* map_node; // Value for map item
USHORT map_position; // Position in map
};
typedef map* MAP;
/* Message block used in communicating with a running request */ // Message block used in communicating with a running request
#ifndef GUI_TOOLS #ifndef GUI_TOOLS
typedef struct msg {
struct blk msg_header; class msg : public pool_alloc<dsql_type_msg>
struct par *msg_parameters; /* Parameter list */ {
struct par *msg_par_ordered; /* Ordered parameter list */ public:
UCHAR *msg_buffer; /* Message buffer */ class par* msg_parameters; // Parameter list
USHORT msg_number; /* Message number */ class par* msg_par_ordered; // Ordered parameter list
USHORT msg_length; /* Message length */ UCHAR* msg_buffer; // Message buffer
USHORT msg_parameter; /* Next parameter number */ USHORT msg_number; // Message number
USHORT msg_index; /* Next index into SQLDA */ USHORT msg_length; // Message length
} *MSG; USHORT msg_parameter; // Next parameter number
USHORT msg_index; // Next index into SQLDA
};
typedef msg* MSG;
#endif #endif
/* Parameter block used to describe a parameter of a message */ // Parameter block used to describe a parameter of a message
typedef struct par { class par : public pool_alloc<dsql_type_par>
struct blk par_header; {
struct msg *par_message; /* Parent message */ public:
struct par *par_next; /* Next parameter in linked list */ msg* par_message; // Parent message
struct par *par_ordered; /* Next parameter in order of index */ class par* par_next; // Next parameter in linked list
struct par *par_null; /* Null parameter, if used */ class par* par_ordered; // Next parameter in order of index
struct nod *par_node; /* Associated value node, if any */ class par* par_null; // Null parameter, if used
struct ctx *par_dbkey_ctx; /* Context of internally requested dbkey */ struct nod* par_node; // Associated value node, if any
struct ctx *par_rec_version_ctx; /* Context of internally requested record version */ ctx* par_dbkey_ctx; // Context of internally requested dbkey
TEXT *par_name; /* Parameter name, if any */ ctx* par_rec_version_ctx; // Context of internally requested record version
TEXT *par_rel_name; /* Relation name, if any */ TEXT* par_name; // Parameter name, if any
TEXT *par_owner_name; /* Owner name, if any */ TEXT* par_rel_name; // Relation name, if any
TEXT *par_alias; /* Alias, if any */ TEXT* par_owner_name; // Owner name, if any
DSC par_desc; /* Field data type */ TEXT* par_alias; // Alias, if any
DSC par_user_desc; /* SQLDA data type */ DSC par_desc; // Field data type
USHORT par_parameter; /* BLR parameter number */ DSC par_user_desc; // SQLDA data type
USHORT par_index; /* Index into SQLDA, if appropriate */ USHORT par_parameter; // BLR parameter number
} *PAR; USHORT par_index; // Index into SQLDA, if appropriate
};
typedef par* PAR;
#include "../jrd/thd.h" #include "../jrd/thd.h"
/* DSQL threading declarations */ // DSQL threading declarations
typedef struct tsql struct tsql
{ {
struct thdd tsql_thd_data; thdd tsql_thd_data;
struct plb* tsql_default; DsqlMemoryPool* tsql_default;
STATUS* tsql_status; STATUS* tsql_status;
STATUS* tsql_user_status; STATUS* tsql_user_status;
jmp_buf* tsql_setjmp; jmp_buf* tsql_setjmp;
} *TSQL; };
typedef tsql* TSQL;
#ifdef GET_THREAD_DATA #ifdef GET_THREAD_DATA
#undef GET_THREAD_DATA #undef GET_THREAD_DATA
@ -572,56 +594,64 @@ typedef struct tsql
#ifndef SHLIB_DEFS #ifndef SHLIB_DEFS
#ifdef DSQL_MAIN #ifdef DSQL_MAIN
PLB DSQL_permanent_pool;
int DSQL_debug; int DSQL_debug;
#else #else
extern PLB DSQL_permanent_pool;
extern int DSQL_debug; extern int DSQL_debug;
#endif #endif
#else #else
extern PLB DSQL_permanent_pool;
extern int DSQL_debug; extern int DSQL_debug;
#endif #endif
/* macros for error generation */ // macros for error generation
#define BUGCHECK(string) ERRD_bugcheck(string) #define BUGCHECK(string) ERRD_bugcheck(string)
#define IBERROR(code, string) ERRD_error(code, string) #define IBERROR(code, string) ERRD_error(code, string)
#define BLKCHK(blk, type) if (blk->blk_type != (SCHAR) type) BUGCHECK ("expected type") //#define BLKCHK(blk, type) if (blk->blk_type != (SCHAR) type) BUGCHECK ("expected type")
#define BLKCHK(blk, type) if (MemoryPool::blk_type(blk) != (SSHORT) type) BUGCHECK ("expected type")
/* macro to stuff blr */ // macro to stuff blr
/* this is used in both ddl.cpp and gen.cpp, and is put here for commonality */ // this is used in both ddl.cpp and gen.cpp, and is put here for commonality
#define STUFF(byte) ((BLOB_PTR*)request->req_blr < (BLOB_PTR*)request->req_blr_yellow) ?\ #define STUFF(byte) ((BLOB_PTR*)request->req_blr < (BLOB_PTR*)request->req_blr_yellow) ?\
(*request->req_blr++ = (UCHAR)(byte)) : GEN_expand_buffer (request, (UCHAR)(byte)) (*request->req_blr++ = (UCHAR)(byte)) : GEN_expand_buffer (request, (UCHAR)(byte))
/* Macros for DEV_BUILD internal consistancy checking */ // Macros for DEV_BUILD internal consistancy checking
#ifdef DEV_BUILD #ifdef DEV_BUILD
/* Verifies that a pointed to block matches the expected type. /* Verifies that a pointed to block matches the expected type.
* Useful to find coding errors & memory globbers. Useful to find coding errors & memory globbers.
*/
#define DEV_BLKCHK(blk, typ) \ #define DEV_BLKCHK(blk, typ) \
{ \ { \
if ((blk) && (((BLK) (blk))->blk_type != (typ))) \ if ((blk) && (((BLK) (blk))->blk_type != (typ))) \
ERRD_assert_msg (assert_blkchk_msg, assert_filename, (ULONG) __LINE__); \ ERRD_assert_msg (assert_blkchk_msg, assert_filename, (ULONG) __LINE__); \
} }
*/
#define _assert(ex) {if (!(ex)){(void) ERRD_assert_msg (NULL, assert_filename, __LINE__);}} #define DEV_BLKCHK(blk, typ) { \
if ((blk) && MemoryPool::blk_type(blk) != (SSHORT)typ) { \
ERRD_assert_msg((char*)assert_blkchk_msg, \
(char*)assert_filename, \
(ULONG) __LINE__); \
} \
}
#define _assert(ex) {if (!(ex)){(void) ERRD_assert_msg (NULL, (char*)assert_filename, __LINE__);}}
#define assert(ex) _assert(ex) #define assert(ex) _assert(ex)
#define ASSERT_FAIL ERRD_assert_msg (NULL, assert_filename, __LINE__) #define ASSERT_FAIL ERRD_assert_msg (NULL, (char*)assert_filename, __LINE__)
/* Define the assert_filename as a static variable to save on codespace */ // Define the assert_filename as a static variable to save on codespace
#define ASSERT_FILENAME \ #define ASSERT_FILENAME \
static UCHAR assert_filename[] = __FILE__; \ static UCHAR assert_filename[] = __FILE__; \
static UCHAR assert_blkchk_msg[] = "Unexpected memory block type"; /* NTX: dev */ static UCHAR assert_blkchk_msg[] = "Unexpected memory block type"; // NTX: dev
#else /* PROD_BUILD */ #else // PROD_BUILD
#define DEV_BLKCHK(blk, typ) #define DEV_BLKCHK(blk, typ)
#define _assert(ex) #define _assert(ex)
@ -629,6 +659,6 @@ extern int DSQL_debug;
#define ASSERT_FAIL #define ASSERT_FAIL
#define ASSERT_FILENAME #define ASSERT_FILENAME
#endif /* DEV_BUILD */ #endif // DEV_BUILD
#endif /* _DSQL_DSQL_H_ */ #endif // _DSQL_DSQL_H_

View File

@ -30,8 +30,8 @@ extern "C" {
extern STATUS DLL_EXPORT dsql8_allocate_statement( STATUS*, extern STATUS DLL_EXPORT dsql8_allocate_statement( STATUS*,
int**, int**,
struct req**); struct dsql_req**);
extern STATUS DLL_EXPORT dsql8_execute(STATUS *, void **, struct req**, extern STATUS DLL_EXPORT dsql8_execute(STATUS *, void **, struct dsql_req**,
USHORT, UCHAR *, USHORT, USHORT, USHORT, UCHAR *, USHORT, USHORT,
UCHAR *, USHORT, UCHAR *, USHORT, UCHAR *, USHORT, UCHAR *, USHORT,
USHORT, UCHAR *); USHORT, UCHAR *);
@ -42,22 +42,22 @@ extern STATUS DLL_EXPORT dsql8_execute_immediate(STATUS *, int **, int **,
UCHAR *, USHORT, USHORT, UCHAR *, USHORT, USHORT,
UCHAR *); UCHAR *);
#ifdef SCROLLABLE_CURSORS #ifdef SCROLLABLE_CURSORS
extern STATUS DLL_EXPORT dsql8_fetch(STATUS *, struct req **, USHORT, UCHAR *, extern STATUS DLL_EXPORT dsql8_fetch(STATUS *, struct dsql_req**, USHORT, UCHAR *,
USHORT, USHORT, UCHAR *, USHORT, SLONG); USHORT, USHORT, UCHAR *, USHORT, SLONG);
#else #else
extern STATUS DLL_EXPORT dsql8_fetch(STATUS *, struct req **, USHORT, UCHAR *, extern STATUS DLL_EXPORT dsql8_fetch(STATUS *, struct dsql_req**, USHORT, UCHAR *,
USHORT, USHORT, UCHAR *); USHORT, USHORT, UCHAR *);
#endif /* SCROLLABLE_CURSORS */ #endif /* SCROLLABLE_CURSORS */
extern STATUS DLL_EXPORT dsql8_free_statement(STATUS *, struct req **, extern STATUS DLL_EXPORT dsql8_free_statement(STATUS *, struct dsql_req**,
USHORT); USHORT);
extern STATUS DLL_EXPORT dsql8_insert(STATUS *, struct req **, USHORT, extern STATUS DLL_EXPORT dsql8_insert(STATUS *, struct dsql_req**, USHORT,
UCHAR *, USHORT, USHORT, UCHAR *); UCHAR *, USHORT, USHORT, UCHAR *);
extern STATUS DLL_EXPORT dsql8_prepare(STATUS *, void **, struct req **, extern STATUS DLL_EXPORT dsql8_prepare(STATUS *, void **, struct dsql_req**,
USHORT, TEXT *, USHORT, USHORT, USHORT, TEXT *, USHORT, USHORT,
UCHAR *, USHORT, UCHAR *); UCHAR *, USHORT, UCHAR *);
extern STATUS DLL_EXPORT dsql8_set_cursor(STATUS *, struct req **, TEXT *, extern STATUS DLL_EXPORT dsql8_set_cursor(STATUS *, struct dsql_req**, TEXT *,
USHORT); USHORT);
extern STATUS DLL_EXPORT dsql8_sql_info(STATUS *, struct req **, USHORT, extern STATUS DLL_EXPORT dsql8_sql_info(STATUS *, struct dsql_req**, USHORT,
SCHAR *, USHORT, SCHAR *); SCHAR *, USHORT, SCHAR *);
extern void DSQL_pretty(struct nod *, int); extern void DSQL_pretty(struct nod *, int);

View File

@ -44,7 +44,7 @@ extern "C" {
ASSERT_FILENAME /* Define things assert() needs */ ASSERT_FILENAME /* Define things assert() needs */
#ifdef DEV_BUILD #ifdef DEV_BUILD
void ERRD_assert_msg( CONST UCHAR * msg, CONST UCHAR * file, ULONG lineno) void ERRD_assert_msg(const char* msg, const char* file, ULONG lineno)
{ {
/************************************** /**************************************
* *
@ -60,13 +60,13 @@ void ERRD_assert_msg( CONST UCHAR * msg, CONST UCHAR * file, ULONG lineno)
char buffer[100]; char buffer[100];
sprintf(buffer, "Assertion failure: %s File: %s Line: %ld\n", /* NTX: dev build */ sprintf(buffer, "Assertion failure: %s File: %s Line: %ld\n", /* NTX: dev build */
(msg ? msg : (UCHAR *) ""), (file ? file : (UCHAR *) ""), lineno); (msg ? msg : ""), (file ? file : ""), lineno);
ERRD_bugcheck(buffer); ERRD_bugcheck(buffer);
} }
#endif /* DEV_BUILD */ #endif /* DEV_BUILD */
void ERRD_bugcheck( CONST TEXT * text) void ERRD_bugcheck(const char* text)
{ {
/************************************** /**************************************
* *
@ -85,7 +85,7 @@ void ERRD_bugcheck( CONST TEXT * text)
} }
void ERRD_error( int code, CONST TEXT * text) void ERRD_error( int code, const char* text)
{ {
/************************************** /**************************************
* *
@ -110,7 +110,7 @@ void ERRD_error( int code, CONST TEXT * text)
sprintf(s, "** DSQL error: %s **\n", text); sprintf(s, "** DSQL error: %s **\n", text);
TRACE(s); TRACE(s);
LONGJMP(*tdsql->tsql_setjmp, code); Firebird::status_longjmp_error::raise(code);
} }
@ -323,7 +323,7 @@ void ERRD_punt(void)
/* Give up whatever we were doing and return to the user. */ /* Give up whatever we were doing and return to the user. */
LONGJMP(*tdsql->tsql_setjmp, (int) tdsql->tsql_status[1]); Firebird::status_longjmp_error::raise(tdsql->tsql_status[1]);
} }

View File

@ -29,11 +29,11 @@ extern "C" {
#endif #endif
#ifdef DEV_BUILD #ifdef DEV_BUILD
void ERRD_assert_msg(CONST UCHAR *, CONST UCHAR *, ULONG); void ERRD_assert_msg(const char*, const char*, ULONG);
#endif #endif
void ERRD_bugcheck(CONST TEXT *); void ERRD_bugcheck(const char*);
void ERRD_error(int, CONST TEXT *); void ERRD_error(int, const char*);
void ERRD_post(STATUS, ...); void ERRD_post(STATUS, ...);
BOOLEAN ERRD_post_warning(STATUS, ...); BOOLEAN ERRD_post_warning(STATUS, ...);
void ERRD_punt(void); void ERRD_punt(void);

View File

@ -21,7 +21,7 @@
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
*/ */
/* /*
$Id: gen.cpp,v 1.2 2001-07-29 23:43:21 skywalker Exp $ $Id: gen.cpp,v 1.3 2001-12-24 02:50:48 tamlin Exp $
*/ */
#include "firebird.h" #include "firebird.h"
@ -90,31 +90,26 @@ UCHAR GEN_expand_buffer( REQ request, UCHAR byte)
* The blr buffer needs to be expanded. * The blr buffer needs to be expanded.
* *
**************************************/ **************************************/
ULONG length;
ULONG copy_length;
PLB pool;
STR new_buffer;
BLOB_PTR *p; /* one huge pointer per line for LIBS */ BLOB_PTR *p; /* one huge pointer per line for LIBS */
BLOB_PTR *q; /* one huge pointer per line for LIBS */ BLOB_PTR *q; /* one huge pointer per line for LIBS */
BLOB_PTR *end; /* one huge pointer per line for LIBS */ BLOB_PTR *end; /* one huge pointer per line for LIBS */
TSQL tdsql;
tdsql = GET_THREAD_DATA; TSQL tdsql = GET_THREAD_DATA;
length = request->req_blr_string->str_length + 2048; ULONG length = request->req_blr_string->str_length + 2048;
pool = (request->req_blr_string->str_header.blk_pool_id == DsqlMemoryPool *pool = (MemoryPool::blk_pool(request->req_blr_string) == DSQL_permanent_pool) ?
DSQL_permanent_pool->plb_pool_id) ?
DSQL_permanent_pool : tdsql->tsql_default; DSQL_permanent_pool : tdsql->tsql_default;
new_buffer = (STR) ALLOCV(type_str, pool, length); STR new_buffer = new(*pool, length) str;
new_buffer->str_length = length; new_buffer->str_length = length;
p = new_buffer->str_data; p = new_buffer->str_data;
q = request->req_blr_string->str_data; q = request->req_blr_string->str_data;
end = request->req_blr; end = request->req_blr;
copy_length = (ULONG) (end - q); ULONG copy_length = (ULONG) (end - q);
memcpy(p, q, copy_length); memcpy(p, q, copy_length);
ALLD_release(reinterpret_cast<FRB>(request->req_blr_string)); delete request->req_blr_string;
request->req_blr_string = new_buffer; request->req_blr_string = new_buffer;
request->req_blr = p + copy_length; request->req_blr = p + copy_length;
request->req_blr_yellow = new_buffer->str_data + length; request->req_blr_yellow = new_buffer->str_data + length;
@ -636,7 +631,7 @@ void GEN_port( REQ request, MSG message)
/* Allocate buffer for message */ /* Allocate buffer for message */
buffer = (STR) ALLOCDV(type_str, message->msg_length + DOUBLE_ALIGN - 1); buffer = new(*tdsql->tsql_default, message->msg_length + DOUBLE_ALIGN - 1) str;
message->msg_buffer = message->msg_buffer =
(UCHAR *) FB_ALIGN((U_IPTR) buffer->str_data, DOUBLE_ALIGN); (UCHAR *) FB_ALIGN((U_IPTR) buffer->str_data, DOUBLE_ALIGN);

View File

@ -86,7 +86,7 @@ void HSHD_init(void)
} }
#endif #endif
p = (UCHAR *) ALLD_malloc(sizeof(SYM) * HASH_SIZE); p = (UCHAR *) MemoryPool::malloc_from_system(sizeof(SYM) * HASH_SIZE);
memset(p, 0, sizeof(SYM) * HASH_SIZE); memset(p, 0, sizeof(SYM) * HASH_SIZE);
hash_table = (SYM *) p; hash_table = (SYM *) p;
@ -156,7 +156,7 @@ void HSHD_fini(void)
hash_table[i] = NULL; hash_table[i] = NULL;
} }
ALLD_free(hash_table); MemoryPool::free_from_system(hash_table);
hash_table = NULL; hash_table = NULL;
} }

View File

@ -21,6 +21,11 @@
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
*/ */
//This MUST be before any other includes
#ifdef DARWIN
#define _STLP_CCTYPE
#endif
#include "firebird.h" #include "firebird.h"
#include <ctype.h> #include <ctype.h>
#include <string.h> #include <string.h>
@ -40,9 +45,6 @@
#include "../jrd/cvt_proto.h" #include "../jrd/cvt_proto.h"
extern "C" {
ASSERT_FILENAME /* declare things assert() needs */ ASSERT_FILENAME /* declare things assert() needs */
/* InterBase provides transparent conversion from string to date in /* InterBase provides transparent conversion from string to date in
* contexts where it makes sense. This macro checks a descriptor to * contexts where it makes sense. This macro checks a descriptor to
@ -53,7 +55,9 @@ ASSERT_FILENAME /* declare things assert() needs */
#define IS_DATE_AND_TIME(d1,d2) \ #define IS_DATE_AND_TIME(d1,d2) \
((((d1).dsc_dtype==dtype_sql_time)&&((d2).dsc_dtype==dtype_sql_date)) || \ ((((d1).dsc_dtype==dtype_sql_time)&&((d2).dsc_dtype==dtype_sql_date)) || \
(((d2).dsc_dtype==dtype_sql_time)&&((d1).dsc_dtype==dtype_sql_date))) (((d2).dsc_dtype==dtype_sql_time)&&((d1).dsc_dtype==dtype_sql_date)))
NOD MAKE_constant(STR constant, int numeric_flag)
NOD MAKE_constant(STR constant, int numeric_flag)
{ {
/************************************** /**************************************
* *
@ -70,9 +74,9 @@ ASSERT_FILENAME /* declare things assert() needs */
tdsql = GET_THREAD_DATA; tdsql = GET_THREAD_DATA;
node = (NOD) ALLOCDV(type_nod, node = new(*tdsql->tsql_default,
(numeric_flag == CONSTANT_TIMESTAMP || (numeric_flag == CONSTANT_TIMESTAMP ||
numeric_flag == CONSTANT_SINT64) ? 2 : 1); numeric_flag == CONSTANT_SINT64) ? 2 : 1) nod;
node->nod_type = nod_constant; node->nod_type = nod_constant;
if (numeric_flag == CONSTANT_SLONG) { if (numeric_flag == CONSTANT_SLONG) {
@ -84,7 +88,7 @@ ASSERT_FILENAME /* declare things assert() needs */
node->nod_arg[0] = (NOD) constant; node->nod_arg[0] = (NOD) constant;
} }
else if (numeric_flag == CONSTANT_DOUBLE) { else if (numeric_flag == CONSTANT_DOUBLE) {
DEV_BLKCHK(constant, type_str); DEV_BLKCHK(constant, dsql_type_str);
/* This is a numeric value which is transported to the engine as /* This is a numeric value which is transported to the engine as
* a string. The engine will convert it. Use dtype_double so that * a string. The engine will convert it. Use dtype_double so that
@ -166,23 +170,23 @@ ASSERT_FILENAME /* declare things assert() needs */
tmp.dsc_scale = 0; tmp.dsc_scale = 0;
tmp.dsc_flags = 0; tmp.dsc_flags = 0;
tmp.dsc_ttype = ttype_ascii; tmp.dsc_ttype = ttype_ascii;
tmp.dsc_length = static_cast < USHORT > (constant->str_length); tmp.dsc_length = static_cast<USHORT>(constant->str_length);
tmp.dsc_address = constant->str_data; tmp.dsc_address = constant->str_data;
/* Now invoke the string_to_date/time/timestamp routines */ /* Now invoke the string_to_date/time/timestamp routines */
CVT_move(&tmp, &node->nod_desc, CVT_move(&tmp, &node->nod_desc,
reinterpret_cast < void (*)() > (ERRD_post)); reinterpret_cast<void (*)()> (ERRD_post));
} }
else { else {
assert(numeric_flag == CONSTANT_STRING); assert(numeric_flag == CONSTANT_STRING);
DEV_BLKCHK(constant, type_str); DEV_BLKCHK(constant, dsql_type_str);
node->nod_desc.dsc_dtype = dtype_text; node->nod_desc.dsc_dtype = dtype_text;
node->nod_desc.dsc_sub_type = 0; node->nod_desc.dsc_sub_type = 0;
node->nod_desc.dsc_scale = 0; node->nod_desc.dsc_scale = 0;
node->nod_desc.dsc_length = node->nod_desc.dsc_length =
static_cast < USHORT > (constant->str_length); static_cast<USHORT>(constant->str_length);
node->nod_desc.dsc_address = constant->str_data; node->nod_desc.dsc_address = constant->str_data;
node->nod_desc.dsc_ttype = ttype_dynamic; node->nod_desc.dsc_ttype = ttype_dynamic;
/* carry a pointer to the constant to resolve character set in pass1 */ /* carry a pointer to the constant to resolve character set in pass1 */
@ -211,15 +215,15 @@ NOD MAKE_str_constant(STR constant, SSHORT character_set)
tdsql = GET_THREAD_DATA; tdsql = GET_THREAD_DATA;
node = (NOD) ALLOCDV(type_nod, 1); node = new(*tdsql->tsql_default, 1) nod;
node->nod_type = nod_constant; node->nod_type = nod_constant;
DEV_BLKCHK(constant, type_str); DEV_BLKCHK(constant, dsql_type_str);
node->nod_desc.dsc_dtype = dtype_text; node->nod_desc.dsc_dtype = dtype_text;
node->nod_desc.dsc_sub_type = 0; node->nod_desc.dsc_sub_type = 0;
node->nod_desc.dsc_scale = 0; node->nod_desc.dsc_scale = 0;
node->nod_desc.dsc_length = static_cast < USHORT > (constant->str_length); node->nod_desc.dsc_length = static_cast<USHORT>(constant->str_length);
node->nod_desc.dsc_address = constant->str_data; node->nod_desc.dsc_address = constant->str_data;
node->nod_desc.dsc_ttype = character_set; node->nod_desc.dsc_ttype = character_set;
/* carry a pointer to the constant to resolve character set in pass1 */ /* carry a pointer to the constant to resolve character set in pass1 */
@ -267,7 +271,7 @@ void MAKE_desc( DSC * desc, NOD node)
UDF udf; UDF udf;
FLD field; FLD field;
DEV_BLKCHK(node, type_nod); DEV_BLKCHK(node, dsql_type_nod);
/* If we already know the datatype, don't worry about anything */ /* If we already know the datatype, don't worry about anything */
@ -766,7 +770,7 @@ void MAKE_desc( DSC * desc, NOD node)
MAKE_desc(&desc1, node->nod_arg[0]); MAKE_desc(&desc1, node->nod_arg[0]);
MAKE_desc(&desc2, node->nod_arg[1]); MAKE_desc(&desc2, node->nod_arg[1]);
dtype = DSC_multiply_result[desc1.dsc_dtype][desc2.dsc_dtype]; dtype = DSC_multiply_result[desc1.dsc_dtype][desc2.dsc_dtype];
desc->dsc_dtype = static_cast < UCHAR > (dtype); desc->dsc_dtype = static_cast<UCHAR>(dtype);
desc->dsc_flags = (desc1.dsc_flags | desc2.dsc_flags) & DSC_nullable; desc->dsc_flags = (desc1.dsc_flags | desc2.dsc_flags) & DSC_nullable;
switch (dtype) { switch (dtype) {
@ -817,9 +821,9 @@ void MAKE_desc( DSC * desc, NOD node)
case nod_udf: case nod_udf:
udf = (UDF) node->nod_arg[0]; udf = (UDF) node->nod_arg[0];
desc->dsc_dtype = static_cast < UCHAR > (udf->udf_dtype); desc->dsc_dtype = static_cast<UCHAR>(udf->udf_dtype);
desc->dsc_length = udf->udf_length; desc->dsc_length = udf->udf_length;
desc->dsc_scale = static_cast < SCHAR > (udf->udf_scale); desc->dsc_scale = static_cast<SCHAR>(udf->udf_scale);
desc->dsc_flags = 0; desc->dsc_flags = 0;
desc->dsc_ttype = udf->udf_sub_type; desc->dsc_ttype = udf->udf_sub_type;
return; return;
@ -966,10 +970,10 @@ void MAKE_desc_from_field( DSC * desc, FLD field)
* *
**************************************/ **************************************/
DEV_BLKCHK(field, type_fld); DEV_BLKCHK(field, dsql_type_fld);
desc->dsc_dtype = static_cast < UCHAR > (field->fld_dtype); desc->dsc_dtype = static_cast<UCHAR>(field->fld_dtype);
desc->dsc_scale = static_cast < SCHAR > (field->fld_scale); desc->dsc_scale = static_cast<SCHAR>(field->fld_scale);
desc->dsc_sub_type = field->fld_sub_type; desc->dsc_sub_type = field->fld_sub_type;
desc->dsc_length = field->fld_length; desc->dsc_length = field->fld_length;
desc->dsc_flags = (field->fld_flags & FLD_nullable) ? DSC_nullable : 0; desc->dsc_flags = (field->fld_flags & FLD_nullable) ? DSC_nullable : 0;
@ -978,7 +982,7 @@ void MAKE_desc_from_field( DSC * desc, FLD field)
field->fld_collation_id); field->fld_collation_id);
} }
else if (desc->dsc_dtype == dtype_blob) else if (desc->dsc_dtype == dtype_blob)
desc->dsc_scale = static_cast < SCHAR > (field->fld_character_set_id); desc->dsc_scale = static_cast<SCHAR>(field->fld_character_set_id);
} }
@ -996,9 +1000,9 @@ NOD MAKE_field(CTX context, FLD field, NOD indices)
**************************************/ **************************************/
NOD node; NOD node;
DEV_BLKCHK(context, type_ctx); DEV_BLKCHK(context, dsql_type_ctx);
DEV_BLKCHK(field, type_fld); DEV_BLKCHK(field, dsql_type_fld);
DEV_BLKCHK(indices, type_nod); DEV_BLKCHK(indices, dsql_type_nod);
node = MAKE_node(nod_field, e_fld_count); node = MAKE_node(nod_field, e_fld_count);
node->nod_arg[e_fld_context] = (NOD) context; node->nod_arg[e_fld_context] = (NOD) context;
@ -1008,7 +1012,7 @@ NOD MAKE_field(CTX context, FLD field, NOD indices)
node->nod_arg[e_fld_indices] = indices; node->nod_arg[e_fld_indices] = indices;
MAKE_desc_from_field(&node->nod_desc, field); MAKE_desc_from_field(&node->nod_desc, field);
node->nod_desc.dsc_dtype = node->nod_desc.dsc_dtype =
static_cast < UCHAR > (field->fld_element_dtype); static_cast<UCHAR>(field->fld_element_dtype);
node->nod_desc.dsc_length = field->fld_element_length; node->nod_desc.dsc_length = field->fld_element_length;
/* /*
node->nod_desc.dsc_scale = field->fld_scale; node->nod_desc.dsc_scale = field->fld_scale;
@ -1019,7 +1023,7 @@ NOD MAKE_field(CTX context, FLD field, NOD indices)
node->nod_desc.dsc_dtype = dtype_array; node->nod_desc.dsc_dtype = dtype_array;
node->nod_desc.dsc_length = sizeof(GDS__QUAD); node->nod_desc.dsc_length = sizeof(GDS__QUAD);
node->nod_desc.dsc_scale = node->nod_desc.dsc_scale =
static_cast < SCHAR > (field->fld_scale); static_cast<SCHAR>(field->fld_scale);
node->nod_desc.dsc_sub_type = field->fld_sub_type; node->nod_desc.dsc_sub_type = field->fld_sub_type;
} }
} }
@ -1036,7 +1040,7 @@ NOD MAKE_field(CTX context, FLD field, NOD indices)
} }
NOD MAKE_list(LLS stack) NOD MAKE_list(DLLS stack)
{ {
/************************************** /**************************************
* *
@ -1048,11 +1052,11 @@ NOD MAKE_list(LLS stack)
* Make a list node from a linked list stack of things. * Make a list node from a linked list stack of things.
* *
**************************************/ **************************************/
LLS temp; DLLS temp;
USHORT count; USHORT count;
NOD node, *ptr; NOD node, *ptr;
DEV_BLKCHK(stack, type_lls); DEV_BLKCHK(stack, dsql_type_lls);
for (temp = stack, count = 0; temp; temp = temp->lls_next) for (temp = stack, count = 0; temp; temp = temp->lls_next)
++count; ++count;
@ -1084,7 +1088,7 @@ NOD MAKE_node(NOD_TYPE type, int count)
tdsql = GET_THREAD_DATA; tdsql = GET_THREAD_DATA;
node = (NOD) ALLOCDV(type_nod, count); node = new(*tdsql->tsql_default, count) nod;
node->nod_type = type; node->nod_type = type;
node->nod_count = count; node->nod_count = count;
@ -1108,11 +1112,11 @@ PAR MAKE_parameter(MSG message, USHORT sqlda_flag, USHORT null_flag)
PAR parameter, null; PAR parameter, null;
TSQL tdsql; TSQL tdsql;
DEV_BLKCHK(message, type_msg); DEV_BLKCHK(message, dsql_type_msg);
tdsql = GET_THREAD_DATA; tdsql = GET_THREAD_DATA;
parameter = (PAR) ALLOCD(type_par); parameter = new(*tdsql->tsql_default) par;
parameter->par_message = message; parameter->par_message = message;
if (parameter->par_next = message->msg_parameters) if (parameter->par_next = message->msg_parameters)
parameter->par_next->par_ordered = parameter; parameter->par_next->par_ordered = parameter;
@ -1174,14 +1178,14 @@ SYM MAKE_symbol(DBB database,
TEXT *p; TEXT *p;
TSQL tdsql; TSQL tdsql;
DEV_BLKCHK(database, type_dbb); DEV_BLKCHK(database, dsql_type_dbb);
DEV_BLKCHK(object, type_req); DEV_BLKCHK(object, dsql_type_req);
assert(name); assert(name);
assert(length > 0); assert(length > 0);
tdsql = GET_THREAD_DATA; tdsql = GET_THREAD_DATA;
symbol = (SYM) ALLOCDV(type_sym, length); symbol = new(*tdsql->tsql_default, length) sym;
symbol->sym_type = type; symbol->sym_type = type;
symbol->sym_object = (BLK) object; symbol->sym_object = (BLK) object;
symbol->sym_dbb = database; symbol->sym_dbb = database;
@ -1197,7 +1201,7 @@ SYM MAKE_symbol(DBB database,
} }
STR MAKE_tagged_string(CONST UCHAR * str, int length, CONST TEXT * charset) STR MAKE_tagged_string(CONST UCHAR * str_, int length, CONST TEXT * charset)
{ {
/************************************** /**************************************
* *
@ -1216,11 +1220,11 @@ STR MAKE_tagged_string(CONST UCHAR * str, int length, CONST TEXT * charset)
tdsql = GET_THREAD_DATA; tdsql = GET_THREAD_DATA;
string = (STR) ALLOCDV(type_str, length); string = new(*tdsql->tsql_default, length) str;
string->str_charset = const_cast < char *>(charset); string->str_charset = const_cast < char *>(charset);
string->str_length = length; string->str_length = length;
for (p = string->str_data; length; --length) for (p = string->str_data; length; --length)
*p++ = *str++; *p++ = *str_++;
return string; return string;
} }
@ -1242,26 +1246,24 @@ NOD MAKE_variable(FLD field,
* *
**************************************/ **************************************/
NOD node; NOD node;
VAR var; VAR var_;
TSQL tdsql; TSQL tdsql;
DEV_BLKCHK(field, type_fld); DEV_BLKCHK(field, dsql_type_fld);
tdsql = GET_THREAD_DATA; tdsql = GET_THREAD_DATA;
var = (VAR) ALLOCDV(type_var, strlen(name)); var_ = new(*tdsql->tsql_default, strlen(name)) var;
node = MAKE_node(nod_variable, e_var_count); node = MAKE_node(nod_variable, e_var_count);
node->nod_arg[e_var_variable] = (NOD) var; node->nod_arg[e_var_variable] = (NOD) var_;
var->var_msg_number = msg_number; var_->var_msg_number = msg_number;
var->var_msg_item = item_number; var_->var_msg_item = item_number;
var->var_variable_number = local_number; var_->var_variable_number = local_number;
var->var_field = field; var_->var_field = field;
strcpy(var->var_name, name); strcpy(var_->var_name, name);
var->var_flags = type; var_->var_flags = type;
MAKE_desc_from_field(&node->nod_desc, field); MAKE_desc_from_field(&node->nod_desc, field);
return node; return node;
} }
} // extern "C"

View File

@ -26,28 +26,21 @@
#include "../dsql/sym.h" #include "../dsql/sym.h"
#ifdef __cplusplus struct nod* MAKE_constant(class str* , int);
extern "C" { struct nod* MAKE_str_constant(class str* , SSHORT);
#endif class str* MAKE_cstring(CONST SCHAR*);
void MAKE_desc(struct dsc* , struct nod*);
struct nod *MAKE_constant(struct str *, int); void MAKE_desc_from_field(struct dsc* , class fld*);
struct nod *MAKE_str_constant(struct str *, SSHORT); struct nod* MAKE_field(class ctx* , class fld* , struct nod*);
struct str *MAKE_cstring(CONST SCHAR *); struct nod* MAKE_list(class dsql_lls*);
void MAKE_desc(struct dsc *, struct nod *); struct nod* MAKE_node(ENUM nod_t, int);
void MAKE_desc_from_field(struct dsc *, struct fld *); class par* MAKE_parameter(class msg* , USHORT, USHORT);
struct nod *MAKE_field(struct ctx *, struct fld *, struct nod *); class str* MAKE_string(CONST UCHAR* , int);
struct nod *MAKE_list(struct lls *); struct sym* MAKE_symbol(class dbb* , CONST TEXT* , USHORT,
struct nod *MAKE_node(ENUM nod_t, int); ENUM sym_type, class req*);
struct par *MAKE_parameter(struct msg *, USHORT, USHORT); class str* MAKE_tagged_string(CONST UCHAR* , int, CONST TEXT*);
struct str *MAKE_string(CONST UCHAR *, int); struct nod* MAKE_variable(class fld* , CONST TEXT* , USHORT, USHORT,
struct sym *MAKE_symbol(struct dbb *, CONST TEXT *, USHORT,
ENUM sym_type, struct req *);
struct str *MAKE_tagged_string(CONST UCHAR *, int, CONST TEXT *);
struct nod *MAKE_variable(struct fld *, CONST TEXT *, USHORT, USHORT,
USHORT, USHORT); USHORT, USHORT);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* _DSQL_MAKE_PROTO_H_ */ #endif /* _DSQL_MAKE_PROTO_H_ */

View File

@ -1,6 +1,6 @@
/* /*
* PROGRAM: Dynamic SQL runtime support * PROGRAM: Dynamic SQL runtime support
* MODULE: met.e * MODULE: met.epp
* DESCRIPTION: Meta-data interface * DESCRIPTION: Meta-data interface
* *
* The contents of this file are subject to the Interbase Public * The contents of this file are subject to the Interbase Public
@ -41,7 +41,7 @@
#include "../jrd/thd_proto.h" #include "../jrd/thd_proto.h"
#include "../jrd/constants.h" #include "../jrd/constants.h"
/* NOTE: The static definition of DB and gds__trans by gpre will not /* NOTE: The static definition of DB and gds_trans by gpre will not
be used by the meta data routines. Each of those routines has be used by the meta data routines. Each of those routines has
its own local definition of these variables. */ its own local definition of these variables. */
@ -213,7 +213,7 @@ INTLSYM METD_get_collation(REQ request, STR name)
* If it doesn't exist, return NULL. * If it doesn't exist, return NULL.
* *
**************************************/ **************************************/
SLONG *DB, *gds__trans; SLONG *DB, *gds_trans;
DBB dbb; DBB dbb;
INTLSYM iname; INTLSYM iname;
SYM symbol; SYM symbol;
@ -232,7 +232,7 @@ INTLSYM METD_get_collation(REQ request, STR name)
dbb = request->req_dbb; dbb = request->req_dbb;
DB = dbb->dbb_database_handle; DB = dbb->dbb_database_handle;
gds__trans = (SLONG*) request->req_trans; gds_trans = (SLONG*) request->req_trans;
iname = NULL; iname = NULL;
THREAD_EXIT; THREAD_EXIT;
@ -244,7 +244,7 @@ INTLSYM METD_get_collation(REQ request, STR name)
THREAD_ENTER; THREAD_ENTER;
iname = (INTLSYM) ALLOCV(type_intlsym, dbb->dbb_pool, name->str_length); iname = new(*dbb->dbb_pool, name->str_length) intlsym;
strcpy(iname->intlsym_name, (TEXT *) name->str_data); strcpy(iname->intlsym_name, (TEXT *) name->str_data);
iname->intlsym_type = INTLSYM_collation; iname->intlsym_type = INTLSYM_collation;
iname->intlsym_flags = 0; iname->intlsym_flags = 0;
@ -268,7 +268,7 @@ INTLSYM METD_get_collation(REQ request, STR name)
/* Store in the symbol table */ /* Store in the symbol table */
symbol = iname->intlsym_symbol = (SYM) ALLOCV(type_sym, dbb->dbb_pool, 0); symbol = iname->intlsym_symbol = new(*dbb->dbb_pool, 0) sym;
symbol->sym_object = (BLK) iname; symbol->sym_object = (BLK) iname;
symbol->sym_string = iname->intlsym_name; symbol->sym_string = iname->intlsym_name;
symbol->sym_length = name->str_length; symbol->sym_length = name->str_length;
@ -303,7 +303,7 @@ TEXT * buffer, USHORT buff_length)
* Reads the system tables RDB$FIELDS and RDB$RELATION_FIELDS. * Reads the system tables RDB$FIELDS and RDB$RELATION_FIELDS.
* *
**************************************************************/ **************************************************************/
SLONG *DB, *gds__trans; SLONG *DB, *gds_trans;
DBB dbb; DBB dbb;
long status_vect[20]; long status_vect[20];
@ -318,7 +318,7 @@ TEXT * buffer, USHORT buff_length)
dbb = request->req_dbb; dbb = request->req_dbb;
DB = dbb->dbb_database_handle; DB = dbb->dbb_database_handle;
gds__trans = (SLONG*) request->req_trans; gds_trans = (SLONG*) request->req_trans;
/* V4.x multi threading requirements */ /* V4.x multi threading requirements */
THREAD_EXIT; THREAD_EXIT;
@ -346,7 +346,7 @@ TEXT * buffer, USHORT buff_length)
if (*has_default) { if (*has_default) {
/* open the blob */ /* open the blob */
THREAD_EXIT; THREAD_EXIT;
stat = isc_open_blob2(status_vect, (void**) &DB, (void**) &gds__trans, stat = isc_open_blob2(status_vect, (void**) &DB, (void**) &gds_trans,
(void**) &blob_handle, blob_id, sizeof(blr_bpb), (void**) &blob_handle, blob_id, sizeof(blr_bpb),
(UCHAR*)blr_bpb); (UCHAR*)blr_bpb);
THREAD_ENTER; THREAD_ENTER;
@ -413,7 +413,7 @@ INTLSYM METD_get_charset(REQ request, USHORT length, UCHAR * name)
* If it doesn't exist, return NULL. * If it doesn't exist, return NULL.
* *
**************************************/ **************************************/
SLONG *DB, *gds__trans; SLONG *DB, *gds_trans;
DBB dbb; DBB dbb;
INTLSYM iname; INTLSYM iname;
SYM symbol; SYM symbol;
@ -431,7 +431,7 @@ INTLSYM METD_get_charset(REQ request, USHORT length, UCHAR * name)
dbb = request->req_dbb; dbb = request->req_dbb;
DB = dbb->dbb_database_handle; DB = dbb->dbb_database_handle;
gds__trans = (SLONG*) request->req_trans; gds_trans = (SLONG*) request->req_trans;
iname = NULL; iname = NULL;
THREAD_EXIT; THREAD_EXIT;
@ -447,7 +447,7 @@ INTLSYM METD_get_charset(REQ request, USHORT length, UCHAR * name)
THREAD_ENTER; THREAD_ENTER;
iname = (INTLSYM) ALLOCV(type_intlsym, dbb->dbb_pool, length); iname = new(*dbb->dbb_pool, length) intlsym;
strcpy(iname->intlsym_name, (char*) name); strcpy(iname->intlsym_name, (char*) name);
iname->intlsym_type = INTLSYM_charset; iname->intlsym_type = INTLSYM_charset;
iname->intlsym_flags = 0; iname->intlsym_flags = 0;
@ -473,7 +473,7 @@ INTLSYM METD_get_charset(REQ request, USHORT length, UCHAR * name)
/* Store in the symbol table */ /* Store in the symbol table */
symbol = iname->intlsym_symbol = (SYM) ALLOCV(type_sym, dbb->dbb_pool, 0); symbol = iname->intlsym_symbol = new(*dbb->dbb_pool, 0) sym;
symbol->sym_object = (BLK) iname; symbol->sym_object = (BLK) iname;
symbol->sym_string = iname->intlsym_name; symbol->sym_string = iname->intlsym_name;
symbol->sym_length = length; symbol->sym_length = length;
@ -497,11 +497,11 @@ STR METD_get_default_charset(REQ request)
* Find the default character set for a database * Find the default character set for a database
* *
**************************************/ **************************************/
SLONG *DB, *gds__trans; SLONG *DB, *gds_trans;
DBB dbb; DBB dbb;
isc_req_handle handle; isc_req_handle handle;
UCHAR *p; UCHAR *p;
UCHAR *str; UCHAR *str_;
USHORT length; USHORT length;
dbb = request->req_dbb; dbb = request->req_dbb;
@ -514,7 +514,7 @@ STR METD_get_default_charset(REQ request)
/* Now see if it is in the database */ /* Now see if it is in the database */
DB = dbb->dbb_database_handle; DB = dbb->dbb_database_handle;
gds__trans = (SLONG*) request->req_trans; gds_trans = (SLONG*) request->req_trans;
handle = NULL_PTR; handle = NULL_PTR;
@ -529,12 +529,12 @@ STR METD_get_default_charset(REQ request)
/* Terminate ASCIIZ string on first blank */ /* Terminate ASCIIZ string on first blank */
metd_exact_name(DBB.RDB$CHARACTER_SET_NAME); metd_exact_name(DBB.RDB$CHARACTER_SET_NAME);
length = strlen(DBB.RDB$CHARACTER_SET_NAME); length = strlen(DBB.RDB$CHARACTER_SET_NAME);
dbb->dbb_dfl_charset = (STR) ALLOCV(type_str, dbb->dbb_pool, length); dbb->dbb_dfl_charset = new(*dbb->dbb_pool, length) str;
dbb->dbb_dfl_charset->str_length = length; dbb->dbb_dfl_charset->str_length = length;
dbb->dbb_dfl_charset->str_charset = NULL; dbb->dbb_dfl_charset->str_charset = NULL;
str = (UCHAR*) DBB.RDB$CHARACTER_SET_NAME; str_ = (UCHAR*) DBB.RDB$CHARACTER_SET_NAME;
for (p = dbb->dbb_dfl_charset->str_data; length; --length) for (p = dbb->dbb_dfl_charset->str_data; length; --length)
*p++ = *str++; *p++ = *str_++;
THREAD_EXIT; THREAD_EXIT;
END_FOR END_FOR
@ -551,7 +551,7 @@ gds__release request ()
THREAD_EXIT; THREAD_EXIT;
*************/ *************/
isc_release_request(gds__status, GDS_REF(handle)); isc_release_request(gds_status, GDS_REF(handle));
THREAD_ENTER; THREAD_ENTER;
if (dbb->dbb_dfl_charset == NULL) if (dbb->dbb_dfl_charset == NULL)
@ -573,13 +573,13 @@ USHORT METD_get_domain(REQ request, FLD field, UCHAR * name)
* Fetch domain information for field defined as 'name' * Fetch domain information for field defined as 'name'
* *
**************************************/ **************************************/
SLONG *DB, *gds__trans; SLONG *DB, *gds_trans;
DBB dbb; DBB dbb;
USHORT found = FALSE; USHORT found = FALSE;
dbb = request->req_dbb; dbb = request->req_dbb;
DB = dbb->dbb_database_handle; DB = dbb->dbb_database_handle;
gds__trans = (SLONG*) request->req_trans; gds_trans = (SLONG*) request->req_trans;
THREAD_EXIT; THREAD_EXIT;
@ -639,7 +639,7 @@ void METD_get_domain_default(REQ request,
* Gets the default value for a domain of an existing table. * Gets the default value for a domain of an existing table.
* *
**************************************************************/ **************************************************************/
SLONG *DB, *gds__trans; SLONG *DB, *gds_trans;
DBB dbb; DBB dbb;
ISC_STATUS status_vect[20]; ISC_STATUS status_vect[20];
@ -654,7 +654,7 @@ void METD_get_domain_default(REQ request,
dbb = request->req_dbb; dbb = request->req_dbb;
DB = dbb->dbb_database_handle; DB = dbb->dbb_database_handle;
gds__trans = (SLONG*) request->req_trans; gds_trans = (SLONG*) request->req_trans;
/* V4.x multi threading requirements */ /* V4.x multi threading requirements */
THREAD_EXIT; THREAD_EXIT;
@ -672,7 +672,7 @@ void METD_get_domain_default(REQ request,
if (*has_default) { if (*has_default) {
/* open the blob */ /* open the blob */
THREAD_EXIT; THREAD_EXIT;
stat = isc_open_blob2(status_vect, (void**) &DB, (void**) &gds__trans, stat = isc_open_blob2(status_vect, (void**) &DB, (void**) &gds_trans,
(void**) &blob_handle, blob_id, sizeof(blr_bpb), (void**) &blob_handle, blob_id, sizeof(blr_bpb),
(UCHAR*)blr_bpb); (UCHAR*)blr_bpb);
THREAD_ENTER; THREAD_ENTER;
@ -744,9 +744,9 @@ UDF METD_get_function(REQ request, STR name)
* return NULL. * return NULL.
* *
**************************************/ **************************************/
SLONG *DB, *gds__trans; SLONG *DB, *gds_trans;
DBB dbb; DBB dbb;
UDF udf; UDF udf_;
USHORT return_arg; USHORT return_arg;
SYM symbol; SYM symbol;
@ -761,8 +761,8 @@ UDF METD_get_function(REQ request, STR name)
dbb = request->req_dbb; dbb = request->req_dbb;
DB = dbb->dbb_database_handle; DB = dbb->dbb_database_handle;
gds__trans = (SLONG*) request->req_trans; gds_trans = (SLONG*) request->req_trans;
udf = NULL; udf_ = NULL;
THREAD_EXIT; THREAD_EXIT;
@ -772,10 +772,10 @@ UDF METD_get_function(REQ request, STR name)
THREAD_ENTER; THREAD_ENTER;
udf = (UDF) ALLOCV(type_udf, dbb->dbb_pool, name->str_length); udf_ = new(*dbb->dbb_pool, name->str_length) udf;
udf->udf_next = dbb->dbb_functions; udf_->udf_next = dbb->dbb_functions;
dbb->dbb_functions = udf; dbb->dbb_functions = udf_;
strcpy((char*) udf->udf_name, (char*) name->str_data); strcpy((char*) udf_->udf_name, (char*) name->str_data);
return_arg = X.RDB$RETURN_ARGUMENT; return_arg = X.RDB$RETURN_ARGUMENT;
THREAD_EXIT; THREAD_EXIT;
@ -786,7 +786,7 @@ UDF METD_get_function(REQ request, STR name)
THREAD_ENTER; THREAD_ENTER;
if (!udf) if (!udf_)
return NULL; return NULL;
/* Note: The following two requests differ in the fields which are /* Note: The following two requests differ in the fields which are
@ -805,11 +805,11 @@ UDF METD_get_function(REQ request, STR name)
THREAD_ENTER; THREAD_ENTER;
udf->udf_dtype = (X.RDB$FIELD_TYPE != blr_blob) ? udf_->udf_dtype = (X.RDB$FIELD_TYPE != blr_blob) ?
gds_cvt_blr_dtype[X.RDB$FIELD_TYPE] : dtype_blob; gds_cvt_blr_dtype[X.RDB$FIELD_TYPE] : dtype_blob;
udf->udf_scale = X.RDB$FIELD_SCALE; udf_->udf_scale = X.RDB$FIELD_SCALE;
udf->udf_sub_type = X.RDB$FIELD_SUB_TYPE; udf_->udf_sub_type = X.RDB$FIELD_SUB_TYPE;
udf->udf_length = X.RDB$FIELD_LENGTH; udf_->udf_length = X.RDB$FIELD_LENGTH;
THREAD_EXIT; THREAD_EXIT;
@ -826,14 +826,14 @@ UDF METD_get_function(REQ request, STR name)
THREAD_ENTER; THREAD_ENTER;
udf->udf_dtype = (X.RDB$FIELD_TYPE != blr_blob) ? udf_->udf_dtype = (X.RDB$FIELD_TYPE != blr_blob) ?
gds_cvt_blr_dtype[X.RDB$FIELD_TYPE] : dtype_blob; gds_cvt_blr_dtype[X.RDB$FIELD_TYPE] : dtype_blob;
udf->udf_scale = X.RDB$FIELD_SCALE; udf_->udf_scale = X.RDB$FIELD_SCALE;
udf->udf_sub_type = X.RDB$FIELD_SUB_TYPE; udf_->udf_sub_type = X.RDB$FIELD_SUB_TYPE;
udf->udf_length = X.RDB$FIELD_LENGTH; udf_->udf_length = X.RDB$FIELD_LENGTH;
if (!X.RDB$CHARACTER_SET_ID.NULL) if (!X.RDB$CHARACTER_SET_ID.NULL)
udf->udf_character_set_id = X.RDB$CHARACTER_SET_ID; udf_->udf_character_set_id = X.RDB$CHARACTER_SET_ID;
THREAD_EXIT; THREAD_EXIT;
@ -850,23 +850,23 @@ UDF METD_get_function(REQ request, STR name)
* (Q: why not use varying?) * (Q: why not use varying?)
*/ */
if (udf->udf_dtype == dtype_cstring) { if (udf_->udf_dtype == dtype_cstring) {
udf->udf_dtype = dtype_text; udf_->udf_dtype = dtype_text;
} }
else if (udf->udf_dtype == dtype_varying) else if (udf_->udf_dtype == dtype_varying)
udf->udf_length += sizeof(USHORT); udf_->udf_length += sizeof(USHORT);
/* Store in the symbol table */ /* Store in the symbol table */
symbol = udf->udf_symbol = (SYM) ALLOCV(type_sym, dbb->dbb_pool, 0); symbol = udf_->udf_symbol = new(*dbb->dbb_pool, 0) sym;
symbol->sym_object = (BLK) udf; symbol->sym_object = (BLK) udf_;
symbol->sym_string = udf->udf_name; symbol->sym_string = udf_->udf_name;
symbol->sym_length = name->str_length; symbol->sym_length = name->str_length;
symbol->sym_type = SYM_udf; symbol->sym_type = SYM_udf;
symbol->sym_dbb = dbb; symbol->sym_dbb = dbb;
HSHD_insert(symbol); HSHD_insert(symbol);
return udf; return udf_;
} }
@ -884,7 +884,7 @@ NOD METD_get_primary_key(REQ request, STR relation_name)
* node of the fields. * node of the fields.
* *
**************************************/ **************************************/
SLONG *DB, *gds__trans; SLONG *DB, *gds_trans;
DBB dbb; DBB dbb;
NOD list, field_node; NOD list, field_node;
STR field_name; STR field_name;
@ -892,7 +892,7 @@ NOD METD_get_primary_key(REQ request, STR relation_name)
dbb = request->req_dbb; dbb = request->req_dbb;
DB = dbb->dbb_database_handle; DB = dbb->dbb_database_handle;
gds__trans = (SLONG*) request->req_trans; gds_trans = (SLONG*) request->req_trans;
list = NULL; list = NULL;
count = 0; count = 0;
@ -943,7 +943,7 @@ PRC METD_get_procedure(REQ request, STR name)
* If it is marked dropped, try to read from system tables * If it is marked dropped, try to read from system tables
* *
**************************************/ **************************************/
SLONG *DB, *gds__trans; SLONG *DB, *gds_trans;
DBB dbb; DBB dbb;
FLD parameter, *ptr; FLD parameter, *ptr;
PRC procedure, temp; PRC procedure, temp;
@ -977,7 +977,7 @@ PRC METD_get_procedure(REQ request, STR name)
dbb = request->req_dbb; dbb = request->req_dbb;
DB = dbb->dbb_database_handle; DB = dbb->dbb_database_handle;
gds__trans = (SLONG*) request->req_trans; gds_trans = (SLONG*) request->req_trans;
procedure = NULL; procedure = NULL;
THREAD_EXIT; THREAD_EXIT;
@ -990,8 +990,8 @@ PRC METD_get_procedure(REQ request, STR name)
metd_exact_name(X.RDB$OWNER_NAME); metd_exact_name(X.RDB$OWNER_NAME);
procedure = (PRC) ALLOCV(type_prc, dbb->dbb_pool, procedure = new(*dbb->dbb_pool,
name->str_length + strlen(X.RDB$OWNER_NAME)); name->str_length + strlen(X.RDB$OWNER_NAME)) prc;
procedure->prc_id = X.RDB$PROCEDURE_ID; procedure->prc_id = X.RDB$PROCEDURE_ID;
procedure->prc_name = procedure->prc_data; procedure->prc_name = procedure->prc_data;
@ -1037,8 +1037,8 @@ PRC METD_get_procedure(REQ request, STR name)
/* allocate the field block */ /* allocate the field block */
metd_exact_name(PR.RDB$PARAMETER_NAME); metd_exact_name(PR.RDB$PARAMETER_NAME);
parameter = (FLD) ALLOCV(type_fld, dbb->dbb_pool, parameter = new(*dbb->dbb_pool,
strlen(PR.RDB$PARAMETER_NAME)); strlen(PR.RDB$PARAMETER_NAME)) fld;
parameter->fld_next = *ptr; parameter->fld_next = *ptr;
*ptr = parameter; *ptr = parameter;
@ -1107,8 +1107,7 @@ PRC METD_get_procedure(REQ request, STR name)
procedure->prc_next = dbb->dbb_procedures; procedure->prc_next = dbb->dbb_procedures;
dbb->dbb_procedures = procedure; dbb->dbb_procedures = procedure;
symbol = procedure->prc_symbol = symbol = procedure->prc_symbol = new(*dbb->dbb_pool, 0) sym;
(SYM) ALLOCV(type_sym, dbb->dbb_pool, 0);
symbol->sym_object = (BLK) procedure; symbol->sym_object = (BLK) procedure;
symbol->sym_string = procedure->prc_name; symbol->sym_string = procedure->prc_name;
symbol->sym_length = name->str_length; symbol->sym_length = name->str_length;
@ -1135,7 +1134,7 @@ DSQL_REL METD_get_relation(REQ request, STR name)
* If it does, fetch field information as well. * If it does, fetch field information as well.
* *
**************************************/ **************************************/
SLONG *DB, *gds__trans; SLONG *DB, *gds_trans;
DBB dbb; DBB dbb;
FLD field, *ptr; FLD field, *ptr;
DSQL_REL relation, temp; DSQL_REL relation, temp;
@ -1170,7 +1169,7 @@ DSQL_REL METD_get_relation(REQ request, STR name)
dbb = request->req_dbb; dbb = request->req_dbb;
DB = dbb->dbb_database_handle; DB = dbb->dbb_database_handle;
gds__trans = (SLONG*) request->req_trans; gds_trans = (SLONG*) request->req_trans;
relation = NULL; relation = NULL;
THREAD_EXIT; THREAD_EXIT;
@ -1186,15 +1185,14 @@ DSQL_REL METD_get_relation(REQ request, STR name)
metd_exact_name(X.RDB$OWNER_NAME); metd_exact_name(X.RDB$OWNER_NAME);
if (!X.RDB$RELATION_ID.NULL) { if (!X.RDB$RELATION_ID.NULL) {
relation = relation = new(*dbb->dbb_pool,
(DSQL_REL) ALLOCV(type_dsql_rel, dbb->dbb_pool, name->str_length + strlen(X.RDB$OWNER_NAME)) dsql_rel;
name->str_length + strlen(X.RDB$OWNER_NAME));
relation->rel_id = X.RDB$RELATION_ID; relation->rel_id = X.RDB$RELATION_ID;
} }
else if (!DDL_ids(request)) { else if (!DDL_ids(request)) {
relation = relation =
(DSQL_REL) ALLOCDV(type_dsql_rel, new(*tdsql->tsql_default,
name->str_length + strlen(X.RDB$OWNER_NAME)); name->str_length + strlen(X.RDB$OWNER_NAME)) dsql_rel;
relation->rel_flags |= REL_new_relation; relation->rel_flags |= REL_new_relation;
} }
@ -1245,11 +1243,11 @@ DSQL_REL METD_get_relation(REQ request, STR name)
/* Allocate from default or permanent pool as appropriate */ /* Allocate from default or permanent pool as appropriate */
if (relation->rel_flags & REL_new_relation) if (relation->rel_flags & REL_new_relation)
*ptr = field = (FLD) ALLOCDV(type_fld, *ptr = field = new(*tdsql->tsql_default,
strlen(RFR.RDB$FIELD_NAME)); strlen(RFR.RDB$FIELD_NAME)) fld;
else else
*ptr = field = (FLD) ALLOCV(type_fld, dbb->dbb_pool, *ptr = field = new(*dbb->dbb_pool,
strlen(RFR.RDB$FIELD_NAME)); strlen(RFR.RDB$FIELD_NAME)) fld;
ptr = &field->fld_next; ptr = &field->fld_next;
/* get field information */ /* get field information */
@ -1296,11 +1294,11 @@ DSQL_REL METD_get_relation(REQ request, STR name)
/* Allocate from default or permanent pool as appropriate */ /* Allocate from default or permanent pool as appropriate */
if (relation->rel_flags & REL_new_relation) if (relation->rel_flags & REL_new_relation)
*ptr = field = (FLD) ALLOCDV(type_fld, *ptr = field = new(*tdsql->tsql_default,
strlen(RFR.RDB$FIELD_NAME)); strlen(RFR.RDB$FIELD_NAME)) fld;
else else
*ptr = field = (FLD) ALLOCV(type_fld, dbb->dbb_pool, *ptr = field = new(*dbb->dbb_pool,
strlen(RFR.RDB$FIELD_NAME)); strlen(RFR.RDB$FIELD_NAME)) fld;
ptr = &field->fld_next; ptr = &field->fld_next;
@ -1373,8 +1371,7 @@ DSQL_REL METD_get_relation(REQ request, STR name)
/* store in the symbol table unless the relation is not yet committed */ /* store in the symbol table unless the relation is not yet committed */
symbol = relation->rel_symbol = symbol = relation->rel_symbol = new(*dbb->dbb_pool, 0) sym;
(SYM) ALLOCV(type_sym, dbb->dbb_pool, 0);
symbol->sym_object = (BLK) relation; symbol->sym_object = (BLK) relation;
symbol->sym_string = relation->rel_name; symbol->sym_string = relation->rel_name;
symbol->sym_length = name->str_length; symbol->sym_length = name->str_length;
@ -1399,13 +1396,13 @@ STR METD_get_trigger_relation(REQ request, STR name, USHORT * trig_type)
* Look up a trigger's relation and return it's current type * Look up a trigger's relation and return it's current type
* *
**************************************/ **************************************/
SLONG *DB, *gds__trans; SLONG *DB, *gds_trans;
DBB dbb; DBB dbb;
STR relation; STR relation;
dbb = request->req_dbb; dbb = request->req_dbb;
DB = dbb->dbb_database_handle; DB = dbb->dbb_database_handle;
gds__trans = (SLONG*) request->req_trans; gds_trans = (SLONG*) request->req_trans;
relation = NULL; relation = NULL;
@ -1444,13 +1441,13 @@ USHORT METD_get_type(REQ request, STR name, UCHAR * field, SSHORT * value)
* Look up a symbolic name in RDB$TYPES * Look up a symbolic name in RDB$TYPES
* *
**************************************/ **************************************/
SLONG *DB, *gds__trans; SLONG *DB, *gds_trans;
DBB dbb; DBB dbb;
USHORT found; USHORT found;
dbb = request->req_dbb; dbb = request->req_dbb;
DB = dbb->dbb_database_handle; DB = dbb->dbb_database_handle;
gds__trans = (SLONG*) request->req_trans; gds_trans = (SLONG*) request->req_trans;
found = FALSE; found = FALSE;
@ -1494,13 +1491,13 @@ DSQL_REL METD_get_view_relation(REQ request,
* *
**************************************/ **************************************/
DBB dbb; DBB dbb;
SLONG *DB, *gds__trans; SLONG *DB, *gds_trans;
STR relation_name; STR relation_name;
DSQL_REL relation; DSQL_REL relation;
dbb = request->req_dbb; dbb = request->req_dbb;
DB = dbb->dbb_database_handle; DB = dbb->dbb_database_handle;
gds__trans = (SLONG*) request->req_trans; gds_trans = (SLONG*) request->req_trans;
relation = NULL; relation = NULL;
@ -1519,7 +1516,7 @@ DSQL_REL METD_get_view_relation(REQ request,
relation_name = MAKE_string((UCHAR*) X.RDB$RELATION_NAME, relation_name = MAKE_string((UCHAR*) X.RDB$RELATION_NAME,
strlen(X.RDB$RELATION_NAME)); strlen(X.RDB$RELATION_NAME));
relation = METD_get_relation(request, relation_name); relation = METD_get_relation(request, relation_name);
ALLD_release((FRB)relation_name); delete relation_name;
return relation; return relation;
} }
@ -1554,12 +1551,12 @@ static void check_array( REQ request, TEXT * field_name, FLD field)
* so in the database block to avoid wasting further effort. * so in the database block to avoid wasting further effort.
* *
**************************************/ **************************************/
SLONG *DB, *gds__trans; SLONG *DB, *gds_trans;
DBB dbb; DBB dbb;
dbb = request->req_dbb; dbb = request->req_dbb;
DB = dbb->dbb_database_handle; DB = dbb->dbb_database_handle;
gds__trans = (SLONG*) request->req_trans; gds_trans = (SLONG*) request->req_trans;
THREAD_EXIT; THREAD_EXIT;
@ -1643,18 +1640,18 @@ static void free_procedure( PRC procedure)
for (param = procedure->prc_inputs; param;) { for (param = procedure->prc_inputs; param;) {
temp = param; temp = param;
param = param->fld_next; param = param->fld_next;
ALLD_release((FRB) temp); delete temp;
} }
for (param = procedure->prc_outputs; param;) { for (param = procedure->prc_outputs; param;) {
temp = param; temp = param;
param = param->fld_next; param = param->fld_next;
ALLD_release((FRB) temp); delete temp;
} }
/* release the procedure & symbol blocks */ /* release the procedure & symbol blocks */
ALLD_release((FRB) procedure); delete procedure;
} }
@ -1677,12 +1674,12 @@ static void free_relation( DSQL_REL relation)
for (field = relation->rel_fields; field;) { for (field = relation->rel_fields; field;) {
temp = field; temp = field;
field = field->fld_next; field = field->fld_next;
ALLD_release((FRB) temp); delete temp;
} }
/* release the relation & symbol blocks */ /* release the relation & symbol blocks */
ALLD_release((FRB) relation); delete relation;
} }

View File

@ -24,28 +24,21 @@
#ifndef _DSQL_METD_PROTO_H #ifndef _DSQL_METD_PROTO_H
#define _DSQL_METD_PROTO_H #define _DSQL_METD_PROTO_H
#ifdef __cplusplus void METD_drop_procedure(class req*, class str*);
extern "C" { void METD_drop_relation(class req*, class str*);
#endif INTLSYM METD_get_charset(class req*, USHORT, UCHAR *);
INTLSYM METD_get_collation(class req*, class str*);
void METD_drop_procedure(struct req*, struct str *);
void METD_drop_relation(struct req*, struct str *);
INTLSYM METD_get_charset(struct req*, USHORT, UCHAR *);
INTLSYM METD_get_collation(struct req*, struct str *);
void METD_get_col_default(REQ, TEXT*, TEXT*, BOOLEAN*, TEXT*, USHORT); void METD_get_col_default(REQ, TEXT*, TEXT*, BOOLEAN*, TEXT*, USHORT);
STR METD_get_default_charset(struct req*); STR METD_get_default_charset(class req*);
USHORT METD_get_domain(struct req*, struct fld*, UCHAR*); USHORT METD_get_domain(class req*, class fld*, UCHAR*);
void METD_get_domain_default(REQ, TEXT*, BOOLEAN*, TEXT*, USHORT); void METD_get_domain_default(class req*, TEXT*, BOOLEAN*, TEXT*, USHORT);
UDF METD_get_function(struct req*, struct str*); UDF METD_get_function(class req*, class str*);
NOD METD_get_primary_key(struct req*, struct str*); NOD METD_get_primary_key(class req*, class str*);
PRC METD_get_procedure(struct req*, struct str*); PRC METD_get_procedure(class req*, class str*);
DSQL_REL METD_get_relation(struct req*, struct str*); DSQL_REL METD_get_relation(class req*, class str*);
STR METD_get_trigger_relation(struct req*, struct str*, USHORT*); STR METD_get_trigger_relation(class req*, class str*, USHORT*);
USHORT METD_get_type(struct req*, struct str*, UCHAR*, SSHORT*); USHORT METD_get_type(class req*, class str*, UCHAR*, SSHORT*);
DSQL_REL METD_get_view_relation(struct req*, UCHAR*, UCHAR*, USHORT); DSQL_REL METD_get_view_relation(class req*, UCHAR*, UCHAR*, USHORT);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*_DSQL_METD_PROTO_H */ #endif /*_DSQL_METD_PROTO_H */

View File

@ -30,6 +30,7 @@
typedef ENUM nod_t typedef ENUM nod_t
{ {
nod_unknown_type = 0,
nod_commit = 1, /* Commands, not executed. */ nod_commit = 1, /* Commands, not executed. */
nod_rollback, nod_rollback,
nod_trans, nod_trans,
@ -301,14 +302,18 @@ typedef ENUM nod_t
/* definition of a syntax node created both /* definition of a syntax node created both
in parsing and in context recognition */ in parsing and in context recognition */
typedef struct nod { class nod : public pool_alloc_rpt<class nod*, dsql_type_nod>
struct blk nod_header; {
public:
NOD_TYPE nod_type; /* Type of node */ NOD_TYPE nod_type; /* Type of node */
DSC nod_desc; /* Descriptor */ DSC nod_desc; /* Descriptor */
USHORT nod_count; /* Number of arguments */ USHORT nod_count; /* Number of arguments */
USHORT nod_flags; USHORT nod_flags;
struct nod *nod_arg[1]; struct nod *nod_arg[1];
} *NOD;
nod() : nod_type(nod_unknown_type), nod_count(0), nod_flags(0) {}
};
typedef nod *NOD;
/* values of flags */ /* values of flags */

View File

@ -93,12 +93,16 @@ static CONST UCHAR
static CONST UCHAR static CONST UCHAR
NULL_STRING [] = ""; NULL_STRING [] = "";
extern "C" {
#ifndef SHLIB_DEFS #ifndef SHLIB_DEFS
NOD DSQL_parse; NOD DSQL_parse;
#else #else
extern NOD DSQL_parse; extern NOD DSQL_parse;
#endif #endif
} // extern "C"
static FLD field; static FLD field;
static FIL file; static FIL file;
static NOD field_name; static NOD field_name;
@ -147,6 +151,9 @@ static SSHORT log_defined, cache_defined;
#define DATABASE 295 #define DATABASE 295
#define DATE 296 #define DATE 296
#define DB_KEY 297 #define DB_KEY 297
#ifdef DEBUG
#undef DEBUG
#endif
#define DEBUG 298 #define DEBUG 298
#define DECIMAL 299 #define DECIMAL 299
#define DECLARE 300 #define DECLARE 300
@ -3392,9 +3399,9 @@ static NOD make_list (NOD);
static NOD make_node (NOD_TYPE, int, ...); static NOD make_node (NOD_TYPE, int, ...);
static NOD make_flag_node (NOD_TYPE, SSHORT, int, ...); static NOD make_flag_node (NOD_TYPE, SSHORT, int, ...);
static BOOLEAN short_int (NOD, SLONG *, SSHORT); static BOOLEAN short_int (NOD, SLONG *, SSHORT);
static void stack_nodes (NOD, LLS *); static void stack_nodes (NOD, DLLS*);
static int yylex (USHORT, USHORT, USHORT, BOOLEAN *); static int yylex (USHORT, USHORT, USHORT, BOOLEAN *);
static void yyerror (TEXT *); static void yyerror (TEXT*);
static void yyabandon (SSHORT, STATUS); static void yyabandon (SSHORT, STATUS);
#ifndef WINDOWS_ONLY #ifndef WINDOWS_ONLY
static void check_log_file_attrs (void); static void check_log_file_attrs (void);
@ -3403,6 +3410,12 @@ static void check_log_file_attrs (void);
static TEXT *ptr, *end, *last_token, *line_start; static TEXT *ptr, *end, *last_token, *line_start;
static SSHORT lines, att_charset; static SSHORT lines, att_charset;
// TMN: Temp hack
#if defined(_MSC_VER) && defined(CONST)
#undef CONST
#define CONST
#endif
typedef struct tok { typedef struct tok {
USHORT tok_ident; USHORT tok_ident;
CONST SCHAR *tok_string; CONST SCHAR *tok_string;
@ -3433,18 +3446,18 @@ CONST TOK *token;
for (token = tokens; token->tok_string; ++token) for (token = tokens; token->tok_string; ++token)
{ {
SYM symbol; SYM symbol;
STR str; STR str_;
symbol = (SYM) ALLOCPV (type_sym, 0); symbol = new(*DSQL_permanent_pool, 0) sym;
symbol->sym_string = (TEXT *) token->tok_string; symbol->sym_string = (TEXT *) token->tok_string;
symbol->sym_length = strlen (token->tok_string); symbol->sym_length = strlen (token->tok_string);
symbol->sym_type = SYM_keyword; symbol->sym_type = SYM_keyword;
symbol->sym_keyword = token->tok_ident; symbol->sym_keyword = token->tok_ident;
symbol->sym_version = token->tok_version; symbol->sym_version = token->tok_version;
str = (STR) ALLOCPV (type_str, symbol->sym_length); str_ = new(*DSQL_permanent_pool, symbol->sym_length) str;
str->str_length = symbol->sym_length; str_->str_length = symbol->sym_length;
strncpy ((char*)str->str_data, (char*)symbol->sym_string, symbol->sym_length); strncpy ((char*)str_->str_data, (char*)symbol->sym_string, symbol->sym_length);
symbol->sym_object = (void *) str; symbol->sym_object = (void *) str_;
HSHD_insert (symbol); HSHD_insert (symbol);
} }
@ -3580,12 +3593,12 @@ tdsql = GET_THREAD_DATA;
if (field_name == NULL) if (field_name == NULL)
{ {
field = (FLD) ALLOCDV (type_fld, sizeof (INTERNAL_FIELD_NAME)); field = new(*tdsql->tsql_default, sizeof (INTERNAL_FIELD_NAME)) fld;
strcpy (field->fld_name, (TEXT*) INTERNAL_FIELD_NAME); strcpy (field->fld_name, (TEXT*) INTERNAL_FIELD_NAME);
return field; return field;
} }
string = (STR) field_name->nod_arg [1]; string = (STR) field_name->nod_arg [1];
field = (FLD) ALLOCDV (type_fld, strlen ((SCHAR*) string->str_data)); field = new(*tdsql->tsql_default, strlen ((SCHAR*) string->str_data)) fld;
strcpy (field->fld_name, (TEXT*) string->str_data); strcpy (field->fld_name, (TEXT*) string->str_data);
return field; return field;
@ -3609,7 +3622,7 @@ TSQL tdsql;
tdsql = GET_THREAD_DATA; tdsql = GET_THREAD_DATA;
temp_file = (FIL) ALLOCD (type_fil); temp_file = new(*tdsql->tsql_default) fil;
return temp_file; return temp_file;
} }
@ -3628,8 +3641,8 @@ static NOD make_list (
* Collapse nested list nodes into single list. * Collapse nested list nodes into single list.
* *
**************************************/ **************************************/
NOD *ptr; NOD* ptr;
LLS stack, temp; DLLS stack, temp;
USHORT l; USHORT l;
NOD old; NOD old;
TSQL tdsql; TSQL tdsql;
@ -3645,7 +3658,7 @@ for (l = 0, temp = stack; temp; temp = temp->lls_next)
l++; l++;
old = node; old = node;
node = (NOD) ALLOCDV (type_nod, l); node = new(*tdsql->tsql_default, l) nod;
node->nod_count = l; node->nod_count = l;
node->nod_type = nod_list; node->nod_type = nod_list;
node->nod_flags = old->nod_flags; node->nod_flags = old->nod_flags;
@ -3680,7 +3693,7 @@ TSQL tdsql;
tdsql = GET_THREAD_DATA; tdsql = GET_THREAD_DATA;
node = (NOD) ALLOCDV (type_nod, count); node = new (*tdsql->tsql_default, count) nod;
node->nod_type = type; node->nod_type = type;
node->nod_count = count; node->nod_count = count;
p = node->nod_arg; p = node->nod_arg;
@ -3715,7 +3728,7 @@ TSQL tdsql;
tdsql = GET_THREAD_DATA; tdsql = GET_THREAD_DATA;
node = (NOD) ALLOCDV (type_nod, count); node = new(*tdsql->tsql_default, count) nod;
node->nod_type = type; node->nod_type = type;
node->nod_flags = flag; node->nod_flags = flag;
node->nod_count = count; node->nod_count = count;
@ -3786,7 +3799,7 @@ return !return_value;
static void stack_nodes ( static void stack_nodes (
NOD node, NOD node,
LLS *stack) DLLS *stack)
{ {
/************************************** /**************************************
* *
@ -4357,7 +4370,6 @@ dsql_yyparse(USHORT client_dialect, USHORT db_dialect, USHORT parser_version, BO
register int yym, yyn, yystate; register int yym, yyn, yystate;
#if YYDEBUG #if YYDEBUG
register char *yys; register char *yys;
extern char *getenv();
if (yys = getenv("YYDEBUG")) if (yys = getenv("YYDEBUG"))
{ {
@ -4418,13 +4430,13 @@ yyloop:
if (DSQL_yyerrflag) goto yyinrecovery; if (DSQL_yyerrflag) goto yyinrecovery;
#ifdef lint #ifdef lint
goto yynewerror; goto yynewerror;
#endif
yynewerror: yynewerror:
#endif
yyerror("syntax error"); yyerror("syntax error");
#ifdef lint #ifdef lint
goto yyerrlab; goto yyerrlab;
#endif
yyerrlab: yyerrlab:
#endif
++yynerrs; ++yynerrs;
yyinrecovery: yyinrecovery:
if (DSQL_yyerrflag < 3) if (DSQL_yyerrflag < 3)

View File

@ -3352,7 +3352,7 @@ static NOD make_list (NOD);
static NOD make_node (NOD_TYPE, int, ...); static NOD make_node (NOD_TYPE, int, ...);
static NOD make_flag_node (NOD_TYPE, SSHORT, int, ...); static NOD make_flag_node (NOD_TYPE, SSHORT, int, ...);
static BOOLEAN short_int (NOD, SLONG *, SSHORT); static BOOLEAN short_int (NOD, SLONG *, SSHORT);
static void stack_nodes (NOD, LLS *); static void stack_nodes (NOD, DLLS *);
static int yylex (USHORT, USHORT, USHORT, BOOLEAN *); static int yylex (USHORT, USHORT, USHORT, BOOLEAN *);
static void yyerror (TEXT *); static void yyerror (TEXT *);
static void yyabandon (SSHORT, STATUS); static void yyabandon (SSHORT, STATUS);
@ -3393,18 +3393,18 @@ CONST TOK *token;
for (token = tokens; token->tok_string; ++token) for (token = tokens; token->tok_string; ++token)
{ {
SYM symbol; SYM symbol;
STR str; STR str_;
symbol = (SYM) ALLOCPV (type_sym, 0); symbol = new(*DSQL_permanent_pool, 0) sym;
symbol->sym_string = (TEXT *) token->tok_string; symbol->sym_string = (TEXT *) token->tok_string;
symbol->sym_length = strlen (token->tok_string); symbol->sym_length = strlen (token->tok_string);
symbol->sym_type = SYM_keyword; symbol->sym_type = SYM_keyword;
symbol->sym_keyword = token->tok_ident; symbol->sym_keyword = token->tok_ident;
symbol->sym_version = token->tok_version; symbol->sym_version = token->tok_version;
str = (STR) ALLOCPV (type_str, symbol->sym_length); str_ = new(*DSQL_permanent_pool, symbol->sym_length) str;
str->str_length = symbol->sym_length; str_->str_length = symbol->sym_length;
strncpy ((char*)str->str_data, (char*)symbol->sym_string, symbol->sym_length); strncpy ((char*)str_->str_data, (char*)symbol->sym_string, symbol->sym_length);
symbol->sym_object = (void *) str; symbol->sym_object = (void *) str_;
HSHD_insert (symbol); HSHD_insert (symbol);
} }
@ -3540,12 +3540,12 @@ tdsql = GET_THREAD_DATA;
if (field_name == NULL) if (field_name == NULL)
{ {
field = (FLD) ALLOCDV (type_fld, sizeof (INTERNAL_FIELD_NAME)); field = new (*tdsql->tsql_default, sizeof (INTERNAL_FIELD_NAME)) fld;
strcpy (field->fld_name, (TEXT*) INTERNAL_FIELD_NAME); strcpy (field->fld_name, (TEXT*) INTERNAL_FIELD_NAME);
return field; return field;
} }
string = (STR) field_name->nod_arg [1]; string = (STR) field_name->nod_arg [1];
field = (FLD) ALLOCDV (type_fld, strlen ((SCHAR*) string->str_data)); field = new(*tdsql->tsql_default, strlen ((SCHAR*) string->str_data)) fld;
strcpy (field->fld_name, (TEXT*) string->str_data); strcpy (field->fld_name, (TEXT*) string->str_data);
return field; return field;
@ -3569,7 +3569,7 @@ TSQL tdsql;
tdsql = GET_THREAD_DATA; tdsql = GET_THREAD_DATA;
temp_file = (FIL) ALLOCD (type_fil); temp_file = new(*tdsql->tsql_default) fil;
return temp_file; return temp_file;
} }
@ -3589,7 +3589,7 @@ static NOD make_list (
* *
**************************************/ **************************************/
NOD *ptr; NOD *ptr;
LLS stack, temp; DLLS stack, temp;
USHORT l; USHORT l;
NOD old; NOD old;
TSQL tdsql; TSQL tdsql;
@ -3605,7 +3605,7 @@ for (l = 0, temp = stack; temp; temp = temp->lls_next)
l++; l++;
old = node; old = node;
node = (NOD) ALLOCDV (type_nod, l); node = new(*tdsql->tsql_default, l) nod;
node->nod_count = l; node->nod_count = l;
node->nod_type = nod_list; node->nod_type = nod_list;
node->nod_flags = old->nod_flags; node->nod_flags = old->nod_flags;
@ -3640,7 +3640,7 @@ TSQL tdsql;
tdsql = GET_THREAD_DATA; tdsql = GET_THREAD_DATA;
node = (NOD) ALLOCDV (type_nod, count); node = new(*tdsql->tsql_default, count) nod;
node->nod_type = type; node->nod_type = type;
node->nod_count = count; node->nod_count = count;
p = node->nod_arg; p = node->nod_arg;
@ -3675,7 +3675,7 @@ TSQL tdsql;
tdsql = GET_THREAD_DATA; tdsql = GET_THREAD_DATA;
node = (NOD) ALLOCDV (type_nod, count); node = new(*tdsql->tsql_default, count) nod;
node->nod_type = type; node->nod_type = type;
node->nod_flags = flag; node->nod_flags = flag;
node->nod_count = count; node->nod_count = count;
@ -3746,7 +3746,7 @@ return !return_value;
static void stack_nodes ( static void stack_nodes (
NOD node, NOD node,
LLS *stack) DLLS *stack)
{ {
/************************************** /**************************************
* *

File diff suppressed because it is too large Load Diff

View File

@ -42,7 +42,6 @@
#include "../include/fb_types.h" #include "../include/fb_types.h"
#endif #endif
typedef struct typedef struct
{ {
SSHORT sqltype; SSHORT sqltype;

View File

@ -39,8 +39,8 @@ typedef ENUM sym_type {
/* symbol block */ /* symbol block */
typedef struct sym { class sym : public pool_alloc_rpt<UCHAR, dsql_type_sym> {
struct blk sym_header; public:
void *sym_dbb; /* generic DB structure handle */ void *sym_dbb; /* generic DB structure handle */
TEXT *sym_string; /* address of asciz string */ TEXT *sym_string; /* address of asciz string */
USHORT sym_length; /* length of string (exc. term.) */ USHORT sym_length; /* length of string (exc. term.) */
@ -51,6 +51,7 @@ typedef struct sym {
struct sym *sym_homonym; /* homonym pointer */ struct sym *sym_homonym; /* homonym pointer */
TEXT sym_name[2]; /* space for name, if necessary */ TEXT sym_name[2]; /* space for name, if necessary */
USHORT sym_version; /* dialect version the symbol was introduced */ USHORT sym_version; /* dialect version the symbol was introduced */
} *SYM; };
typedef sym *SYM;
#endif /* _DSQL_SYM_H_ */ #endif /* _DSQL_SYM_H_ */

View File

@ -654,9 +654,7 @@ STATUS API_ROUTINE isc_embed_dsql_prepare(STATUS* user_status,
init(db_handle); init(db_handle);
set_global_private_status(user_status, local_status); set_global_private_status(user_status, local_status);
if (SETJMP(UDSQL_error->dsql_env)) { try {
return error();
}
NAME name = lookup_name(stmt_name, statement_names); NAME name = lookup_name(stmt_name, statement_names);
@ -708,7 +706,7 @@ STATUS API_ROUTINE isc_embed_dsql_prepare(STATUS* user_status,
if (!statement) if (!statement)
{ {
statement = (STMT) gds__alloc((SLONG) sizeof(struct stmt)); statement = (STMT) gds__alloc((SLONG) sizeof(stmt));
/* FREE: by user calling isc_embed_dsql_release() */ /* FREE: by user calling isc_embed_dsql_release() */
if (!statement) /* NOMEM: */ if (!statement) /* NOMEM: */
error_post(isc_virmemexh, 0); error_post(isc_virmemexh, 0);
@ -731,6 +729,13 @@ STATUS API_ROUTINE isc_embed_dsql_prepare(STATUS* user_status,
statement->stmt_cursor = NULL; statement->stmt_cursor = NULL;
return s; return s;
} // try
catch (...)
{
return error();
}
} }
@ -1437,7 +1442,7 @@ static void error_post(STATUS status, ...)
// Give up whatever we were doing and return to the user. // Give up whatever we were doing and return to the user.
LONGJMP(UDSQL_error->dsql_env, (int) UDSQL_error->dsql_status[1]); Firebird::status_longjmp_error::raise(UDSQL_error->dsql_status[1]);
} }
@ -1450,7 +1455,7 @@ static void init(HNDL* db_handle)
// If we haven't been initialized yet, do it now // If we haven't been initialized yet, do it now
if (!init_flag) if (!init_flag)
{ {
UDSQL_error = (ERR) gds__alloc((SLONG) sizeof(struct err)); UDSQL_error = (ERR) gds__alloc((SLONG) sizeof(err));
// FREE: by exit cleanup() // FREE: by exit cleanup()
if (!UDSQL_error) { // NOMEM: if (!UDSQL_error) { // NOMEM:
return; // Don't set the init_flag return; // Don't set the init_flag
@ -1470,7 +1475,7 @@ static void init(HNDL* db_handle)
} }
} }
dbb = (DBB) gds__alloc((SLONG) sizeof(struct dbb)); dbb = (DBB) gds__alloc((SLONG) sizeof(dbb));
// FREE: by database exit handler cleanup_database() // FREE: by database exit handler cleanup_database()
if (!dbb) { // NOMEM if (!dbb) { // NOMEM
@ -1506,7 +1511,7 @@ static NAME insert_name( TEXT * symbol, NAME* list_ptr, STMT stmt)
TEXT *p; TEXT *p;
l = name_length(symbol); l = name_length(symbol);
name = (NAME) gds__alloc((SLONG) sizeof(struct name) + l); name = (NAME) gds__alloc((SLONG) sizeof(name) + l);
/* FREE: by exit handler cleanup() or database_cleanup() */ /* FREE: by exit handler cleanup() or database_cleanup() */
if (!name) /* NOMEM: */ if (!name) /* NOMEM: */
error_post(gds_virmemexh, 0); error_post(gds_virmemexh, 0);

View File

@ -21,7 +21,7 @@
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
*/ */
/* /*
$Id: utld.cpp,v 1.2 2001-07-29 23:43:21 skywalker Exp $ $Id: utld.cpp,v 1.3 2001-12-24 02:50:48 tamlin Exp $
*/ */
#include "firebird.h" #include "firebird.h"

View File

@ -110,7 +110,7 @@ static struct in_sw_tab_t gdef_in_sw_table[] = {
IN_SW_GDEF_0, 0, NULL, 0, 0, 0, FALSE, 0, 0, NULL IN_SW_GDEF_0, 0, NULL, 0, 0, 0, FALSE, 0, 0, NULL
}; };
#ifndef SUPERSERVER
int CLIB_ROUTINE main( int argc, char *argv[]) int CLIB_ROUTINE main( int argc, char *argv[])
{ {
/************************************** /**************************************
@ -475,7 +475,7 @@ int CLIB_ROUTINE main( int argc, char *argv[])
DDL_exit(FINI_OK); DDL_exit(FINI_OK);
} }
#endif
UCHAR *DDL_alloc(register int size) UCHAR *DDL_alloc(register int size)
{ {

View File

@ -103,8 +103,7 @@ static void expand_action( ACT action)
/* Set up an environment to catch syntax errors. If one occurs, scan looking /* Set up an environment to catch syntax errors. If one occurs, scan looking
for semi-colon to continue processing. */ for semi-colon to continue processing. */
if (setjmp(exp_env)) try {
return;
DDL_line = action->act_line; DDL_line = action->act_line;
@ -192,6 +191,11 @@ static void expand_action( ACT action)
default: default:
DDL_msg_put(97, NULL, NULL, NULL, NULL, NULL); /* msg 97: object can not be resolved */ DDL_msg_put(97, NULL, NULL, NULL, NULL, NULL); /* msg 97: object can not be resolved */
} }
} // try
catch (...) {
}
return; return;
} }
@ -213,7 +217,7 @@ static void expand_error(
**************************************/ **************************************/
DDL_err(number, arg1, arg2, arg3, arg4, arg5); DDL_err(number, arg1, arg2, arg3, arg4, arg5);
longjmp(exp_env, TRUE); Firebird::status_longjmp_error::raise(TRUE);
} }

View File

@ -196,7 +196,7 @@ void PARSE_error( USHORT number, TEXT * arg1, TEXT * arg2)
**************************************/ **************************************/
DDL_err(number, arg1, arg2, NULL, NULL, NULL); DDL_err(number, arg1, arg2, NULL, NULL, NULL);
longjmp(parse_env, TRUE); Firebird::status_longjmp_error::raise(TRUE);
} }
@ -2988,14 +2988,7 @@ static BOOLEAN parse_action(void)
/* Set up an environment to catch syntax errors. If one occurs, scan looking /* Set up an environment to catch syntax errors. If one occurs, scan looking
for semi-colon to continue processing. */ for semi-colon to continue processing. */
if (setjmp(parse_env)) { try {
if (DDL_interactive)
LEX_flush();
else
while (!DDL_eof && !KEYWORD(KW_SEMI))
LEX_token();
return TRUE;
}
DDL_prompt = PROMPT; DDL_prompt = PROMPT;
LEX_token(); LEX_token();
@ -3154,6 +3147,16 @@ static BOOLEAN parse_action(void)
PARSE_error(186, DDL_token.tok_string, 0); /* msg 186: expected command, encountered \"%s\" */ PARSE_error(186, DDL_token.tok_string, 0); /* msg 186: expected command, encountered \"%s\" */
return FALSE; return FALSE;
} // try
catch (...) {
if (DDL_interactive)
LEX_flush();
else
while (!DDL_eof && !KEYWORD(KW_SEMI))
LEX_token();
return TRUE;
}
} }

View File

@ -15,7 +15,7 @@
* *
* All Rights Reserved. * All Rights Reserved.
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
* $Id: ib_udf.sql,v 1.1.1.1 2001-05-23 13:25:38 tamlin Exp $ * $Id: ib_udf.sql,v 1.2 2001-12-24 02:50:48 tamlin Exp $
* Revision 1.2 2000/11/28 06:47:52 fsg * Revision 1.2 2000/11/28 06:47:52 fsg
* Changed declaration of ascii_char in ib_udf.sql * Changed declaration of ascii_char in ib_udf.sql
* to get correct result as proposed by Claudio Valderrama * to get correct result as proposed by Claudio Valderrama

View File

@ -16,11 +16,11 @@
* All Rights Reserved. * All Rights Reserved.
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
*/ */
#include "../include/fb_config.h" #include "../include/firebird.h"
#include <stdlib.h> #include <stdlib.h>
#include "ib_udf.h" #include "ib_udf.h"
void *EXPORT ib_util_malloc( long size) void* EXPORT ib_util_malloc(long size)
{ {
return malloc(size); return malloc(size);
} }

View File

@ -1,4 +1,9 @@
#include "firebird.h" #include "firebird.h"
#ifdef _MSC_VER
#pragma warning (disable: 4786) // debug identifier truncated
#endif
#include "FirebirdConfig.h" #include "FirebirdConfig.h"
#include "FirebirdConfigFile.h" #include "FirebirdConfigFile.h"
@ -22,7 +27,7 @@ static FirebirdConfigFile sysConfig;
// //
// //
string FirebirdConfig::getSysString(const string& key) { FirebirdConfig::string FirebirdConfig::getSysString(const FirebirdConfig::string& key) {
return sysConfig.getString(key); return sysConfig.getString(key);
} }
@ -31,7 +36,7 @@ string FirebirdConfig::getSysString(const string& key) {
// //
// //
int FirebirdConfig::getSysInt(const string& key) { int FirebirdConfig::getSysInt(const FirebirdConfig::string& key) {
return sysConfig.getInt(key); return sysConfig.getInt(key);
} }
@ -40,7 +45,7 @@ int FirebirdConfig::getSysInt(const string& key) {
// //
// //
bool FirebirdConfig::getSysBoolean(const string& key) { bool FirebirdConfig::getSysBoolean(const FirebirdConfig::string& key) {
return sysConfig.getBoolean(key); return sysConfig.getBoolean(key);
} }
@ -56,7 +61,7 @@ void FirebirdConfig::loadSysConfig() {
// //
// //
// //
const string FirebirdConfig::getSysConfigFile() { const Firebird::string FirebirdConfig::getSysConfigFile() {
return sysConfig.getConfigFile(); return sysConfig.getConfigFile();
} }
@ -64,7 +69,7 @@ const string FirebirdConfig::getSysConfigFile() {
// //
// //
// //
void FirebirdConfig::setSysConfigFile(const string& newFile) { void FirebirdConfig::setSysConfigFile(const FirebirdConfig::string& newFile) {
sysConfig.setConfigFile(newFile); sysConfig.setConfigFile(newFile);
} }

View File

@ -1,14 +1,14 @@
#ifndef _FirebirdConfig_H #ifndef FIREBIRDCONFIG_H
#define _FirebirdConfig_H #define FIREBIRDCONFIG_H
#include <iostream> #include "../include/fb_types.h"
#include <fstream> #include "../include/fb_string.h"
#include <string>
class FirebirdConfig
class FirebirdConfig { {
public: public:
typedef Firebird::string string;
static string getSysString(const string& key); static string getSysString(const string& key);
static int getSysInt(const string& key); static int getSysInt(const string& key);
@ -35,4 +35,4 @@ public:
}; };
#endif #endif // FIREBIRDCONFIG_H

View File

@ -1,10 +1,19 @@
#include "firebird.h" #include "firebird.h"
#ifdef _MSC_VER
#pragma warning (disable: 4786) // debug identifier truncated
#endif
#include "FirebirdConfigFile.h" #include "FirebirdConfigFile.h"
#include "../jrd/gds.h"
#include "../include/fb_macros.h"
#ifdef HAVE_STDLIB_H #ifdef HAVE_STDLIB_H
#include <stdlib.h> #include <stdlib.h>
#endif #endif
#include <fstream>
#include <iostream>
@ -16,6 +25,7 @@
FirebirdConfigFile::FirebirdConfigFile() FirebirdConfigFile::FirebirdConfigFile()
{ {
isLoadedFlg = false; isLoadedFlg = false;
#pragma FB_COMPILER_MESSAGE("Error! This is a *nix only thing!")
configFile = "/etc/firebird.conf"; configFile = "/etc/firebird.conf";
} }
@ -24,14 +34,14 @@ FirebirdConfigFile::FirebirdConfigFile()
// //
// //
void stripLeadingWhiteSpace(string& s) void stripLeadingWhiteSpace(FirebirdConfig::string& s)
{ {
if (!s.size()) { if (!s.size()) {
return; return;
} }
const string::size_type startPos = s.find_first_not_of(" \t"); const Firebird::string::size_type startPos = s.find_first_not_of(" \t");
if (startPos == string::npos) { if (startPos == Firebird::string::npos) {
s.erase(); // nothing but air s.erase(); // nothing but air
} else if (startPos) { } else if (startPos) {
s = s.substr(startPos); s = s.substr(startPos);
@ -43,14 +53,14 @@ void stripLeadingWhiteSpace(string& s)
// //
// //
void stripTrailingWhiteSpace(string& s) void stripTrailingWhiteSpace(FirebirdConfig::string& s)
{ {
if (!s.size()) { if (!s.size()) {
return; return;
} }
string::size_type endPos = s.find_last_not_of(" \t"); Firebird::string::size_type endPos = s.find_last_not_of(" \t");
if (endPos != string::npos) { if (endPos != std::string::npos) {
// Note that endPos is the index to the last non-ws char // Note that endPos is the index to the last non-ws char
// why we have to inc. it // why we have to inc. it
++endPos; ++endPos;
@ -63,13 +73,13 @@ void stripTrailingWhiteSpace(string& s)
// //
// //
void stripComments(string& s) void stripComments(FirebirdConfig::string& s)
{ {
// Note that this is only a hack. It won't work in case inputLine // Note that this is only a hack. It won't work in case inputLine
// contains hash-marks embedded in quotes! Not that I know if we // contains hash-marks embedded in quotes! Not that I know if we
// should care about that case. // should care about that case.
const string::size_type commentPos = s.find('#'); const Firebird::string::size_type commentPos = s.find('#');
if (commentPos != string::npos) { if (commentPos != Firebird::string::npos) {
s = s.substr(0, commentPos); s = s.substr(0, commentPos);
} }
} }
@ -80,7 +90,7 @@ void stripComments(string& s)
// //
// //
string FirebirdConfigFile::getString(const string& key) { FirebirdConfig::string FirebirdConfigFile::getString(const FirebirdConfig::string& key) {
checkLoadConfig(); checkLoadConfig();
@ -92,7 +102,7 @@ string FirebirdConfigFile::getString(const string& key) {
return lookup->second; return lookup->second;
} }
return string(); return FirebirdConfig::string();
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -100,11 +110,11 @@ string FirebirdConfigFile::getString(const string& key) {
// //
// //
int FirebirdConfigFile::getInt(const string& key) { int FirebirdConfigFile::getInt(const FirebirdConfig::string& key) {
checkLoadConfig(); checkLoadConfig();
string data = getString(key); Firebird::string data = getString(key);
if (data.empty()) { if (data.empty()) {
return 0; return 0;
@ -119,7 +129,7 @@ int FirebirdConfigFile::getInt(const string& key) {
// //
// //
bool FirebirdConfigFile::getBoolean(const string& key) { bool FirebirdConfigFile::getBoolean(const FirebirdConfig::string& key) {
checkLoadConfig(); checkLoadConfig();
@ -144,10 +154,11 @@ bool FirebirdConfigFile::getBoolean(const string& key) {
// //
// //
string parseKeyFrom(const string& inputLine, string::size_type& endPos) { FirebirdConfig::string parseKeyFrom(const FirebirdConfig::string& inputLine,
FirebirdConfig::string::size_type& endPos) {
endPos = inputLine.find_first_of("= \t"); endPos = inputLine.find_first_of("= \t");
if (endPos == string::npos) { if (endPos == Firebird::string::npos) {
return inputLine; return inputLine;
} }
@ -161,16 +172,17 @@ string parseKeyFrom(const string& inputLine, string::size_type& endPos) {
// //
// //
string parseValueFrom(string inputLine, string::size_type initialPos) { FirebirdConfig::string parseValueFrom(FirebirdConfig::string inputLine,
FirebirdConfig::string::size_type initialPos) {
if (initialPos == string::npos) { if (initialPos == Firebird::string::npos) {
return string(); return Firebird::string();
} }
// skip leading white spaces // skip leading white spaces
unsigned int startPos = inputLine.find_first_not_of("= \t", initialPos); unsigned int startPos = inputLine.find_first_not_of("= \t", initialPos);
if (startPos == string::npos) { if (startPos == Firebird::string::npos) {
return string(); return Firebird::string();
} }
stripTrailingWhiteSpace(inputLine); stripTrailingWhiteSpace(inputLine);
@ -199,7 +211,7 @@ void FirebirdConfigFile::loadConfig() {
isLoadedFlg = true; isLoadedFlg = true;
ifstream configFile(configFile.c_str()); std::ifstream configFile(configFile.c_str());
if (!configFile) { if (!configFile) {
// config file does not exist, a warning message would be nice. // config file does not exist, a warning message would be nice.
@ -208,7 +220,7 @@ void FirebirdConfigFile::loadConfig() {
string inputLine; string inputLine;
while (!configFile.eof() ) { while (!configFile.eof() ) {
getline(configFile, inputLine); std::getline(configFile, inputLine);
stripComments(inputLine); stripComments(inputLine);
stripLeadingWhiteSpace(inputLine); stripLeadingWhiteSpace(inputLine);
@ -220,7 +232,7 @@ void FirebirdConfigFile::loadConfig() {
// cout << "read \"" << inputLine << "\"\n"; // cout << "read \"" << inputLine << "\"\n";
if (inputLine.find('=') == string::npos) { if (inputLine.find('=') == string::npos) {
cerr << "illegal line \"" << inputLine << "\"" << endl; std::cerr << "illegal line \"" << inputLine << "\"" << std::endl;
continue; continue;
} }
@ -229,10 +241,10 @@ void FirebirdConfigFile::loadConfig() {
string key = parseKeyFrom(inputLine, endPos); string key = parseKeyFrom(inputLine, endPos);
string value = parseValueFrom(inputLine, endPos); string value = parseValueFrom(inputLine, endPos);
cout << "adding \"" << key << "\" \"" << value << "\"" << endl; std::cout << "adding \"" << key << "\" \"" << value << "\"" << std::endl;
// parameters.insert(pair<string, string>(key, value)); // parameters.insert(pair<string, string>(key, value));
// Just to display yet another template function // Just to display yet another template function
parameters.insert(make_pair(key, value)); parameters.insert(std::make_pair(key, value));
} }
} }

View File

@ -1,17 +1,16 @@
#ifndef _FirebirdConfigFile_H #ifndef FIREBIRDCONFIGFILE_H
#define _FirebirdConfigFile_H #define FIREBIRDCONFIGFILE_H
#include <iostream>
#include <fstream>
#include <map> #include <map>
#include <string> #include "../include/fb_string.h"
#include "FirebirdConfig.h" #include "FirebirdConfig.h"
class FirebirdConfigFile : public FirebirdConfig {
public:
class FirebirdConfigFile : public FirebirdConfig
{
public:
FirebirdConfigFile(); FirebirdConfigFile();
const string getConfigFile() { return configFile; } const string getConfigFile() { return configFile; }
@ -29,11 +28,10 @@ public:
private: private:
string configFile; string configFile;
bool isLoadedFlg; bool isLoadedFlg;
typedef pair<string, string> mypair; typedef std::map<string, string> mymap_t;
typedef map<string, string> mymap_t;
mymap_t parameters; mymap_t parameters;
}; };
#endif #endif // FIREBIRDCONFIGFILE_H

View File

@ -24,7 +24,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: ada.cpp,v 1.3 2001-07-29 23:43:21 skywalker Exp $ // $Id: ada.cpp,v 1.4 2001-12-24 02:50:49 tamlin Exp $
// //
#include "firebird.h" #include "firebird.h"

View File

@ -25,7 +25,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: c_cxx.cpp,v 1.3 2001-07-29 23:43:21 skywalker Exp $ // $Id: c_cxx.cpp,v 1.4 2001-12-24 02:50:49 tamlin Exp $
// //
#include "firebird.h" #include "firebird.h"

View File

@ -25,7 +25,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: cmd.cpp,v 1.3 2001-07-29 23:43:21 skywalker Exp $ // $Id: cmd.cpp,v 1.4 2001-12-24 02:50:49 tamlin Exp $
// //
#include "firebird.h" #include "firebird.h"

View File

@ -25,7 +25,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: cme.cpp,v 1.2 2001-07-29 23:43:21 skywalker Exp $ // $Id: cme.cpp,v 1.3 2001-12-24 02:50:49 tamlin Exp $
// //
#include "firebird.h" #include "firebird.h"
@ -99,56 +99,56 @@ struct op_table
const op_table operators[] = const op_table operators[] =
{ {
nod_eq , blr_eql, { nod_eq , blr_eql },
nod_ge , blr_geq, { nod_ge , blr_geq },
nod_gt , blr_gtr, { nod_gt , blr_gtr },
nod_le , blr_leq, { nod_le , blr_leq },
nod_lt , blr_lss, { nod_lt , blr_lss },
nod_ne , blr_neq, { nod_ne , blr_neq },
nod_missing , blr_missing, { nod_missing , blr_missing },
nod_between , blr_between, { nod_between , blr_between },
nod_and , blr_and, { nod_and , blr_and },
nod_or , blr_or, { nod_or , blr_or },
nod_not , blr_not, { nod_not , blr_not },
nod_matches , blr_matching, { nod_matches , blr_matching },
nod_starting , blr_starting, { nod_starting , blr_starting },
nod_containing , blr_containing, { nod_containing , blr_containing },
nod_plus , blr_add, { nod_plus , blr_add },
nod_from , blr_from, { nod_from , blr_from },
nod_via , blr_via, { nod_via , blr_via },
nod_minus , blr_subtract, { nod_minus , blr_subtract },
nod_times , blr_multiply, { nod_times , blr_multiply },
nod_divide , blr_divide, { nod_divide , blr_divide },
nod_negate , blr_negate, { nod_negate , blr_negate },
nod_null , blr_null, { nod_null , blr_null },
nod_user_name , blr_user_name, { nod_user_name , blr_user_name },
// count2 // { count2 }
// nod_count, blr_count2, // { nod_count, blr_count2 },
// //
nod_count , blr_count, { nod_count , blr_count },
nod_max , blr_maximum, { nod_max , blr_maximum },
nod_min , blr_minimum, { nod_min , blr_minimum },
nod_average , blr_average, { nod_average , blr_average },
nod_total , blr_total, { nod_total , blr_total },
nod_any , blr_any, { nod_any , blr_any },
nod_unique , blr_unique, { nod_unique , blr_unique },
nod_agg_count , blr_agg_count2, { nod_agg_count , blr_agg_count2 },
nod_agg_count , blr_agg_count, { nod_agg_count , blr_agg_count },
nod_agg_max , blr_agg_max, { nod_agg_max , blr_agg_max },
nod_agg_min , blr_agg_min, { nod_agg_min , blr_agg_min },
nod_agg_total , blr_agg_total, { nod_agg_total , blr_agg_total },
nod_agg_average , blr_agg_average, { nod_agg_average , blr_agg_average },
nod_upcase , blr_upcase, { nod_upcase , blr_upcase },
nod_sleuth , blr_matching2, { nod_sleuth , blr_matching2 },
nod_concatenate , blr_concatenate, { nod_concatenate , blr_concatenate },
nod_cast , blr_cast, { nod_cast , blr_cast },
nod_ansi_any , blr_ansi_any, { nod_ansi_any , blr_ansi_any },
nod_gen_id , blr_gen_id, { nod_gen_id , blr_gen_id },
nod_ansi_all , blr_ansi_all, { nod_ansi_all , blr_ansi_all },
nod_current_date, blr_current_date, { nod_current_date, blr_current_date },
nod_current_time, blr_current_time, { nod_current_time, blr_current_time },
nod_current_timestamp, blr_current_timestamp, { nod_current_timestamp, blr_current_timestamp },
nod_any, 0 { nod_any, 0 }
}; };

View File

@ -25,7 +25,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: cmp.cpp,v 1.3 2001-07-29 23:43:21 skywalker Exp $ // $Id: cmp.cpp,v 1.4 2001-12-24 02:50:49 tamlin Exp $
// //
#include "firebird.h" #include "firebird.h"
@ -304,7 +304,6 @@ void CMP_compile_request( register REQ request)
case ACT_fetch: case ACT_fetch:
cmp_fetch(action); cmp_fetch(action);
break; break;
} }
cmp_blr(request); cmp_blr(request);
@ -1568,7 +1567,6 @@ static void cmp_sdl_fudge( REQ request, SLONG lower_bound)
} }
} }
//____________________________________________________________ //____________________________________________________________
// //
// Build an SDL loop for GET_SLICE/PUT_SLICE unless the upper and // Build an SDL loop for GET_SLICE/PUT_SLICE unless the upper and

View File

@ -25,10 +25,10 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: cob.cpp,v 1.3 2001-07-29 23:43:21 skywalker Exp $ // $Id: cob.cpp,v 1.4 2001-12-24 02:50:49 tamlin Exp $
// //
/* $Id: cob.cpp,v 1.3 2001-07-29 23:43:21 skywalker Exp $ */ /* $Id: cob.cpp,v 1.4 2001-12-24 02:50:49 tamlin Exp $ */
#include "firebird.h" #include "firebird.h"
#include "../jrd/ib_stdio.h" #include "../jrd/ib_stdio.h"

View File

@ -24,7 +24,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: dyntable.cpp,v 1.2 2001-07-29 23:43:21 skywalker Exp $ // $Id: dyntable.cpp,v 1.3 2001-12-24 02:50:49 tamlin Exp $
// //
#include "firebird.h" #include "firebird.h"

View File

@ -25,7 +25,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: exp.cpp,v 1.3 2001-07-29 23:43:22 skywalker Exp $ // $Id: exp.cpp,v 1.4 2001-12-24 02:50:49 tamlin Exp $
// //
#include "firebird.h" #include "firebird.h"
@ -90,32 +90,34 @@ static struct rel_ops {
enum kwwords rel_kw; enum kwwords rel_kw;
SSHORT rel_args; SSHORT rel_args;
} relops[] = { } relops[] = {
nod_eq, KW_EQ, 2, { nod_eq, KW_EQ, 2 },
nod_eq, KW_EQUALS, 2, { nod_eq, KW_EQUALS, 2 },
nod_ne, KW_NE, 2, { nod_ne, KW_NE, 2 },
nod_gt, KW_GT, 2, { nod_gt, KW_GT, 2 },
nod_ge, KW_GE, 2, { nod_ge, KW_GE, 2 },
nod_le, KW_LE, 2, { nod_le, KW_LE, 2 },
nod_lt, KW_LT, 2, { nod_lt, KW_LT, 2 },
nod_containing, KW_CONTAINING, 2, { nod_containing, KW_CONTAINING, 2 },
nod_matches, KW_MATCHES, 2, { nod_matches, KW_MATCHES, 2 },
nod_like, KW_LIKE, 2, { nod_like, KW_LIKE, 2 },
nod_starting, KW_STARTING, 2, { nod_starting, KW_STARTING, 2 },
nod_missing, KW_MISSING, 1, { nod_missing, KW_MISSING, 1 },
nod_between, KW_BETWEEN, 3, nod_any, KW_none}; { nod_between, KW_BETWEEN, 3}, { nod_any, KW_none, 0} };
static struct dtypes { static struct dtypes {
enum kwwords dtype_keyword; enum kwwords dtype_keyword;
USHORT dtype_dtype; USHORT dtype_dtype;
} data_types[] = { } data_types[] = {
KW_CHAR, dtype_text, { KW_CHAR, dtype_text },
KW_VARYING, dtype_varying, { KW_VARYING, dtype_varying },
KW_STRING, dtype_cstring, { KW_STRING, dtype_cstring },
KW_SHORT, dtype_short, { KW_SHORT, dtype_short },
KW_LONG, dtype_long, { KW_LONG, dtype_long },
KW_QUAD, dtype_quad, { KW_QUAD, dtype_quad },
KW_FLOAT, dtype_real, { KW_FLOAT, dtype_real },
KW_DOUBLE, dtype_double, KW_DATE, dtype_date, KW_none, 0}; { KW_DOUBLE, dtype_double },
{ KW_DATE, dtype_date },
{ KW_none, 0} };
//____________________________________________________________ //____________________________________________________________

View File

@ -20,7 +20,7 @@
// //
// All Rights Reserved. // All Rights Reserved.
// Contributor(s): ______________________________________. // Contributor(s): ______________________________________.
// $Id: form.cpp,v 1.3 2001-07-29 23:43:22 skywalker Exp $ // $Id: form.cpp,v 1.4 2001-12-24 02:50:49 tamlin Exp $
// Revision 1.2 2000/11/27 09:26:13 fsg // Revision 1.2 2000/11/27 09:26:13 fsg
// Fixed bugs in gpre to handle PYXIS forms // Fixed bugs in gpre to handle PYXIS forms
// and allow edit.e and fred.e to go through // and allow edit.e and fred.e to go through
@ -35,7 +35,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: form.cpp,v 1.3 2001-07-29 23:43:22 skywalker Exp $ // $Id: form.cpp,v 1.4 2001-12-24 02:50:49 tamlin Exp $
// //
#include "firebird.h" #include "firebird.h"

View File

@ -20,7 +20,7 @@
// //
// All Rights Reserved. // All Rights Reserved.
// Contributor(s): ______________________________________. // Contributor(s): ______________________________________.
// $Id: form_trn.cpp,v 1.2 2001-07-29 23:43:22 skywalker Exp $ // $Id: form_trn.cpp,v 1.3 2001-12-24 02:50:49 tamlin Exp $
// Revision 1.3 2000/11/29 11:11:56 fsg // Revision 1.3 2000/11/29 11:11:56 fsg
// Added some more PYXIS datatypes to form_trn.c // Added some more PYXIS datatypes to form_trn.c
// //
@ -38,7 +38,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: form_trn.cpp,v 1.2 2001-07-29 23:43:22 skywalker Exp $ // $Id: form_trn.cpp,v 1.3 2001-12-24 02:50:49 tamlin Exp $
// //
#include "firebird.h" #include "firebird.h"

View File

@ -24,7 +24,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: ftn.cpp,v 1.3 2001-07-29 23:43:22 skywalker Exp $ // $Id: ftn.cpp,v 1.4 2001-12-24 02:50:49 tamlin Exp $
// //
#include "firebird.h" #include "firebird.h"

View File

@ -20,7 +20,7 @@
// //
// All Rights Reserved. // All Rights Reserved.
// Contributor(s): ______________________________________. // Contributor(s): ______________________________________.
// $Id: gpre.cpp,v 1.5 2001-07-31 18:34:05 skywalker Exp $ // $Id: gpre.cpp,v 1.6 2001-12-24 02:50:49 tamlin Exp $
// Revision 1.2 2000/11/16 15:54:29 fsg // Revision 1.2 2000/11/16 15:54:29 fsg
// Added new switch -verbose to gpre that will dump // Added new switch -verbose to gpre that will dump
// parsed lines to stderr // parsed lines to stderr
@ -38,7 +38,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: gpre.cpp,v 1.5 2001-07-31 18:34:05 skywalker Exp $ // $Id: gpre.cpp,v 1.6 2001-12-24 02:50:49 tamlin Exp $
// //
#define GPRE_MAIN #define GPRE_MAIN
@ -158,70 +158,70 @@ typedef struct ext_table_t
static struct ext_table_t dml_ext_table[] = static struct ext_table_t dml_ext_table[] =
{ {
lang_c, IN_SW_GPRE_C, ".e", ".c", { lang_c, IN_SW_GPRE_C, ".e", ".c" },
#ifndef VMS #ifndef VMS
#ifndef WIN_NT #ifndef WIN_NT
lang_scxx, IN_SW_GPRE_SCXX, ".E", ".C", { lang_scxx, IN_SW_GPRE_SCXX, ".E", ".C" },
#endif #endif
#endif #endif
lang_cxx, IN_SW_GPRE_CXX, ".exx", ".cxx", { lang_cxx, IN_SW_GPRE_CXX, ".exx", ".cxx" },
lang_cpp, IN_SW_GPRE_CXX, ".epp", ".cpp", { lang_cpp, IN_SW_GPRE_CXX, ".epp", ".cpp" },
lang_internal, IN_SW_GPRE_G, ".e", ".c", { lang_internal, IN_SW_GPRE_G, ".e", ".c" },
lang_pascal, IN_SW_GPRE_P, ".epas", ".pas", { lang_pascal, IN_SW_GPRE_P, ".epas", ".pas" },
#ifdef FORTRAN #ifdef FORTRAN
#ifdef VMS #ifdef VMS
#define FORTRAN_EXTENSIONS #define FORTRAN_EXTENSIONS
lang_fortran, IN_SW_GPRE_F, ".efor", ".for", { lang_fortran, IN_SW_GPRE_F, ".efor", ".for" },
#endif #endif
#ifndef FORTRAN_EXTENSIONS #ifndef FORTRAN_EXTENSIONS
lang_fortran, IN_SW_GPRE_F, ".ef", ".f", { lang_fortran, IN_SW_GPRE_F, ".ef", ".f" },
#endif #endif
#endif #endif
#ifdef COBOL #ifdef COBOL
#ifdef VMS #ifdef VMS
#define COBOL_EXTENSIONS #define COBOL_EXTENSIONS
lang_cobol, IN_SW_GPRE_COB, ".ecob", ".cob", { lang_cobol, IN_SW_GPRE_COB, ".ecob", ".cob" },
#endif #endif
#ifndef COBOL_EXTENSIONS #ifndef COBOL_EXTENSIONS
#define COBOL_EXTENSIONS #define COBOL_EXTENSIONS
lang_cobol, IN_SW_GPRE_COB, ".ecbl", ".cbl", { lang_cobol, IN_SW_GPRE_COB, ".ecbl", ".cbl" },
#endif #endif
#endif #endif
#ifdef BASIC #ifdef BASIC
lang_basic, IN_SW_GPRE_BAS, ".ebas", ".bas", { lang_basic, IN_SW_GPRE_BAS, ".ebas", ".bas" },
#endif #endif
#ifdef PLI #ifdef PLI
lang_pli, IN_SW_GPRE_PLI, ".epli", ".pli", { lang_pli, IN_SW_GPRE_PLI, ".epli", ".pli" },
#endif #endif
#ifdef VMS #ifdef VMS
#define ADA_EXTENSIONS #define ADA_EXTENSIONS
lang_ada, IN_SW_GPRE_ADA, ".eada", ".ada", { lang_ada, IN_SW_GPRE_ADA, ".eada", ".ada" },
#endif #endif
#ifdef hpux #ifdef hpux
#define ADA_EXTENSIONS #define ADA_EXTENSIONS
lang_ada, IN_SW_GPRE_ADA, ".eada", ".ada", { lang_ada, IN_SW_GPRE_ADA, ".eada", ".ada" },
#endif #endif
#ifndef ADA_EXTENSIONS #ifndef ADA_EXTENSIONS
lang_ada, IN_SW_GPRE_ADA, ".ea", ".a", { lang_ada, IN_SW_GPRE_ADA, ".ea", ".a" },
#endif #endif
#ifdef ALSYS_ADA #ifdef ALSYS_ADA
lang_ada, IN_SW_GPRE_ALSYS, ".eada", ".ada", { lang_ada, IN_SW_GPRE_ALSYS, ".eada", ".ada" },
#endif #endif
#if ( defined( PC_PLATFORM) || defined( WIN_NT)) #if ( defined( PC_PLATFORM) || defined( WIN_NT))
lang_cplusplus, IN_SW_GPRE_CPLUSPLUS, ".epp", ".cpp", { lang_cplusplus, IN_SW_GPRE_CPLUSPLUS, ".epp", ".cpp" },
#else #else
lang_cplusplus, IN_SW_GPRE_CPLUSPLUS, ".exx", ".cxx", { lang_cplusplus, IN_SW_GPRE_CPLUSPLUS, ".exx", ".cxx" },
#endif #endif
lang_undef, IN_SW_GPRE_0, NULL, NULL { lang_undef, IN_SW_GPRE_0, NULL, NULL }
}; };
#define CHR_LETTER 1 #define CHR_LETTER 1
@ -871,8 +871,10 @@ int main(int argc, char* argv[])
sw_databases = isc_databases; sw_databases = isc_databases;
if (!setjmp(fatal_env)) try {
for (end_position = 0; end_position = compile_module(end_position);); for (end_position = 0; end_position = compile_module(end_position);); // empty loop
} // try
catch (...) {} // fall through to the cleanup code
#ifdef FTN_BLK_DATA #ifdef FTN_BLK_DATA
if (sw_language == lang_fortran) if (sw_language == lang_fortran)
@ -910,6 +912,7 @@ int main(int argc, char* argv[])
CPR_exit((errors) ? FINI_ERROR : FINI_OK); CPR_exit((errors) ? FINI_ERROR : FINI_OK);
return 0; return 0;
} }
@ -922,7 +925,7 @@ void CPR_abort()
{ {
++fatals; ++fatals;
longjmp(fatal_env, 1); Firebird::status_longjmp_error::raise(1);
} }

View File

@ -19,7 +19,7 @@
* *
* All Rights Reserved. * All Rights Reserved.
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
* $Id: gpre.h,v 1.1.1.1 2001-05-23 13:25:31 tamlin Exp $ * $Id: gpre.h,v 1.2 2001-12-24 02:50:49 tamlin Exp $
* Revision 1.3 2000/11/27 09:26:13 fsg * Revision 1.3 2000/11/27 09:26:13 fsg
* Fixed bugs in gpre to handle PYXIS forms * Fixed bugs in gpre to handle PYXIS forms
* and allow edit.e and fred.e to go through * and allow edit.e and fred.e to go through
@ -408,9 +408,11 @@ typedef struct bas {
/* Blob block. Used for blob calls */ /* Blob block. Used for blob calls */
typedef struct blb { class blb
{
public:
struct req *blb_request; /* parent request */ struct req *blb_request; /* parent request */
struct blb *blb_next; /* next blob in request */ blb* blb_next; /* next blob in request */
struct ref *blb_reference; /* field reference for blob field */ struct ref *blb_reference; /* field reference for blob field */
struct sym *blb_symbol; /* Blob context variable */ struct sym *blb_symbol; /* Blob context variable */
USHORT blb_ident; /* Blob handle */ USHORT blb_ident; /* Blob handle */
@ -438,9 +440,10 @@ typedef struct blb {
USHORT blb_from_charset; /* charset to translate from */ USHORT blb_from_charset; /* charset to translate from */
USHORT blb_to_charset; /* charset to translate to */ USHORT blb_to_charset; /* charset to translate to */
UCHAR blb_bpb[24]; UCHAR blb_bpb[24];
} *BLB; };
typedef blb* BLB;
#define BLB_LEN sizeof (struct blb) #define BLB_LEN sizeof(blb)
#define BLB_create 1 #define BLB_create 1
#define BLB_symbol_released 2 #define BLB_symbol_released 2
@ -1112,7 +1115,7 @@ typedef struct req {
struct por *req_aport; /* port for asynchronous message */ struct por *req_aport; /* port for asynchronous message */
#endif #endif
struct req *req_routine; /* other requests in routine */ struct req *req_routine; /* other requests in routine */
struct blb *req_blobs; /* blobs in request */ blb* req_blobs; /* blobs in request */
struct form *req_form; /* form for request */ struct form *req_form; /* form for request */
struct slc *req_slice; /* slice for request */ struct slc *req_slice; /* slice for request */
struct ref *req_array_references; /* array fields referenced in context */ struct ref *req_array_references; /* array fields referenced in context */

View File

@ -3,7 +3,7 @@
*____________________________________________________________ *____________________________________________________________
* *
* PROGRAM: C preprocessor * PROGRAM: C preprocessor
* MODULE: gpre_meta.e * MODULE: gpre_meta.epp
* DESCRIPTION: Meta data interface to system * DESCRIPTION: Meta data interface to system
* *
* The contents of this file are subject to the Interbase Public * The contents of this file are subject to the Interbase Public
@ -26,7 +26,7 @@
* *
*____________________________________________________________ *____________________________________________________________
* *
* $Id: gpre_meta.epp,v 1.2 2001-07-29 23:43:22 skywalker Exp $ * $Id: gpre_meta.epp,v 1.3 2001-12-24 02:50:49 tamlin Exp $
*/ */
#include "firebird.h" #include "firebird.h"
@ -82,7 +82,6 @@ FLD MET_context_field( CTX context, char *string)
PRC procedure; PRC procedure;
FLD field; FLD field;
SCHAR name[NAME_SIZE]; SCHAR name[NAME_SIZE];
SSHORT length;
if (context->ctx_relation) { if (context->ctx_relation) {
return (MET_field(context->ctx_relation, string)); return (MET_field(context->ctx_relation, string));
@ -122,8 +121,6 @@ FLD MET_context_field( CTX context, char *string)
BOOLEAN MET_database(DBB dbb, BOOLEAN print_version) BOOLEAN MET_database(DBB dbb, BOOLEAN print_version)
{ {
SCHAR dpb[MAX_PASSWORD_LENGTH + MAX_USER_LENGTH + 5], *d, *p; SCHAR dpb[MAX_PASSWORD_LENGTH + MAX_USER_LENGTH + 5], *d, *p;
SCHAR buffer[16], *data;
SSHORT l;
static CONST UCHAR sql_version_info[] = { isc_info_base_level, static CONST UCHAR sql_version_info[] = { isc_info_base_level,
isc_info_ods_version, isc_info_ods_version,
isc_info_db_sql_dialect, isc_info_db_sql_dialect,
@ -179,7 +176,7 @@ BOOLEAN MET_database(DBB dbb, BOOLEAN print_version)
} }
if (gds__attach_database if (gds__attach_database
(gds__status, 0, GDS_VAL(dbb->dbb_filename), GDS_REF(DB), d - &dpb[0], (gds_status, 0, GDS_VAL(dbb->dbb_filename), GDS_REF(DB), d - &dpb[0],
dpb)) { dpb)) {
/* We failed to attach, try in read only mode just in case /* We failed to attach, try in read only mode just in case
if (d == dpb) if (d == dpb)
@ -188,9 +185,9 @@ BOOLEAN MET_database(DBB dbb, BOOLEAN print_version)
*d++ = 1; *d++ = 1;
*d++ = TRUE; *d++ = TRUE;
if (gds__attach_database if (gds__attach_database
(gds__status, 0, GDS_VAL(dbb->dbb_filename), GDS_REF(DB), d - &dpb[0], (gds_status, 0, GDS_VAL(dbb->dbb_filename), GDS_REF(DB), d - &dpb[0],
dpb)) {*/ dpb)) {*/
gds__print_status(gds__status); gds__print_status(gds_status);
return FALSE; return FALSE;
//} //}
} }
@ -279,13 +276,16 @@ BOOLEAN MET_database(DBB dbb, BOOLEAN print_version)
\n\tClient Sql dialect set to : %d\n\n", \sw_server_version, sw_ods_version, compiletime_db_dialect, \sw_sql_dialect); \n\tClient Sql dialect set to : %d\n\n", \sw_server_version, sw_ods_version, compiletime_db_dialect, \sw_sql_dialect);
#endif #endif
#ifdef SCROLLABLE_CURSORS #ifdef SCROLLABLE_CURSORS
SCHAR buffer[16];
/* get the base level of the engine */ /* get the base level of the engine */
if (gds__database_info(gds__status, if (gds__database_info(gds_status,
GDS_REF(DB), GDS_REF(DB),
sizeof(db_version_info), sizeof(db_version_info),
db_version_info, sizeof(buffer), buffer)) { db_version_info, sizeof(buffer), buffer)) {
gds__print_status(gds__status); gds__print_status(gds_status);
return FALSE; return FALSE;
} }
@ -294,7 +294,7 @@ BOOLEAN MET_database(DBB dbb, BOOLEAN print_version)
* more info items later * more info items later
*/ */
data = buffer; SCHAR* data = buffer;
while ((p = *data++) != gds__info_end) { while ((p = *data++) != gds__info_end) {
l = isc_vax_integer(data, 2); l = isc_vax_integer(data, 2);
data += 2; data += 2;
@ -376,7 +376,7 @@ USHORT MET_domain_lookup(REQ request, FLD field, char *string)
return FALSE; return FALSE;
DB = dbb->dbb_handle; DB = dbb->dbb_handle;
gds__trans = dbb->dbb_transaction; gds_trans = dbb->dbb_transaction;
if (!(dbb->dbb_flags & DBB_v3)) { if (!(dbb->dbb_flags & DBB_v3)) {
FOR(REQUEST_HANDLE dbb->dbb_domain_request) FOR(REQUEST_HANDLE dbb->dbb_domain_request)
@ -457,7 +457,7 @@ BOOLEAN MET_get_domain_default(DBB dbb,
TEXT * domain_name, TEXT * domain_name,
TEXT * buffer, USHORT buff_length) TEXT * buffer, USHORT buff_length)
{ {
SLONG *DB, *gds__trans; SLONG *DB, *gds_trans;
SCHAR name[NAME_SIZE]; SCHAR name[NAME_SIZE];
SSHORT length; SSHORT length;
BOOLEAN has_default; BOOLEAN has_default;
@ -478,7 +478,7 @@ BOOLEAN MET_get_domain_default(DBB dbb,
CPR_exit(FINI_ERROR); CPR_exit(FINI_ERROR);
assert(dbb->dbb_transaction == NULL); assert(dbb->dbb_transaction == NULL);
gds__trans = NULL; gds_trans = NULL;
DB = dbb->dbb_handle; DB = dbb->dbb_handle;
@ -490,7 +490,7 @@ BOOLEAN MET_get_domain_default(DBB dbb,
blob_id = &FLD.RDB$DEFAULT_VALUE; blob_id = &FLD.RDB$DEFAULT_VALUE;
/* open the blob */ /* open the blob */
stat = isc_open_blob2(status_vect, (void**) &DB, (void**) &gds__trans, (void**) &blob_handle, stat = isc_open_blob2(status_vect, (void**) &DB, (void**) &gds_trans, (void**) &blob_handle,
blob_id, sizeof(blr_bpb), const_cast<unsigned char*>(blr_bpb)); blob_id, sizeof(blr_bpb), const_cast<unsigned char*>(blr_bpb));
if (stat) { if (stat) {
gds__print_status(status_vect); gds__print_status(status_vect);
@ -556,7 +556,7 @@ BOOLEAN MET_get_column_default(REL relation,
TEXT * buffer, USHORT buff_length) TEXT * buffer, USHORT buff_length)
{ {
DBB dbb; DBB dbb;
SLONG *DB, *gds__trans; SLONG *DB, *gds_trans;
SCHAR name[NAME_SIZE]; SCHAR name[NAME_SIZE];
SSHORT length; SSHORT length;
BOOLEAN has_default; BOOLEAN has_default;
@ -576,7 +576,7 @@ BOOLEAN MET_get_column_default(REL relation,
CPR_exit(FINI_ERROR); CPR_exit(FINI_ERROR);
assert(dbb->dbb_transaction == NULL); assert(dbb->dbb_transaction == NULL);
gds__trans = NULL; gds_trans = NULL;
DB = dbb->dbb_handle; DB = dbb->dbb_handle;
@ -598,7 +598,7 @@ BOOLEAN MET_get_column_default(REL relation,
if (has_default) { if (has_default) {
/* open the blob */ /* open the blob */
stat = isc_open_blob2(status_vect, (void**) &DB, (void**) &gds__trans, stat = isc_open_blob2(status_vect, (void**) &DB, (void**) &gds_trans,
(void**) &blob_handle, blob_id, sizeof(blr_bpb), (void**) &blob_handle, blob_id, sizeof(blr_bpb),
const_cast<unsigned char*>(blr_bpb)); const_cast<unsigned char*>(blr_bpb));
if (stat) { if (stat) {
@ -658,7 +658,7 @@ BOOLEAN MET_get_column_default(REL relation,
LLS MET_get_primary_key(DBB dbb, TEXT * relation_name) LLS MET_get_primary_key(DBB dbb, TEXT * relation_name)
{ {
LLS fields = NULL, *ptr_fields; LLS fields = NULL, *ptr_fields;
SLONG *DB, *gds__trans; SLONG *DB, *gds_trans;
SCHAR name[NAME_SIZE]; SCHAR name[NAME_SIZE];
STR field_name; STR field_name;
TEXT *tmp; TEXT *tmp;
@ -672,7 +672,7 @@ LLS MET_get_primary_key(DBB dbb, TEXT * relation_name)
CPR_exit(FINI_ERROR); CPR_exit(FINI_ERROR);
assert(dbb->dbb_transaction == NULL); assert(dbb->dbb_transaction == NULL);
gds__trans = NULL; gds_trans = NULL;
DB = dbb->dbb_handle; DB = dbb->dbb_handle;
@ -741,7 +741,7 @@ FLD MET_field(REL relation, char *string)
return NULL; return NULL;
DB = dbb->dbb_handle; DB = dbb->dbb_handle;
gds__trans = dbb->dbb_transaction; gds_trans = dbb->dbb_transaction;
field = NULL; field = NULL;
if (!(dbb->dbb_flags & DBB_v3)) { if (!(dbb->dbb_flags & DBB_v3)) {
@ -903,7 +903,7 @@ NOD MET_fields(CTX context)
dbb = relation->rel_database; dbb = relation->rel_database;
DB = dbb->dbb_handle; DB = dbb->dbb_handle;
gds__trans = dbb->dbb_transaction; gds_trans = dbb->dbb_transaction;
count = 0; count = 0;
stack = NULL; stack = NULL;
@ -944,7 +944,7 @@ void MET_fini( DBB end)
for (dbb = isc_databases; dbb && dbb != end; dbb = dbb->dbb_next) for (dbb = isc_databases; dbb && dbb != end; dbb = dbb->dbb_next)
if (DB = dbb->dbb_handle) { if (DB = dbb->dbb_handle) {
if (gds__trans = dbb->dbb_transaction) if (gds_trans = dbb->dbb_transaction)
COMMIT; COMMIT;
FINISH; FINISH;
dbb->dbb_handle = NULL; dbb->dbb_handle = NULL;
@ -981,7 +981,6 @@ SCHAR *MET_generator(TEXT * string, DBB dbb)
SYM symbol; SYM symbol;
SCHAR *gen_name = NULL; SCHAR *gen_name = NULL;
SCHAR name[NAME_SIZE]; SCHAR name[NAME_SIZE];
SSHORT length;
strcpy(name, string); strcpy(name, string);
@ -1366,7 +1365,7 @@ REL MET_get_view_relation(REQ request,
dbb = request->req_database; dbb = request->req_database;
DB = dbb->dbb_handle; DB = dbb->dbb_handle;
gds__trans = dbb->dbb_transaction; gds_trans = dbb->dbb_transaction;
relation = NULL; relation = NULL;
@ -1423,7 +1422,7 @@ IND MET_index(DBB dbb, TEXT * string)
return NULL; return NULL;
DB = dbb->dbb_handle; DB = dbb->dbb_handle;
gds__trans = dbb->dbb_transaction; gds_trans = dbb->dbb_transaction;
index = NULL; index = NULL;
FOR(REQUEST_HANDLE dbb->dbb_index_request) FOR(REQUEST_HANDLE dbb->dbb_index_request)
@ -1474,12 +1473,12 @@ void MET_load_hash_table( DBB dbb)
/* we must have already loaded this one */ /* we must have already loaded this one */
return; return;
gds__trans = NULL; gds_trans = NULL;
DB = dbb->dbb_handle; DB = dbb->dbb_handle;
START_TRANSACTION; START_TRANSACTION;
dbb->dbb_transaction = (SLONG*) gds__trans; dbb->dbb_transaction = (SLONG*) gds_trans;
handle = handle2 = NULL; handle = handle2 = NULL;
/* Determine if the database is V3. */ /* Determine if the database is V3. */
@ -1492,7 +1491,7 @@ void MET_load_hash_table( DBB dbb)
X.RDB$SYSTEM_FLAG = 1 post_v3_flag = TRUE; X.RDB$SYSTEM_FLAG = 1 post_v3_flag = TRUE;
END_FOR; END_FOR;
gds__release_request(gds__status, (void**) GDS_REF(handle)); gds__release_request(gds_status, (void**) GDS_REF(handle));
if (!post_v3_flag) if (!post_v3_flag)
dbb->dbb_flags |= DBB_v3; dbb->dbb_flags |= DBB_v3;
@ -1545,7 +1544,7 @@ void MET_load_hash_table( DBB dbb)
END_FOR; END_FOR;
} }
gds__release_request(gds__status, (void**) GDS_REF(handle)); gds__release_request(gds_status, (void**) GDS_REF(handle));
/* Pick up all procedures (necessary to parse parts of the GDML grammar) */ /* Pick up all procedures (necessary to parse parts of the GDML grammar) */
@ -1567,7 +1566,7 @@ void MET_load_hash_table( DBB dbb)
END_ERROR; END_ERROR;
if (handle) if (handle)
gds__release_request(gds__status, (void**) GDS_REF(handle)); gds__release_request(gds_status, (void**) GDS_REF(handle));
/* Pickup any user defined functions. If the database does not support UDF's, /* Pickup any user defined functions. If the database does not support UDF's,
* this may fail * this may fail
@ -1620,9 +1619,9 @@ void MET_load_hash_table( DBB dbb)
} }
END_FOR ON_ERROR END_ERROR; END_FOR ON_ERROR END_ERROR;
gds__release_request(gds__status, (void**) GDS_REF(handle)); gds__release_request(gds_status, (void**) GDS_REF(handle));
if (handle2) if (handle2)
gds__release_request(gds__status, (void**) GDS_REF(handle2)); gds__release_request(gds_status, (void**) GDS_REF(handle2));
/* Pick up all Collation names, might have several collations /* Pick up all Collation names, might have several collations
* for a given character set. * for a given character set.
@ -1672,9 +1671,9 @@ void MET_load_hash_table( DBB dbb)
/* assume pre V4 database, no collations */ /* assume pre V4 database, no collations */
END_ERROR; END_ERROR;
gds__release_request(gds__status, (void**) GDS_REF(handle)); gds__release_request(gds_status, (void**) GDS_REF(handle));
if (handle2) if (handle2)
gds__release_request(gds__status, (void**) GDS_REF(handle2)); gds__release_request(gds_status, (void**) GDS_REF(handle2));
/* Now pick up all character set names - with the subtype set to /* Now pick up all character set names - with the subtype set to
* the type of the default collation for the character set. * the type of the default collation for the character set.
@ -1720,9 +1719,9 @@ void MET_load_hash_table( DBB dbb)
/* assume pre V4 database, no character sets */ /* assume pre V4 database, no character sets */
END_ERROR; END_ERROR;
gds__release_request(gds__status, (void**) GDS_REF(handle)); gds__release_request(gds_status, (void**) GDS_REF(handle));
if (handle2) if (handle2)
gds__release_request(gds__status, (void**) GDS_REF(handle2)); gds__release_request(gds_status, (void**) GDS_REF(handle2));
/* Pick up name of database default character set for SQL */ /* Pick up name of database default character set for SQL */
@ -1740,7 +1739,7 @@ void MET_load_hash_table( DBB dbb)
/* Assume V3 Db, no default charset */ /* Assume V3 Db, no default charset */
END_ERROR; END_ERROR;
gds__release_request(gds__status, (void**) GDS_REF(handle)); gds__release_request(gds_status, (void**) GDS_REF(handle));
/* Pick up all generators for the database */ /* Pick up all generators for the database */
@ -1752,7 +1751,7 @@ void MET_load_hash_table( DBB dbb)
END_FOR ON_ERROR END_ERROR; END_FOR ON_ERROR END_ERROR;
gds__release_request(gds__status, (void**) GDS_REF(handle)); gds__release_request(gds_status, (void**) GDS_REF(handle));
/* now that we have attached to the database, resolve the character set /* now that we have attached to the database, resolve the character set
* request (if any) (and if we can) * request (if any) (and if we can)
@ -1857,7 +1856,7 @@ BOOLEAN MET_type(FLD field, TEXT * string, SSHORT * ptr)
relation = field->fld_relation; relation = field->fld_relation;
dbb = relation->rel_database; dbb = relation->rel_database;
DB = dbb->dbb_handle; DB = dbb->dbb_handle;
gds__trans = dbb->dbb_transaction; gds_trans = dbb->dbb_transaction;
/* Force the name to uppercase, using C locale rules for uppercasing */ /* Force the name to uppercase, using C locale rules for uppercasing */
for (p = buffer; *string && p < &buffer[sizeof(buffer) - 1]; for (p = buffer; *string && p < &buffer[sizeof(buffer) - 1];
@ -1888,15 +1887,14 @@ BOOLEAN MET_type(FLD field, TEXT * string, SSHORT * ptr)
* FALSE otherwise * FALSE otherwise
*/ */
BOOLEAN MET_trigger_exists(DBB dbb, TEXT * trigger_name) BOOLEAN MET_trigger_exists(DBB dbb, TEXT* trigger_name)
{ {
SCHAR name[NAME_SIZE]; char name[NAME_SIZE];
SSHORT length;
strcpy(name, trigger_name); strcpy(name, trigger_name);
DB = dbb->dbb_handle; DB = dbb->dbb_handle;
gds__trans = dbb->dbb_transaction; gds_trans = dbb->dbb_transaction;
FOR(REQUEST_HANDLE dbb->dbb_trigger_request) FOR(REQUEST_HANDLE dbb->dbb_trigger_request)
TRIG IN RDB$TRIGGERS WITH TRIG.RDB$TRIGGER_NAME EQ name return TRUE; TRIG IN RDB$TRIGGERS WITH TRIG.RDB$TRIGGER_NAME EQ name return TRUE;
@ -2021,7 +2019,7 @@ static int get_intl_char_subtype(
DB = dbb->dbb_handle; DB = dbb->dbb_handle;
if (!DB) if (!DB)
return (0); return (0);
gds__trans = dbb->dbb_transaction; gds_trans = dbb->dbb_transaction;
end_name = name + length; end_name = name + length;
/* Force key to uppercase, following C locale rules for uppercasing /* Force key to uppercase, following C locale rules for uppercasing
@ -2108,7 +2106,7 @@ static int resolve_charset_and_collation(
/* Assume V3 DB, without default character set */ /* Assume V3 DB, without default character set */
END_ERROR; END_ERROR;
gds__release_request(gds__status, (void**) GDS_REF(request)); gds__release_request(gds_status, (void**) GDS_REF(request));
if (charset == NULL) if (charset == NULL)
charset = (UCHAR *) DEFAULT_CHARACTER_SET_NAME; charset = (UCHAR *) DEFAULT_CHARACTER_SET_NAME;
@ -2129,7 +2127,7 @@ static int resolve_charset_and_collation(
END_FOR ON_ERROR END_ERROR; END_FOR ON_ERROR END_ERROR;
gds__release_request(gds__status, (void**) GDS_REF(request)); gds__release_request(gds_status, (void**) GDS_REF(request));
return (found); return (found);
} }
@ -2144,7 +2142,7 @@ static int resolve_charset_and_collation(
*id = MAP_CHARSET_TO_TTYPE(CS.RDB$CHARACTER_SET_ID); *id = MAP_CHARSET_TO_TTYPE(CS.RDB$CHARACTER_SET_ID);
END_FOR ON_ERROR END_ERROR; END_FOR ON_ERROR END_ERROR;
gds__release_request(gds__status, (void**) GDS_REF(request)); gds__release_request(gds_status, (void**) GDS_REF(request));
return (found); return (found);
} }
@ -2162,7 +2160,7 @@ static int resolve_charset_and_collation(
*id = MAP_CHARSET_TO_TTYPE(CS.RDB$CHARACTER_SET_ID); *id = MAP_CHARSET_TO_TTYPE(CS.RDB$CHARACTER_SET_ID);
END_FOR ON_ERROR END_ERROR; END_FOR ON_ERROR END_ERROR;
gds__release_request(gds__status, (void**) GDS_REF(request)); gds__release_request(gds_status, (void**) GDS_REF(request));
return (found); return (found);
} }

View File

@ -26,7 +26,7 @@
* *
*____________________________________________________________ *____________________________________________________________
* *
* $Id: gpre_meta_boot.cpp,v 1.2 2001-07-29 23:43:22 skywalker Exp $ * $Id: gpre_meta_boot.cpp,v 1.3 2001-12-24 02:50:49 tamlin Exp $
*/ */
#include "firebird.h" #include "firebird.h"
@ -977,3 +977,12 @@ void DLL_EXPORT CVT_move (struct dsc * a, struct dsc * b, FPTR_VOID c)
/* Not available in boot_gpre */ /* Not available in boot_gpre */
} }
extern "C" {
void DLL_EXPORT ERR_bugcheck(int number)
{
}
BOOLEAN DLL_EXPORT ERR_post(STATUS status, ...)
{
}
}

View File

@ -19,7 +19,7 @@
* *
* All Rights Reserved. * All Rights Reserved.
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
* $Id: gpreswi.h,v 1.3 2001-07-31 18:34:05 skywalker Exp $ * $Id: gpreswi.h,v 1.4 2001-12-24 02:50:49 tamlin Exp $
* Revision 1.2 2000/11/16 15:54:29 fsg * Revision 1.2 2000/11/16 15:54:29 fsg
* Added new switch -verbose to gpre that will dump * Added new switch -verbose to gpre that will dump
* parsed lines to stderr * parsed lines to stderr

View File

@ -25,7 +25,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: hsh.cpp,v 1.3 2001-07-29 23:43:22 skywalker Exp $ // $Id: hsh.cpp,v 1.4 2001-12-24 02:50:49 tamlin Exp $
// //
#include "firebird.h" #include "firebird.h"

View File

@ -25,7 +25,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: int.cpp,v 1.2 2001-07-29 23:43:22 skywalker Exp $ // $Id: int.cpp,v 1.3 2001-12-24 02:50:49 tamlin Exp $
// //
#include "firebird.h" #include "firebird.h"

View File

@ -25,7 +25,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: int_cxx.cpp,v 1.2 2001-07-29 23:43:22 skywalker Exp $ // $Id: int_cxx.cpp,v 1.3 2001-12-24 02:50:49 tamlin Exp $
// //
#include "firebird.h" #include "firebird.h"

View File

@ -26,7 +26,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: jrdmet.cpp,v 1.2 2001-07-29 23:43:22 skywalker Exp $ // $Id: jrdmet.cpp,v 1.3 2001-12-24 02:50:49 tamlin Exp $
// //
#include "firebird.h" #include "firebird.h"

View File

@ -25,7 +25,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: movg.cpp,v 1.2 2001-07-29 23:43:22 skywalker Exp $ // $Id: movg.cpp,v 1.3 2001-12-24 02:50:49 tamlin Exp $
// //
#include "firebird.h" #include "firebird.h"

View File

@ -25,10 +25,10 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: msc.cpp,v 1.2 2001-07-29 23:43:22 skywalker Exp $ // $Id: msc.cpp,v 1.3 2001-12-24 02:50:49 tamlin Exp $
// //
// //
//$Id: msc.cpp,v 1.2 2001-07-29 23:43:22 skywalker Exp $ //$Id: msc.cpp,v 1.3 2001-12-24 02:50:49 tamlin Exp $
// //
// *************************************************** // ***************************************************

View File

@ -24,7 +24,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: noform.cpp,v 1.2 2001-07-29 23:43:22 skywalker Exp $ // $Id: noform.cpp,v 1.3 2001-12-24 02:50:49 tamlin Exp $
// //
#include "firebird.h" #include "firebird.h"

View File

@ -20,7 +20,7 @@
// //
// All Rights Reserved. // All Rights Reserved.
// Contributor(s): ______________________________________. // Contributor(s): ______________________________________.
// $Id: par.cpp,v 1.3 2001-07-29 23:43:22 skywalker Exp $ // $Id: par.cpp,v 1.4 2001-12-24 02:50:49 tamlin Exp $
// Revision 1.2 2000/11/27 09:26:13 fsg // Revision 1.2 2000/11/27 09:26:13 fsg
// Fixed bugs in gpre to handle PYXIS forms // Fixed bugs in gpre to handle PYXIS forms
// and allow edit.e and fred.e to go through // and allow edit.e and fred.e to go through
@ -37,7 +37,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: par.cpp,v 1.3 2001-07-29 23:43:22 skywalker Exp $ // $Id: par.cpp,v 1.4 2001-12-24 02:50:49 tamlin Exp $
// //
#include "firebird.h" #include "firebird.h"
@ -208,12 +208,7 @@ ACT PAR_action()
CPR_token(); CPR_token();
} }
if (setjmp(env)) { try {
sw_sql = FALSE;
/* This is to force GPRE to get the next symbol. Fix for bug #274. DROOT */
token.tok_symbol = NULL;
return NULL;
}
PAR_jmp_buf = &env; PAR_jmp_buf = &env;
@ -379,6 +374,14 @@ ACT PAR_action()
break; break;
} }
} // try
catch (...) {
sw_sql = FALSE;
/* This is to force GPRE to get the next symbol. Fix for bug #274. DROOT */
token.tok_symbol = NULL;
return NULL;
}
cur_statement = NULL; cur_statement = NULL;
return NULL; return NULL;
} }
@ -388,46 +391,60 @@ ACT PAR_action()
switch (symbol->sym_type) switch (symbol->sym_type)
{ {
case SYM_context: case SYM_context:
if (setjmp(env)) try {
return NULL;
PAR_jmp_buf = &env; PAR_jmp_buf = &env;
cur_statement = NULL; cur_statement = NULL;
return par_variable(); return par_variable();
}
catch (...) {
return 0;
}
case SYM_form_map: case SYM_form_map:
if (setjmp(env)) try {
return NULL;
PAR_jmp_buf = &env; PAR_jmp_buf = &env;
cur_statement = NULL; cur_statement = NULL;
return par_form_field(); return par_form_field();
}
catch (...) {
return 0;
}
case SYM_blob: case SYM_blob:
if (setjmp(env)) try {
return NULL;
PAR_jmp_buf = &env; PAR_jmp_buf = &env;
cur_statement = NULL; cur_statement = NULL;
return par_blob_field(); return par_blob_field();
}
catch (...) {
return 0;
}
case SYM_relation: case SYM_relation:
if (setjmp(env)) try {
return NULL;
PAR_jmp_buf = &env; PAR_jmp_buf = &env;
cur_statement = NULL; cur_statement = NULL;
return par_type(); return par_type();
}
catch (...) {
return 0;
}
case SYM_menu: case SYM_menu:
if (setjmp(env)) try {
return NULL;
PAR_jmp_buf = &env; PAR_jmp_buf = &env;
cur_statement = NULL; cur_statement = NULL;
return par_menu_att(); return par_menu_att();
}
catch (...) {
return 0;
}
case SYM_menu_map: case SYM_menu_map:
if (setjmp(env)) try {
return NULL;
PAR_jmp_buf = &env; PAR_jmp_buf = &env;
cur_statement = NULL; cur_statement = NULL;
return par_menu_entree_att(); return par_menu_entree_att();
}
catch (...) {
return 0;
}
default: default:
break; break;
} }
@ -1142,7 +1159,9 @@ void PAR_unwind()
#pragma FB_COMPILER_MESSAGE("Fix! Wierd jmp_buf use! This might crash!") #pragma FB_COMPILER_MESSAGE("Fix! Wierd jmp_buf use! This might crash!")
longjmp(*PAR_jmp_buf, (SLONG) 1); //longjmp(*PAR_jmp_buf, (SLONG) 1);
Firebird::status_longjmp_error::raise(1);
} }

View File

@ -24,7 +24,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: pas.cpp,v 1.2 2001-07-29 23:43:22 skywalker Exp $ // $Id: pas.cpp,v 1.3 2001-12-24 02:50:49 tamlin Exp $
// //
#include "firebird.h" #include "firebird.h"

View File

@ -24,7 +24,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: pat.cpp,v 1.2 2001-07-29 23:43:22 skywalker Exp $ // $Id: pat.cpp,v 1.3 2001-12-24 02:50:49 tamlin Exp $
// //
#include "firebird.h" #include "firebird.h"
@ -67,43 +67,49 @@ static struct ops {
PAT_T ops_type; PAT_T ops_type;
TEXT ops_string[3]; TEXT ops_string[3];
} operators[] = { } operators[] = {
RH, "RH", { RH, "RH" },
RL, "RL", { RL, "RL" },
RT, "RT", { RT, "RT" },
RI, "RI", { RI, "RI" },
RS, "RS", { RS, "RS" },
DH, "DH", { DH, "DH" },
DF, "DF", { DF, "DF" },
TH, "TH", { TH, "TH" },
BH, "BH", { BH, "BH" },
BI, "BI", { BI, "BI" },
FH, "FH", { FH, "FH" },
V1, "V1", { V1, "V1" },
V2, "V2", { V2, "V2" },
I1, "I1", { I1, "I1" },
I2, "I2", { I2, "I2" },
S1, "S1", { S1, "S1" },
S2, "S2", { S2, "S2" },
S3, "S3", { S3, "S3" },
S4, "S4", { S4, "S4" },
S5, "S5", { S5, "S5" },
S6, "S6", { S6, "S6" },
S7, "S7", { S7, "S7" },
N1, "N1", { N1, "N1" },
N2, "N2", { N2, "N2" },
N3, "N3", { N3, "N3" },
N4, "N4", { N4, "N4" },
L1, "L1", { L1, "L1" },
L2, "L2", { L2, "L2" },
PN, "PN", { PN, "PN" },
PL, "PL", { PL, "PL" },
PI, "PI", { PI, "PI" },
QN, "QN", { QN, "QN" },
QL, "QL", { QL, "QL" },
QI, "QI", { QI, "QI" },
IF, "IF", { IF, "IF" },
EL, "EL", { EL, "EL" },
EN, "EN", RF, "RF", RE, "RE", VF, "VF", VE, "VE", FR, "FR", NL, ""}; { EN, "EN" },
{ RF, "RF" },
{ RE, "RE" },
{ VF, "VF" },
{ VE, "VE" },
{ FR, "FR" },
{ NL, "" } };
//____________________________________________________________ //____________________________________________________________

View File

@ -25,7 +25,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: pretty.cpp,v 1.3 2001-07-29 23:43:22 skywalker Exp $ // $Id: pretty.cpp,v 1.4 2001-12-24 02:50:49 tamlin Exp $
// //
#include "firebird.h" #include "firebird.h"

View File

@ -20,7 +20,7 @@
// //
// All Rights Reserved. // All Rights Reserved.
// Contributor(s): ______________________________________. // Contributor(s): ______________________________________.
// $Id: sqe.cpp,v 1.2 2001-07-29 23:43:22 skywalker Exp $ // $Id: sqe.cpp,v 1.3 2001-12-24 02:50:49 tamlin Exp $
// Revision 1.3 2000/11/16 15:54:29 fsg // Revision 1.3 2000/11/16 15:54:29 fsg
// Added new switch -verbose to gpre that will dump // Added new switch -verbose to gpre that will dump
// parsed lines to stderr // parsed lines to stderr
@ -38,7 +38,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: sqe.cpp,v 1.2 2001-07-29 23:43:22 skywalker Exp $ // $Id: sqe.cpp,v 1.3 2001-12-24 02:50:49 tamlin Exp $
// //
#include "firebird.h" #include "firebird.h"
#include <stdio.h> #include <stdio.h>
@ -132,37 +132,37 @@ typedef struct ops {
} OPS; } OPS;
static OPS rel_ops[] = { static OPS rel_ops[] = {
nod_eq, KW_EQ, nod_ne, { nod_eq, KW_EQ, nod_ne },
nod_eq, KW_EQUALS, nod_ne, { nod_eq, KW_EQUALS, nod_ne },
nod_ne, KW_NE, nod_eq, { nod_ne, KW_NE, nod_eq },
nod_gt, KW_GT, nod_le, { nod_gt, KW_GT, nod_le },
nod_ge, KW_GE, nod_lt, { nod_ge, KW_GE, nod_lt },
nod_le, KW_LE, nod_gt, { nod_le, KW_LE, nod_gt },
nod_lt, KW_LT, nod_ge, { nod_lt, KW_LT, nod_ge },
nod_containing, KW_CONTAINING, nod_any, { nod_containing, KW_CONTAINING, nod_any },
nod_starting, KW_STARTING, nod_any, { nod_starting, KW_STARTING, nod_any },
nod_matches, KW_MATCHES, nod_any, { nod_matches, KW_MATCHES, nod_any },
nod_any, KW_none, nod_any, { nod_any, KW_none, nod_any },
nod_ansi_any, KW_none, nod_ansi_any, { nod_ansi_any, KW_none, nod_ansi_any },
nod_ansi_all, KW_none, nod_ansi_all { nod_ansi_all, KW_none, nod_ansi_all }
}, scalar_stat_ops[] = { }, scalar_stat_ops[] = {
nod_count, KW_COUNT, nod_any, { nod_count, KW_COUNT, nod_any },
nod_max, KW_MAX, nod_any, { nod_max, KW_MAX, nod_any },
nod_min, KW_MIN, nod_any, { nod_min, KW_MIN, nod_any },
nod_total, KW_TOTAL, nod_any, { nod_total, KW_TOTAL, nod_any },
nod_total, KW_SUM, nod_any, { nod_total, KW_SUM, nod_any },
nod_average, KW_AVERAGE, nod_any, { nod_average, KW_AVERAGE, nod_any },
nod_via, KW_none, nod_any}, stat_ops[] = { { nod_via, KW_none, nod_any} }, stat_ops[] = {
nod_agg_count, KW_COUNT, nod_any, { nod_agg_count, KW_COUNT, nod_any },
nod_agg_max, KW_MAX, nod_any, { nod_agg_max, KW_MAX, nod_any },
nod_agg_min, KW_MIN, nod_any, { nod_agg_min, KW_MIN, nod_any },
nod_agg_total, KW_TOTAL, nod_any, { nod_agg_total, KW_TOTAL, nod_any },
nod_agg_total, KW_SUM, nod_any, { nod_agg_total, KW_SUM, nod_any },
nod_agg_average, KW_AVERAGE, nod_any, { nod_agg_average, KW_AVERAGE, nod_any },
nod_any, KW_none, nod_any, { nod_any, KW_none, nod_any },
nod_ansi_any, KW_none, nod_ansi_any, { nod_ansi_any, KW_none, nod_ansi_any },
nod_ansi_all, KW_none, nod_ansi_all}; { nod_ansi_all, KW_none, nod_ansi_all }};
static NOD_T relationals[] = { static NOD_T relationals[] = {
nod_eq, nod_ne, nod_gt, nod_ge, nod_le, nod_lt, nod_containing, nod_eq, nod_ne, nod_gt, nod_ge, nod_le, nod_lt, nod_containing,

View File

@ -25,7 +25,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: sql.cpp,v 1.2 2001-07-29 23:43:22 skywalker Exp $ // $Id: sql.cpp,v 1.3 2001-12-24 02:50:49 tamlin Exp $
// //
#include "firebird.h" #include "firebird.h"

View File

@ -1,24 +1,78 @@
#ifndef INCLUDE_FB_BLK #ifndef INCLUDE_FB_BLK
#define INCLUDE_FB_BLK #define INCLUDE_FB_BLK
#ifndef JRD_COMMON_H #include "../common/memory/memory_pool.h"
#include "../jrd/common.h" //#include <vector>
#endif
#ifdef __cplusplus struct blk
extern "C" {
#endif
typedef struct blk
{ {
UCHAR blk_type; };
UCHAR blk_pool_id; typedef blk* BLK;
USHORT blk_length;
} *BLK;
#ifdef __cplusplus //typedef PtrWrapper<BLK> BlkPtr;
} /* extern "C" */ typedef blk* BlkPtr;
#endif
template<SSHORT TYPE = 0>
class pool_alloc : public blk
{
public:
void* operator new(size_t s, MemoryPool& p )
{ return p.allocate(s, TYPE); }
void operator delete(void* mem, MemoryPool& p)
{ p.deallocate(mem); }
void* operator new[](size_t s, MemoryPool& p)
{ return p.allocate(s, TYPE); }
void operator delete[](void* mem, MemoryPool& p)
{ p.deallocate(mem); }
void operator delete(void* mem) { MemoryPool::deallocate(mem); }
void operator delete[](void* mem) { MemoryPool::deallocate(mem); }
private:
/* These operators are off-limits */
void* operator new(size_t s) { return 0; }
void* operator new[](size_t s) { return 0; }
};
template<class RPT, SSHORT TYPE = 0>
class pool_alloc_rpt : public blk
{
public:
void* operator new(size_t s, MemoryPool& p, int rpt)
{ return p.allocate(s + sizeof(RPT)*rpt, TYPE); }
void operator delete(void* mem, MemoryPool& p,int rpt)
{ p.deallocate(mem); }
void operator delete(void* mem) { MemoryPool::deallocate(mem); }
private:
// These operations are not supported on static repeat-base objects
void* operator new[](size_t s, MemoryPool& p)
{ return 0; }
void operator delete[](void* mem, MemoryPool& p)
{ }
void operator delete[](void* mem) { }
private:
/* These operators are off-limits */
void* operator new(size_t s) { return 0; }
void* operator new[](size_t s) { return 0; }
};
/* template<class BASE, class RPT, UCHAR TYPE>
class vector_rpt : public BASE
{
private:
MemoryPool::allocator<RPT> rptAllocator;
vector_rpt(int size, MemoryPool& pool)
: rptAllocator(pool, TYPE), rpt(size, rptAllocator) {}
public:
std::vector<RPT> rpt;
static vector_rpt<BASE,RPT,TYPE>* allocate(int size, MemoryPool& p)
{ return new(p) vector_rpt<BASE,RPT,TYPE>(size,p); }
}; */
#endif /* INCLUDE_FB_BLK */ #endif /* INCLUDE_FB_BLK */

View File

@ -0,0 +1,72 @@
//
// Copyright (c) 2001 M. Nordell
//
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*/
//
// Special permission is given to the Firebird project to include,
// use and modify this file in the Firebird database engine.
//
#ifndef FB_EXCEPTION_H
#define FB_EXCEPTION_H
#include <exception>
#include "fb_types.h"
namespace Firebird {
class status_longjmp_error : public std::exception
{
public:
explicit status_longjmp_error(STATUS s)
: m_s(s)
{}
virtual ~status_longjmp_error() {}
virtual const char* what() const
{ return "Firebird::status_longjmp_error"; }
STATUS value() const { return m_s; }
// TMN: to be moved into its own source file!
static void raise(STATUS s) { throw status_longjmp_error(s); }
private:
STATUS m_s;
};
class red_zone_error : public std::exception
{
public:
virtual const char* what() const
{ return "Firebird::red_zone_error"; }
// TMN: to be moved into its own source file!
static void raise() { throw red_zone_error(); }
};
class memory_corrupt : public std::exception
{
public:
virtual const char* what() const
{ return "Firebird::memory_corrupt"; }
// TMN: to be moved into its own source file!
static void raise() { throw memory_corrupt(); }
};
} // namespace Firebird
#endif // FB_EXCEPTION_H

24
src/include/fb_string.h Normal file
View File

@ -0,0 +1,24 @@
/*
* fb_string.h
* firebird_test
*
* Created by john on Fri Dec 14 2001.
* Copyright (c) 2001 __MyCompanyName__. All rights reserved.
*
*/
#ifndef FB_STRING_H
#define FB_STRING_H
#include "../include/fb_types.h"
#include "../common/memory/allocators.h"
#include <string>
namespace Firebird
{
typedef std::basic_string<char, std::char_traits<char>,
Firebird::allocator<char> > string;
};
#endif // FB_STRING_H

View File

@ -27,7 +27,7 @@
* Mark O'Donohue <mark.odonohue@ludwig.edu.au> * Mark O'Donohue <mark.odonohue@ludwig.edu.au>
* *
* *
* $Id: fb_types.h,v 1.2 2001-07-29 17:19:15 skywalker Exp $ * $Id: fb_types.h,v 1.3 2001-12-24 02:50:49 tamlin Exp $
* *
*/ */
@ -117,7 +117,28 @@ typedef struct GDS_QUAD_t GDS_QUAD;
#endif /* DEFINED_GDS_QUAD */ #endif /* DEFINED_GDS_QUAD */
//
// TMN: some misc data types from all over the place
//
struct vary
{
SSHORT vary_length;
char vary_string[1];
};
// TMN: Currently we can't do this, since remote uses a different
// definition of VARY than the rest of the code! :-<
//typedef vary* VARY;
struct lstring
{
ULONG lstr_length;
ULONG lstr_allocated;
UCHAR* lstr_address;
};
typedef struct lstring LSTRING;
typedef unsigned char BOOLEAN;
typedef char TEXT; /* To be expunged over time */ typedef char TEXT; /* To be expunged over time */
typedef unsigned char STEXT; /* Signed text - very rare */ typedef unsigned char STEXT; /* Signed text - very rare */
typedef unsigned char UTEXT; /* Unsigned text - common */ typedef unsigned char UTEXT; /* Unsigned text - common */
@ -148,5 +169,4 @@ typedef USHORT FLD_LENGTH;
#define GDS_STATUS long #define GDS_STATUS long
#endif /* INCLUDE_FB_TYPES_H */ #endif /* INCLUDE_FB_TYPES_H */

34
src/include/fb_vector.h Normal file
View File

@ -0,0 +1,34 @@
/*
* fb_vector.h
* firebird_test
*
* Created by john on Fri Dec 14 2001.
* Copyright (c) 2001 __MyCompanyName__. All rights reserved.
*
*/
#ifndef FB_VECTOR_H
#define FB_VECTOR_H
#include "../include/fb_types.h"
#include "../common/memory/allocators.h"
#include <vector>
namespace Firebird
{
template<class T>
class vector : public std::vector<T, Firebird::allocator<T> >
{
public:
vector(int len) : std::vector<T, Firebird::allocator<T> >(len) {}
vector(int len, MemoryPool &p, SSHORT type = 0)
: std::vector<T, Firebird::allocator<T> >(len, T(),
Firebird::allocator<T>(p, type)) {}
vector(MemoryPool &p, SSHORT type = 0)
: std::vector<T, Firebird::allocator<T> >(
Firebird::allocator<T>(p, type) ) {}
};
};
#endif // FB_VECTOR_H

View File

@ -30,12 +30,15 @@
* John Bellardo <bellardo@cs.ucsd.edu> * John Bellardo <bellardo@cs.ucsd.edu>
* *
* *
* $Id: firebird.h,v 1.1 2001-07-29 17:19:15 skywalker Exp $ * $Id: firebird.h,v 1.2 2001-12-24 02:50:49 tamlin Exp $
* *
*/ */
#include "gen/autoconfig.h" #include "gen/autoconfig.h"
#ifdef __cplusplus
#include "fb_exception.h"
#endif
#endif /* INCLUDE_Firebird */ #endif /* INCLUDE_Firebird */

26
src/include/old_fb_blk.h Normal file
View File

@ -0,0 +1,26 @@
#ifndef INCLUDE_FB_BLK
#define INCLUDE_FB_BLK
#define INCLUDE_OLD_FB_BLK
#ifndef JRD_COMMON_H
#include "../jrd/common.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef struct blk
{
UCHAR blk_type;
UCHAR blk_pool_id;
USHORT blk_length;
} *BLK;
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* INCLUDE_FB_BLK */

View File

@ -5,9 +5,9 @@
<key>CFBundleDevelopmentRegion</key> <key>CFBundleDevelopmentRegion</key>
<string>English</string> <string>English</string>
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
<string>Firebird</string> <string>Firebird2</string>
<key>CFBundleIdentifier</key> <key>CFBundleIdentifier</key>
<string>com.firebird.Firebird</string> <string>com.firebird.Firebird2</string>
<key>CFBundleInfoDictionaryVersion</key> <key>CFBundleInfoDictionaryVersion</key>
<string>__VERSION__</string> <string>__VERSION__</string>
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>

View File

@ -26,7 +26,7 @@
# Contributor(s): # Contributor(s):
# #
# #
# $Id: Makefile.in,v 1.2 2001-08-15 18:10:35 skywalker Exp $ # $Id: Makefile.in,v 1.3 2001-12-24 02:50:50 tamlin Exp $
# #
#RedhatPackageDir=/usr/src/redhat/RPMS/i386 #RedhatPackageDir=/usr/src/redhat/RPMS/i386

View File

@ -139,7 +139,7 @@ typedef struct bid {
/* Block types */ /* Block types */
#ifndef INCLUDE_FB_BLK #ifndef INCLUDE_FB_BLK
#include "../include/fb_blk.h" #include "../include/old_fb_blk.h"
#endif #endif
/* Block types */ /* Block types */

View File

@ -549,15 +549,21 @@ static void ipi_end_thread( ICC icc)
{ {
UnmapViewOfFile(ipm->ipm_address); UnmapViewOfFile(ipm->ipm_address);
CloseHandle(ipm->ipm_handle); CloseHandle(ipm->ipm_handle);
if (ipserver_private_data.ipms == ipm)
if (ipserver_private_data.ipms == ipm){
ipserver_private_data.ipms = ipm->ipm_next; ipserver_private_data.ipms = ipm->ipm_next;
else } else {
for (pipm = ipserver_private_data.ipms; pipm->ipm_next; pipm = pipm->ipm_next) for (pipm = ipserver_private_data.ipms;
pipm->ipm_next;
pipm = pipm->ipm_next)
{
if (pipm->ipm_next == ipm) if (pipm->ipm_next == ipm)
{ {
pipm->ipm_next = ipm->ipm_next; pipm->ipm_next = ipm->ipm_next;
break; break;
} }
}
}
ALLI_free((UCHAR *) ipm); ALLI_free((UCHAR *) ipm);
} }
@ -585,22 +591,14 @@ static void ipi_server( ICC icc)
**************************************/ **************************************/
ips_comm_area *comm; ips_comm_area *comm;
TEXT *comm_ptr; TEXT *comm_ptr;
JMP_BUF env;
#ifdef IP_TRACE
char line[200];
#endif
/* start this thread */ // start this thread
gds__thread_enable(-1); gds__thread_enable(-1);
/* error handler */ /* error handler */
if (SETJMP(env)) try {
{
gds__log("ipi_server: error during startup, shutting down");
return;
}
/* request processing loop */ /* request processing loop */
@ -611,10 +609,13 @@ static void ipi_server( ICC icc)
GET_COMM_OBJECT; GET_COMM_OBJECT;
comm->ips_ops_count++; comm->ips_ops_count++;
#ifdef IP_TRACE #ifdef IP_TRACE
{
char line[200];
sprintf(line, "%8lX %8lX %8lX %d ipserver %s", sprintf(line, "%8lX %8lX %8lX %d ipserver %s",
(long) GetCurrentThreadId(), (long) icc, (long) GetCurrentThreadId(), (long) icc,
comm, comm->ips_operation, op_strings[comm->ips_operation]); comm, comm->ips_operation, op_strings[comm->ips_operation]);
gds__log(line); gds__log(line);
}
#endif #endif
switch (comm->ips_operation) switch (comm->ips_operation)
{ {
@ -796,6 +797,11 @@ static void ipi_server( ICC icc)
shutdown_attachments(icc); shutdown_attachments(icc);
ipi_end_thread(icc); ipi_end_thread(icc);
} // try
catch (...) {
gds__log("ipi_server: error during startup, shutting down");
}
} }
@ -845,8 +851,9 @@ static void allocate_statement( ICC icc)
statement->isr_packed = NULL; statement->isr_packed = NULL;
idb->idb_sql_requests = statement; idb->idb_sql_requests = statement;
} }
else else {
ips->ips_st_handle = NULL; ips->ips_st_handle = NULL;
}
send_response(icc, status_vector); send_response(icc, status_vector);
} }

View File

@ -19,7 +19,7 @@
* *
* All Rights Reserved. * All Rights Reserved.
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
* $Id: extract.epp,v 1.3 2001-08-27 15:29:18 skywalker Exp $ * $Id: extract.epp,v 1.4 2001-12-24 02:50:50 tamlin Exp $
* Revision 1.3 2000/11/22 17:07:25 patrickgriffin * Revision 1.3 2000/11/22 17:07:25 patrickgriffin
* In get_procedure_args change comment style from // to c style * In get_procedure_args change comment style from // to c style
* *
@ -74,7 +74,7 @@ static void list_generators(void);
static void list_index(void); static void list_index(void);
static void list_views(void); static void list_views(void);
static void get_procedure_args(SCHAR *); static void get_procedure_args(char*);
#define MAX_INTSUBTYPES 2 #define MAX_INTSUBTYPES 2
#define MAXSUBTYPES 8 #define MAXSUBTYPES 8
@ -794,7 +794,7 @@ void EXTRACT_list_view( SCHAR * viewname)
#endif #endif
static void get_procedure_args( SCHAR * proc_name) static void get_procedure_args(char* proc_name)
{ {
/************************************** /**************************************
* *
@ -808,7 +808,6 @@ static void get_procedure_args( SCHAR * proc_name)
* *
**************************************/ **************************************/
SSHORT ptype, first_time, i, header = TRUE; SSHORT ptype, first_time, i, header = TRUE;
TEXT msg[MSG_LENGTH];
SCHAR char_sets[86]; SCHAR char_sets[86];
/* query to retrieve the parameters. */ /* query to retrieve the parameters. */
@ -1146,9 +1145,8 @@ static void list_all_procs()
* procname -- Name of procedure to investigate * procname -- Name of procedure to investigate
* *
**************************************/ **************************************/
SSHORT first_time, i, header = TRUE; SSHORT header = TRUE;
TEXT msg[MSG_LENGTH]; TEXT msg[MSG_LENGTH];
SCHAR char_sets[86];
static CONST SCHAR *create_procedure_str1 = "CREATE PROCEDURE %s "; static CONST SCHAR *create_procedure_str1 = "CREATE PROCEDURE %s ";
static CONST SCHAR *create_procedure_str2 = "BEGIN EXIT; END %s%s"; static CONST SCHAR *create_procedure_str2 = "BEGIN EXIT; END %s%s";

View File

@ -21,7 +21,7 @@
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
*/ */
/* /*
$Id: isql.epp,v 1.5 2001-10-17 22:48:01 bellardo Exp $ $Id: isql.epp,v 1.6 2001-12-24 02:50:50 tamlin Exp $
Revision 1.5 2000/11/18 16:49:24 fsg Revision 1.5 2000/11/18 16:49:24 fsg
Increased PRINT_BUFFER_LENGTH to 2048 to show larger plans Increased PRINT_BUFFER_LENGTH to 2048 to show larger plans
Fixed Bug #122563 in extract.e get_procedure_args Fixed Bug #122563 in extract.e get_procedure_args
@ -31,12 +31,19 @@
2001/05/20 Neil McCalden add planonly option 2001/05/20 Neil McCalden add planonly option
*/ */
#ifdef DARWIN
#define _STLP_CCTYPE
#endif
#include "firebird.h" #include "firebird.h"
#include "../jrd/ib_stdio.h" #include "../jrd/ib_stdio.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <signal.h> #include <signal.h>
#include <math.h> #include <math.h>
#ifdef DARWIN
#include </usr/include/math.h>
#endif
#include <ctype.h> #include <ctype.h>
#include <errno.h> #include <errno.h>
@ -288,7 +295,7 @@ static RI_ACTIONS ri_actions_all[] = {
#ifndef GUI_TOOLS #ifndef GUI_TOOLS
int CLIB_ROUTINE main( int argc, char *argv[]) int CLIB_ROUTINE main(int argc, char* argv[])
{ {
/************************************** /**************************************
* *
@ -323,7 +330,7 @@ int CLIB_ROUTINE main( int argc, char *argv[])
Exit_value = ISQL_main(argc, argv); Exit_value = ISQL_main(argc, argv);
exit(Exit_value); return Exit_value;
} }
#endif #endif
@ -2365,8 +2372,10 @@ static SSHORT add_row(TEXT * tabname)
* *
**************************************/ **************************************/
SSHORT n_cols, length, type, nullable, i, j, i_cols, done; SSHORT n_cols, length, type, nullable, i, j, i_cols, done;
SCHAR string[BUFFER_LENGTH120], name[WORDLENGTH], SCHAR string[BUFFER_LENGTH120];
buffer[BUFFER_LENGTH512], infobuf[BUFFER_LENGTH180]; SCHAR name[WORDLENGTH];
// SCHAR buffer[BUFFER_LENGTH512];
SCHAR infobuf[BUFFER_LENGTH180];
SCHAR *insertstring = NULL, *stringvalue = NULL, cmd[5]; SCHAR *insertstring = NULL, *stringvalue = NULL, cmd[5];
SSHORT *nullind = NULL, *nullp; SSHORT *nullind = NULL, *nullp;
/* Data types */ /* Data types */
@ -2375,7 +2384,7 @@ static SSHORT add_row(TEXT * tabname)
SLONG *integer; SLONG *integer;
SINT64 *pi64, n; SINT64 *pi64, n;
float *fvalue; float *fvalue;
double *dvalue, numeric; double *dvalue;
SCHAR bfile[120]; SCHAR bfile[120];
struct tm times; struct tm times;
XSQLDA *sqlda = NULL, *isqlda; XSQLDA *sqlda = NULL, *isqlda;
@ -2977,7 +2986,7 @@ static SSHORT copy_table( TEXT * source, TEXT * destination, TEXT * otherdb)
* *
**************************************/ **************************************/
IB_FILE *holdout; IB_FILE *holdout;
TEXT *p, ftmp[128]; TEXT ftmp[128];
TEXT errbuf[MSG_LENGTH]; TEXT errbuf[MSG_LENGTH];
TEXT cmd[512]; TEXT cmd[512];
TEXT *altdb; TEXT *altdb;
@ -3001,7 +3010,7 @@ static SSHORT copy_table( TEXT * source, TEXT * destination, TEXT * otherdb)
process! So we will get a temp name on our own. [Note that process! So we will get a temp name on our own. [Note that
gds__temp_file returns -1 on error, not 0] */ gds__temp_file returns -1 on error, not 0] */
p = tempnam(NULL, SCRATCH); TEXT p = tempnam(NULL, SCRATCH);
strcpy(ftmp, p); strcpy(ftmp, p);
free(p); free(p);
Out = ib_fopen(ftmp, "w+"); Out = ib_fopen(ftmp, "w+");
@ -3325,7 +3334,7 @@ static void do_isql(void)
* Process incoming SQL statements * Process incoming SQL statements
* *
**************************************/ **************************************/
TEXT *p;
TEXT *statement = NULL; TEXT *statement = NULL;
TEXT *errbuf; TEXT *errbuf;
USHORT bufsize = 0; USHORT bufsize = 0;
@ -3350,14 +3359,16 @@ static void do_isql(void)
process! So we will get a temp name on our own. [Note that process! So we will get a temp name on our own. [Note that
gds__temp_file returns -1 on error, not 0] */ gds__temp_file returns -1 on error, not 0] */
p = tempnam(NULL, SCRATCH); TEXT* p = tempnam(NULL, SCRATCH);
strcpy(Tmpfile, p); strcpy(Tmpfile, p);
free(p); free(p);
Ofp = ib_fopen(Tmpfile, "w+"); Ofp = ib_fopen(Tmpfile, "w+");
if (!Ofp) if (!Ofp) {
Ofp = (IB_FILE *) - 1; Ofp = (IB_FILE *) - 1;
}
#endif #endif
if (Ofp == (IB_FILE *) - 1) { if (Ofp == (IB_FILE *) - 1)
{
/* If we can't open a temp file then bail */ /* If we can't open a temp file then bail */
gds__msg_format(NULL_PTR, ISQL_MSG_FAC, FILE_OPEN_ERR, MSG_LENGTH, gds__msg_format(NULL_PTR, ISQL_MSG_FAC, FILE_OPEN_ERR, MSG_LENGTH,
@ -3729,7 +3740,9 @@ static int end_trans(void)
* Returns success or failure. * Returns success or failure.
* *
**************************************/ **************************************/
TEXT buffer[BUFFER_LENGTH80], infobuf[BUFFER_LENGTH60];
// TEXT buffer[BUFFER_LENGTH80];
TEXT infobuf[BUFFER_LENGTH60];
int ret; int ret;
ret = CONT; ret = CONT;
@ -3879,10 +3892,10 @@ static SSHORT frontend( TEXT * statement)
* Parameters: statement is the string typed by the user * Parameters: statement is the string typed by the user
* *
**************************************/ **************************************/
TEXT *p, *a, *cmd, *q; TEXT *p, *a, *cmd;
TEXT *parms[MAX_TERMS], *lparms[MAX_TERMS], *buffer, *errbuf; TEXT *parms[MAX_TERMS], *lparms[MAX_TERMS], *buffer, *errbuf;
SSHORT lgth, i, j, length; SSHORT lgth, i, j, length;
SSHORT ret = SKIP, slen; SSHORT ret = SKIP;
TEXT *psw, *usr, *numbufs, *sql_role_nm; TEXT *psw, *usr, *numbufs, *sql_role_nm;
TEXT end_quote; TEXT end_quote;
SCHAR *dialect_str; SCHAR *dialect_str;
@ -6403,7 +6416,6 @@ static SSHORT print_item( TEXT ** s, XSQLVAR * var, SLONG printlength)
SSHORT dscale; SSHORT dscale;
struct tm times; struct tm times;
SLONG length; SLONG length;
double numeric, exponent;
ISC_QUAD blobid; ISC_QUAD blobid;
TEXT blobbuf[30]; TEXT blobbuf[30];
@ -6521,8 +6533,8 @@ static SSHORT print_item( TEXT ** s, XSQLVAR * var, SLONG printlength)
if (dscale) { if (dscale) {
/* Handle floating scale and precision */ /* Handle floating scale and precision */
numeric = *(SQUAD *) (var->sqldata); double numeric = *(SQUAD *) (var->sqldata);
exponent = -dscale; double exponent = -dscale;
numeric = numeric / pow(10.0, exponent); numeric = numeric / pow(10.0, exponent);
sprintf(p, "%*.*f ", (int) length, (int) -dscale, numeric); sprintf(p, "%*.*f ", (int) length, (int) -dscale, numeric);
if (List) { if (List) {

View File

@ -19,7 +19,7 @@
* *
* All Rights Reserved. * All Rights Reserved.
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
* $Id: isql.h,v 1.3 2001-08-27 15:29:18 skywalker Exp $ * $Id: isql.h,v 1.4 2001-12-24 02:50:50 tamlin Exp $
* Revision 1.2 2000/11/18 16:49:24 fsg * Revision 1.2 2000/11/18 16:49:24 fsg
* Increased PRINT_BUFFER_LENGTH to 2048 to show larger plans * Increased PRINT_BUFFER_LENGTH to 2048 to show larger plans
* Fixed Bug #122563 in extract.e get_procedure_args * Fixed Bug #122563 in extract.e get_procedure_args
@ -263,10 +263,7 @@ static SCHAR *alpha_months[] = {
"DEC" "DEC"
}; };
typedef struct vary { typedef vary VARY;
SSHORT vary_length;
SCHAR vary_string[1];
} VARY;
typedef struct sqltypes { typedef struct sqltypes {
SSHORT type; SSHORT type;

View File

@ -19,7 +19,7 @@
* *
* All Rights Reserved. * All Rights Reserved.
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
* $Id: show.epp,v 1.3 2001-08-27 15:29:18 skywalker Exp $ * $Id: show.epp,v 1.4 2001-12-24 02:50:50 tamlin Exp $
* Revision 1.2 2000/11/19 07:02:49 fsg * Revision 1.2 2000/11/19 07:02:49 fsg
* Change in show.e to use CHARACTER_LENGTH instead of FIELD_LENGTH in * Change in show.e to use CHARACTER_LENGTH instead of FIELD_LENGTH in
* SHOW PROCEDURE * SHOW PROCEDURE
@ -64,8 +64,8 @@ extern USHORT minor_ods;
extern SSHORT V4; extern SSHORT V4;
extern SSHORT V33; extern SSHORT V33;
static void *local_fprintf(UCHAR *, UCHAR *); static void local_fprintf(const char*, const char*);
static SCHAR *remove_delimited_double_quotes(TEXT *); static void remove_delimited_double_quotes(TEXT *);
static void make_priv_string(USHORT, UCHAR *); static void make_priv_string(USHORT, UCHAR *);
static int show_all_tables(SSHORT); static int show_all_tables(SSHORT);
static void show_charsets(SCHAR *, SCHAR *); static void show_charsets(SCHAR *, SCHAR *);
@ -910,9 +910,8 @@ void SHOW_grant_roles( SCHAR * terminator)
* All membership privilege may have the with_admin option set. * All membership privilege may have the with_admin option set.
* *
**************************************/ **************************************/
SCHAR with_option[18]; char with_option[18];
SCHAR user_string[44]; char user_string[44];
SCHAR role_name[44];
/* process role "object" */ /* process role "object" */
@ -964,7 +963,12 @@ void SHOW_print_metadata_text_blob( IB_FILE * fp, ISC_QUAD * blobid)
**************************************/ **************************************/
isc_blob_handle blob_handle; isc_blob_handle blob_handle;
USHORT length; USHORT length;
UCHAR *buffer, *b, *start; UCHAR* buffer;
#ifdef GUI_TOOLS
UCHAR* b;
UCHAR* start;
#endif
/* Don't bother with null blobs */ /* Don't bother with null blobs */
@ -1383,7 +1387,7 @@ int SHOW_metadata( SCHAR ** cmd, SCHAR ** lcmd)
} }
static void *local_fprintf( UCHAR * format, UCHAR * string) static void local_fprintf(const char* format, const char* string)
{ {
/************************************** /**************************************
* *
@ -1407,7 +1411,7 @@ static void *local_fprintf( UCHAR * format, UCHAR * string)
} }
static SCHAR *remove_delimited_double_quotes( TEXT * string) static void remove_delimited_double_quotes(TEXT* string)
{ {
/************************************** /**************************************
* *
@ -3205,7 +3209,6 @@ static int show_table( SCHAR * relation_name)
* *
**************************************/ **************************************/
SSHORT i, subtype; SSHORT i, subtype;
ISC_QUAD default_source;
SCHAR *collist; SCHAR *collist;
SSHORT first = TRUE; SSHORT first = TRUE;

Some files were not shown because too many files have changed in this diff Show More