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

Function main

examples/interfaces/06.fb_message.cpp:41–146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39static IInt128* ii128 = NULL;
40
41int main()
42{
43 int rc = 0;
44
45 setenv("ISC_USER", "sysdba", 0);
46 setenv("ISC_PASSWORD", "masterkey", 0);
47
48 ThrowStatusWrapper status(master->getStatus());
49 IProvider* prov = master->getDispatcher();
50
51 IAttachment* att = NULL;
52 ITransaction* tra = NULL;
53 IResultSet* rs = NULL;
54
55 const char* dbName = "employee";
56
57 try
58 {
59 idf16 = master->getUtilInterface()->getDecFloat16(&status);
60 ii128 = master->getUtilInterface()->getInt128(&status);
61
62 att = prov->attachDatabase(&status, dbName, 0, NULL);
63 tra = att->startTransaction(&status, 0, NULL);
64
65 // Comment some tables
66 att->execute(&status, tra, 0, "comment on table employee is 'Employees'",
67 SAMPLES_DIALECT, NULL, NULL, NULL, NULL);
68 att->execute(&status, tra, 0, "comment on table customer is 'Customers'",
69 SAMPLES_DIALECT, NULL, NULL, NULL, NULL);
70 att->execute(&status, tra, 0, "comment on table country is 'Countries and national currencies'",
71 SAMPLES_DIALECT, NULL, NULL, NULL, NULL);
72 tra->commitRetaining(&status);
73
74 // Print tables list
75 FB_MESSAGE(Input, ThrowStatusWrapper,
76 (FB_INTEGER, systemFlag)
77 ) input(&status, master);
78
79 FB_MESSAGE(Output, ThrowStatusWrapper,
80 (FB_SMALLINT, relationId)
81 (FB_VARCHAR(31), relationName)
82 (FB_VARCHAR(100), description)
83 (FB_DECFLOAT16, df16)
84 (FB_INT128, iHuge)
85 ) output(&status, master);
86
87 input.clear();
88 input->systemFlag = 0;
89
90 rs = att->openCursor(&status, tra, 0,
91 "select rdb$relation_id, rdb$relation_name, rdb$description,"
92 " cast (rdb$relation_id as decfloat(16)) * 0.05 as df16,"
93 " cast (rdb$relation_id as int128) * 212778764464767 as iHuge"
94 " from rdb$relations"
95 " where rdb$system_flag = ?"
96 " order by rdb$relation_id",
97 SAMPLES_DIALECT, input.getMetadata(), input.getData(), output.getMetadata(), NULL, 0);
98

Callers

nothing calls this directly

Calls 15

setenvFunction · 0.85
outputFunction · 0.85
getStatusMethod · 0.45
getDispatcherMethod · 0.45
getDecFloat16Method · 0.45
getUtilInterfaceMethod · 0.45
getInt128Method · 0.45
attachDatabaseMethod · 0.45
startTransactionMethod · 0.45
executeMethod · 0.45
commitRetainingMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected