Skip to content

Commit 1184ee9

Browse files
committed
Fix spacing
1 parent e9ede7e commit 1184ee9

File tree

2 files changed

+32
-32
lines changed

2 files changed

+32
-32
lines changed

src/connection.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,10 @@ int Connection::SetValuesOnStatement(oracle::occi::Statement* stmt, ExecuteBaton
222222
case VALUE_TYPE_TIMESTAMP:
223223
stmt->setTimestamp(index, *((oracle::occi::Timestamp*)val->value));
224224
break;
225-
case VALUE_TYPE_ARRAY:
225+
case VALUE_TYPE_ARRAY:
226226
stmt->setDatabaseNCHARParam(index, true);
227227
stmt->setDataBufferArray(index, val->value, val->elemetnsType, val->collectionLength, &val->collectionLength, val->elementsSize, val->elementLength, NULL, NULL);
228-
break;
228+
break;
229229
case VALUE_TYPE_OUTPUT:
230230
outParam = static_cast<OutParam*>(val->value);
231231
// std::cout << "OutParam B: " << outParam << " "<< outParam->type() << " " << outParam->_inOut.hasInParam << std::endl;

src/executeBaton.cpp

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,16 @@ void ExecuteBaton::ResetValues() {
4545
case VALUE_TYPE_TIMESTAMP:
4646
delete (oracle::occi::Timestamp*)val->value;
4747
break;
48-
case VALUE_TYPE_ARRAY:
49-
if (val->value != NULL && val->elemetnsType == oracle::occi::OCCI_SQLT_STR)
50-
delete (char*)val->value;
51-
else if (val->value != NULL && val->elemetnsType == oracle::occi::OCCI_SQLT_NUM)
48+
case VALUE_TYPE_ARRAY:
49+
if (val->value != NULL && val->elemetnsType == oracle::occi::OCCI_SQLT_STR)
50+
delete (char*)val->value;
51+
else if (val->value != NULL && val->elemetnsType == oracle::occi::OCCI_SQLT_NUM)
5252
delete (char*)val->value;
5353

54-
if (val->elementLength != NULL)
55-
delete val->elementLength;
54+
if (val->elementLength != NULL)
55+
delete val->elementLength;
5656

57-
break;
57+
break;
5858
}
5959
delete val;
6060
}
@@ -146,12 +146,12 @@ void ExecuteBaton::CopyValuesToBaton(ExecuteBaton* baton, v8::Local<v8::Array>*
146146
baton->values.push_back(value);
147147
}
148148

149-
// array
149+
// array
150150
else if (val->IsArray()) {
151151
value->type = VALUE_TYPE_ARRAY;
152152
Local<Array> arr = Local<Array>::Cast(val);
153-
GetVectorParam(baton, value, arr);
154-
baton->values.push_back(value);
153+
GetVectorParam(baton, value, arr);
154+
baton->values.push_back(value);
155155
}
156156

