@@ -88,46 +88,52 @@ DBBINDING acDBBinding[nParams];
8888DBBINDSTATUS acDBBindStatus[nParams];
8989
9090// The following buffer is used to store parameter values.
91- typedef struct tagSPROCPARAMS {
91+ typedef struct tagSPROCPARAMS
92+ {
9293 long lReturnValue;
9394 long inParam1;
9495 long inParam2;
9596} SPROCPARAMS;
9697
97- int main() {
98+ int main()
99+ {
98100 // The command to execute.
99101 WCHAR wCmdString[] = L"{? = CALL fn_RectangleArea(?, ?) }";
100102 // WCHAR wCmdString[] = L"EXEC ? = fn_RectangleVolume(?, ?)";
101103
102- SPROCPARAMS sprocparams = {0,5,10};
104+ SPROCPARAMS sprocparams = {0,5,10};
103105
104106 // All the initialization stuff in a separate function.
105107 InitializeAndEstablishConnection();
106108
107109 // Let us create a new session from the data source object.
108110 if (FAILED(pIDBInitialize->QueryInterface(IID_IDBCreateSession,
109- (void**) &pIDBCreateSession))) {
111+ (void**) &pIDBCreateSession)))
112+ {
110113 cout << "Failed to access IDBCreateSession interface\n";
111114 goto EXIT;
112115 }
113116
114117 if (FAILED(pIDBCreateSession->CreateSession(NULL,
115118 IID_IDBCreateCommand,
116- (IUnknown**) &pIDBCreateCommand))) {
119+ (IUnknown**) &pIDBCreateCommand)))
120+ {
117121 cout << "pIDBCreateSession->CreateSession failed\n";
118122 goto EXIT;
119123 }
120124
121125 // Create a Command
122126 if (FAILED(pIDBCreateCommand->CreateCommand( NULL,
123127 IID_ICommandText,
124- (IUnknown**) &pICommandText))) {
128+ (IUnknown**) &pICommandText)))
129+ {
125130 cout << "Failed to access ICommand interface\n";
126131 goto EXIT;
127132 }
128133
129134 // Set the command text.
130- if (FAILED(pICommandText->SetCommandText(DBGUID_DBSQL, wCmdString))) {
135+ if (FAILED(pICommandText->SetCommandText(DBGUID_DBSQL, wCmdString)))
136+ {
131137 cout << "failed to set command text\n";
132138 goto EXIT;
133139 }
@@ -161,20 +167,23 @@ int main() {
161167
162168 // Set the parameters information.
163169 if (FAILED(pICommandText->QueryInterface(IID_ICommandWithParameters,
164- (void**)&pICommandWithParams))) {
170+ (void**)&pICommandWithParams)))
171+ {
165172 cout << "failed to obtain ICommandWithParameters\n";
166173 goto EXIT;
167174 }
168175 if (FAILED(pICommandWithParams->SetParameterInfo(nParams,
169176 ParamOrdinals,
170- ParamBindInfo))) {
177+ ParamBindInfo)))
178+ {
171179 cout << "failed in setting parameter info.(SetParameterInfo)\n";
172180 goto EXIT;
173181 }
174182
175183 // Describe the consumer buffer; initialize the array of DBBINDING structures.
176184 // Each binding associates a single parameter to the consumer's buffer.
177- for (i = 0 ; i < nParams ; i++) {
185+ for (i = 0 ; i < nParams ; i++)
186+ {
178187 acDBBinding[i].obLength = 0;
179188 acDBBinding[i].obStatus = 0;
180189 acDBBinding[i].pTypeInfo = NULL;
@@ -232,7 +241,8 @@ int main() {
232241 IID_IRowset,
233242 &Params,
234243 &cNumRows,
235- (IUnknown **) &pIRowset))) {
244+ (IUnknown **) &pIRowset)))
245+ {
236246 cout << "failed to execute command\n";
237247 goto EXIT;
238248 }
0 commit comments