hbEnv {
public:
mainEnv (const char *, ushort flt = LL_DEBUG, Log * LogObj1 = 0);
qsupplier & tsupplier;
qthing & tthing;
};
};
dbmain.cc
# include
# include
# include
# include
# include "../hblib/consts.hh"
# include "../Hblib/ll.hh"
# include "../Hblib/utils.hh"
# include "../Hblib/hdb.hh"
# include "Tbmain.hh"
# include "Dbmain.hh"
// # include
// # include
// # include
// # include
// # include
// # include
// # include
// # include
// # include
// # include
// # include "../Hibase/consts.hh"
// # include "../Hibase/ll.hh"
// # include "../Hibase/hdb.hh"
// # include "Myconst.hh"
// # include "Dbmain.hh"
namespace hb {};
using namespace hb;
namespace hb {};
using namespace hb;
# define NUMDB 2
enum maindbNames {
dbnsupplier = 0, dbnthing};
static hbInit tblIndexes [] = {
{ 0, 0},
{ "Thing :: name", "thing.i", "name", DB_HASH, 0,0,0, & qthing :: idx_name, 0, 0}
};
static hbInit tblInits [] = {
{"supplier", "supplier.q", 0, DB_QUEUE, 0,1, tblIndexes + 0, 0, & qsupplier :: GetRef_supplier, 0},
{"thing", "thing.q", 0, DB_QUEUE, 0,1, tblIndexes + 1, 0, & qthing :: GetRef_thing, 1}
};
envInit mainEnvInit = {
NUMDB,
"$ Id: tblproc.pm, v 1.35 2004/01/10 23:57:48 bora Exp $ "
};
qsupplier :: qsupplier (mainEnv & env): hbTable (env, tblInits [dbnsupplier]), menv (env)
{}
void qsupplier :: RefInit ()
{
}
void qsupplier :: GetRef_supplier (uint num, char * key, char * val, db_recno_t * & refs, uint & ref_count)
{
supplierKey * key1 = (SupplierKey *) key;
supplierVal * val1 = (SupplierVal *) val;
}
void supplierKey :: Export (FILE * f)
{
fprintf (f, "% d", key);
}
void supplierKey :: Import (char * buf, uint len)
{
int j, num, i = 0;
char temp;
{j = i; for (; i
temp = buf [i]; buf [i] = ' 0'; sscanf (buf + j, "% d", & key);
buf [i] = temp;
i + +;
}
supplierKey :: supplierKey (const db_recno_t & key_temp)
{
memset (this, 0, sizeof (* this));
key = key_temp;
}
void supplierVal :: Export (FILE * f)
{
fprintf (f, "{");
CharArrInToStr (f, name, 12);
fprintf (f, "}");
fprintf (f, ",");
fprintf (f, "{");
CharArrInToStr (f, desc, 40);
fprintf (f, "}");
}
void supplierVal :: Import (char * buf, uint len)
{
int j, num, i = 0;
char temp;
if (buf [i + +]! = '{')
throw hbExcp (3, LL_CRITICAL, 0, "Помилка імпорту: + покажчик на таблицю = 0.");
j = i;
for (; i
{
if (buf [i] == '}' && Buf [i-1]! = '') p> break;
}
StrToCharArr (buf + j, i-j, name, 12);
i + = 2;
if (buf [i + +]! = '{')
throw hbExcp (3, LL_CRITICAL, 0, "Помилка імпорту: + покажчик на таблицю = 0.");
j = i;
for (; i
{
if (buf [i] == '}' && Buf [i-1]! = '') p> break;
}
StrToCharArr (buf + j, i-j, desc, 40);
i + = 2;
}
supplierVal :: supplierVal (char * name_temp, char * desc_temp)
{
memset (this, 0, sizeof (* this));
strncpy (name, name_temp, sizeof (name));
strncpy (desc, desc_temp, sizeof (desc));
}
isupplier_name :: isupplier_name (char * name_temp)
{
memcpy (name, name_temp, sizeof (name));
}
int qsupplier :: idx_name (Db * db, const Dbt * pk, const Dbt * pv, Dbt * fv)
{
supplierVal * v = (SupplierVal *) (pv-> get_data ());
fv-> set_data (v-> name);
fv-> set_size (sizeof (isupplier_name));
return 0;
}
// --------------------------------------------- ---------------------------------
qthing :: qthing (mainEnv & env): hbTable (env, tblInits [dbnthing]), menv (env)
{}
void qthing :: RefInit ()
{
ref.reftables [0]. type = '+...