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

Function gen_database

src/gpre/languages/cob.cpp:1563–1783  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1561//
1562
1563static void gen_database( const act* action)
1564{
1565 if (global_first_flag)
1566 return;
1567 global_first_flag = true;
1568
1569 sprintf(output_buffer, "\n%s**** GDS Preprocessor Definitions ****\n\n", names[COMMENT]);
1570 COB_print_buffer(output_buffer, false);
1571
1572 printa(names[COLUMN_0], false, "01 %s PIC S9(18) USAGE COMP VALUE IS 0.", names[isc_blob_null_pos]);
1573 printa(names[COLUMN_0], false, "01 %s PIC S9(9) USAGE COMP EXTERNAL.", names[ISC_SQLCODE]);
1574
1575 bool all_static = true;
1576 bool all_extern = true;
1577 USHORT count = 0;
1578 for (gpre_dbb* db = gpreGlob.isc_databases; db; db = db->dbb_next)
1579 {
1580 all_static = all_static && (db->dbb_scope == DBB_STATIC);
1581 all_extern = all_extern && (db->dbb_scope == DBB_EXTERN);
1582 const TEXT* name = db->dbb_name->sym_string;
1583 printa(names[COLUMN_0], false, "01 %s%s PIC S9(9) USAGE COMP%s.",
1584 name,
1585 all_static ? "" : all_extern ? " IS EXTERNAL" : " IS GLOBAL",
1586 all_extern ? "" : " VALUE IS 0");
1587
1588 // generate variables to hold database name strings for attach call
1589
1590 db->dbb_id = ++count;
1591 if (db->dbb_runtime)
1592 {
1593 printa(names[COLUMN_0], false, "01 %s%ddb PIC X(%" SIZEFORMAT ") VALUE IS \"%s\".",
1594 names[isc_b_pos], db->dbb_id, strlen(db->dbb_runtime), db->dbb_runtime);
1595 }
1596 else if (db->dbb_filename)
1597 {
1598 printa(names[COLUMN_0], false, "01 %s%ddb PIC X(%" SIZEFORMAT ") VALUE IS \"%s\".",
1599 names[isc_b_pos], db->dbb_id, strlen(db->dbb_filename), db->dbb_filename);
1600 }
1601
1602 for (const tpb* tpb_iterator = db->dbb_tpbs;
1603 tpb_iterator;
1604 tpb_iterator = tpb_iterator->tpb_dbb_next)
1605 {
1606 gen_tpb(tpb_iterator);
1607 }
1608 }
1609
1610 // loop through actions: find readys to generate vars for quoted strings
1611
1612 TEXT fname[80], s1[MAX_CURSOR_SIZE];
1613 bool dyn_immed = false;
1614 for (const act* local_act = action; local_act; local_act = local_act->act_rest)
1615 {
1616 switch (local_act->act_type)
1617 {
1618 case ACT_create_database:
1619 break; // no statement;
1620 case ACT_ready:

Callers 1

COB_actionFunction · 0.70

Calls 8

COB_print_bufferFunction · 0.85
printaFunction · 0.70
gen_tpbFunction · 0.70
make_nameFunction · 0.70
gen_requestFunction · 0.70
make_portFunction · 0.70
make_array_declarationFunction · 0.70
gen_event_blockFunction · 0.70

Tested by

no test coverage detected