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

Function gen_database

src/gpre/obj_cxx.cpp:1426–1567  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1424}
1425
1426static void gen_database(int column)
1427{
1428 if (global_first_flag)
1429 return;
1430
1431 global_first_flag = true;
1432
1433 fprintf(gpreGlob.out_file, "\n/**** GDS Preprocessor Definitions ****/\n");
1434 fprintf(gpreGlob.out_file, "#ifndef JRD_IBASE_H\n#include %s\n#endif\n", GDS_INCLUDE);
1435 fprintf(gpreGlob.out_file, "#include <firebird/Interface.h>\n");
1436
1437 fprintf(gpreGlob.out_file, "#define CAST_CONST_MSG(A) (reinterpret_cast<const unsigned char*>(A))\n");
1438 fprintf(gpreGlob.out_file, "#define CAST_MSG(A) (reinterpret_cast<unsigned char*>(A))\n");
1439
1440 ifndef("fbBlobNull");
1441 printa(column, "static %sISC_QUAD", CONST_STR);
1442 printa(column + INDENT, "fbBlobNull = {0, 0};\t/* initializer for blobs */");
1443 endif();
1444
1445 const TEXT* scope = "";
1446
1447 bool all_static = true;
1448 bool all_extern = true;
1449
1450 const gpre_dbb* db;
1451 for (db = gpreGlob.isc_databases; db; db = db->dbb_next)
1452 {
1453 all_static = all_static && (db->dbb_scope == DBB_STATIC);
1454 all_extern = all_extern && (db->dbb_scope == DBB_EXTERN);
1455
1456 ifndef(db->dbb_name->sym_string);
1457 if (db->dbb_scope == DBB_STATIC)
1458 scope = "static ";
1459 else if (db->dbb_scope == DBB_EXTERN)
1460 scope = "extern ";
1461 printa(column, "%sFirebird::IAttachment*", scope);
1462 if (!all_extern)
1463 printa(column + INDENT, "%s = 0;\t\t/* database handle */\n", db->dbb_name->sym_string);
1464 else
1465 printa(column + INDENT, "%s;\t\t/* database handle */\n", db->dbb_name->sym_string);
1466 endif();
1467 }
1468
1469 if (all_static)
1470 scope = "static ";
1471 else if (all_extern)
1472 scope = "extern ";
1473
1474 ifndef(gpreGlob.transaction_name);
1475 printa(column, "%sFirebird::ITransaction*", scope);
1476 if (!all_extern)
1477 printa(column + INDENT, "%s = 0;\t\t/* default transaction handle */",
1478 gpreGlob.transaction_name);
1479 else
1480 printa(column + INDENT, "%s;\t\t/* default transaction handle */",
1481 gpreGlob.transaction_name);
1482 endif();
1483

Callers 1

OBJ_CXX_actionFunction · 0.70

Calls 7

ifndefFunction · 0.85
printaFunction · 0.70
endifFunction · 0.70
gen_tpbFunction · 0.70
gen_event_blockFunction · 0.70
gen_requestFunction · 0.70
make_array_declarationFunction · 0.70

Tested by

no test coverage detected