157157
// output
@@ -185,12 +185,12 @@ void ExecuteBaton::CopyValuesToBaton(ExecuteBaton* baton, v8::Local<v8::Array>*
185185
void ExecuteBaton::GetVectorParam(ExecuteBaton* baton, value_t *value, Local<Array> arr) {
186186
// In case the array is empty just initialize the fields as we would need something in Connection::SetValuesOnStatement
187187
if (arr->Length() < 1) {
188-
value->value = new int[0];
189-
value->collectionLength = 0;
188+
value->value = new int[0];
189+
value->collectionLength = 0;
190190
value->elementsSize = 0;
191191
value->elementLength = new ub2[0];
192-
value->elemetnsType = oracle::occi::OCCIINT;
193-
return;
192+
value->elemetnsType = oracle::occi::OCCIINT;
193+
return;
194194
}
195195

196196
// Next we create the array buffer that will be used later as the value for the param (in Connection::SetValuesOnStatement)
@@ -206,13 +206,13 @@ void ExecuteBaton::GetVectorParam(ExecuteBaton* baton, value_t *value, Local<Arr
206206
for(unsigned int i = 0; i < arr->Length(); i++) {
207207
Local<Value> currVal = arr->Get(i);
208208
if (currVal->ToString()->Utf8Length() > longestString)
209-
longestString = currVal->ToString()->Utf8Length();
209+
longestString = currVal->ToString()->Utf8Length();
210210
}
211211

212-
// Add 1 for '\0'
212+
// Add 1 for '\0'
213213
++longestString;
214214

215-
// Create a long char* that will hold the entire array, it is important to create a FIXED SIZE array,
215+
// Create a long char* that will hold the entire array, it is important to create a FIXED SIZE array,
216216
// meaning all strings have the same allocated length.
217217
char* strArr = new char[arr->Length() * longestString];
218218
value->elementLength = new ub2[arr->Length()];
@@ -221,14 +221,14 @@ void ExecuteBaton::GetVectorParam(ExecuteBaton* baton, value_t *value, Local<Arr
221221
int bytesWritten = 0;
222222
for(unsigned int i = 0; i < arr->Length(); i++) {
223223
Local<Value> currVal = arr->Get(i);
224-
if(!currVal->IsString()) {
224+
if(!currVal->IsString()) {
225225
std::ostringstream message;
226226
message << "Input array has object with invalid type at index " << i << ", all object must be of type 'string' which is the type of the first element";
227227
baton->error = new std::string(message.str());
228-
return;
229-
}
228+
return;
229+
}
230230

231-
String::Utf8Value utfStr(currVal);
231+
String::Utf8Value utfStr(currVal);
232232

233233
// Copy this string onto the strArr (we put \0 in the beginning as this is what strcat expects).
234234
strArr[bytesWritten] = '\0';
@@ -246,32 +246,32 @@ void ExecuteBaton::GetVectorParam(ExecuteBaton* baton, value_t *value, Local<Arr
246246

247247
// Integer array.
248248
else if (val->IsNumber()) {
249-
value->elemetnsType = oracle::occi::OCCI_SQLT_NUM;
249+
value->elemetnsType = oracle::occi::OCCI_SQLT_NUM;
250250

251-
// Allocate memory for the numbers array, Number in Oracle is 21 bytes
251+
// Allocate memory for the numbers array, Number in Oracle is 21 bytes
252252
unsigned char* numArr = new unsigned char[arr->Length() * 21];
253-
value->elementLength = new ub2[arr->Length()];
253+
value->elementLength = new ub2[arr->Length()];
254254

255255
for(unsigned int i = 0; i < arr->Length(); i++) {
256256
Local<Value> currVal = arr->Get(i);
257257
if(!currVal->IsNumber()) {
258258
std::ostringstream message;
259259
message << "Input array has object with invalid type at index " << i << ", all object must be of type 'number' which is the type of the first element";
260260
baton->error = new std::string(message.str());
261-
return;
261+
return;
262262
}
263263

264264
// JS numbers can exceed oracle numbers, make sure this is not the case.
265265
double d = currVal->ToNumber()->Value();
266-
if (d > 9.99999999999999999999999999999999999999*std::pow(10, 125) || d < -9.99999999999999999999999999999999999999*std::pow(10, 125)) {
266+
if (d > 9.99999999999999999999999999999999999999*std::pow(10, 125) || d < -9.99999999999999999999999999999999999999*std::pow(10, 125)) {
267267
std::ostringstream message;
268268
message << "Input array has number that is out of the range of Oracle numbers, check the number at index " << i;
269269
baton->error = new std::string(message.str());
270-
return;
271-
}
270+
return;
271+
}
272272

273-
// Convert the JS number into Oracle Number and get its bytes representation
274-
oracle::occi::Number n = d;
273+
// Convert the JS number into Oracle Number and get its bytes representation
274+
oracle::occi::Number n = d;
275275
oracle::occi::Bytes b = n.toBytes();
276276
value->elementLength[i] = b.length ();
277277
b.getBytes(&numArr[i*21], b.length());

0 commit comments

Comments
 (0)