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

Function gen_database

src/gpre/c_cxx.cpp:1413–1533  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1411//
1412
1413static void gen_database(int column)
1414{
1415 if (global_first_flag)
1416 return;
1417
1418 global_first_flag = true;
1419
1420 fprintf(gpreGlob.out_file, "\n/**** GDS Preprocessor Definitions ****/\n");
1421 fprintf(gpreGlob.out_file, "#ifndef JRD_IBASE_H\n#include %s\n#endif\n", GDS_INCLUDE);
1422
1423 printa(column, "static %sISC_QUAD", CONST_STR);
1424 printa(column + INDENT, "isc_blob_null = {0, 0};\t/* initializer for blobs */");
1425 if (gpreGlob.sw_language == lang_c)
1426 printa(column, "static %sISC_STATUS *gds__null = 0;\t/* dummy status vector */", CONST_STR);
1427
1428 const TEXT* scope = "";
1429
1430 bool all_static = true;
1431 bool all_extern = true;
1432
1433 const gpre_dbb* db;
1434 for (db = gpreGlob.isc_databases; db; db = db->dbb_next)
1435 {
1436 all_static = all_static && (db->dbb_scope == DBB_STATIC);
1437 all_extern = all_extern && (db->dbb_scope == DBB_EXTERN);
1438 if (db->dbb_scope == DBB_STATIC)
1439 scope = "static ";
1440 else if (db->dbb_scope == DBB_EXTERN)
1441 scope = "extern ";
1442 printa(column, "%sisc_db_handle", scope);
1443 if (!all_extern)
1444 printa(column + INDENT, "%s = 0;\t\t/* database handle */\n", db->dbb_name->sym_string);
1445 else
1446 printa(column + INDENT, "%s;\t\t/* database handle */\n", db->dbb_name->sym_string);
1447 }
1448
1449 if (all_static)
1450 scope = "static ";
1451 else if (all_extern)
1452 scope = "extern ";
1453
1454 printa(column, "%sisc_tr_handle", scope);
1455 if (!all_extern)
1456 printa(column + INDENT, "%s = 0;\t\t/* default transaction handle */",
1457 gpreGlob.transaction_name);
1458 else
1459 printa(column + INDENT, "%s;\t\t/* default transaction handle */",
1460 gpreGlob.transaction_name);
1461
1462 printa(column, "%sISC_STATUS", scope);
1463 column += INDENT;
1464 printa(column, "%s [20],\t/* status vector */", global_status_name);
1465 printa(column, "%s2 [20];\t/* status vector */", global_status_name);
1466 printa(column - INDENT, "%s%s", scope, DCL_LONG);
1467 printa(column, "isc_array_length, \t/* array return size */");
1468 printa(column, "SQLCODE;\t\t/* SQL status code */");
1469 if (gpreGlob.sw_dyn_using)
1470 {

Callers 1

C_CXX_actionFunction · 0.70

Calls 6

printaFunction · 0.70
gen_tpbFunction · 0.70
gen_event_blockFunction · 0.70
gen_requestFunction · 0.70
make_array_declarationFunction · 0.70
gen_compatibility_symbolFunction · 0.70

Tested by

no test coverage detected