Mercurial > hg > orthanc-databases
comparison Framework/MySQL/MySQLDatabase.cpp @ 157:275e14f57f1e
replacing deprecated std::auto_ptr by std::unique_ptr
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 06 Jul 2020 12:45:58 +0200 |
parents | 063aa53b5917 |
children | 4d32c9c8d6c0 |
comparison
equal
deleted
inserted
replaced
156:710537acb488 | 157:275e14f57f1e |
---|---|
25 #include "MySQLStatement.h" | 25 #include "MySQLStatement.h" |
26 #include "MySQLTransaction.h" | 26 #include "MySQLTransaction.h" |
27 #include "../Common/ImplicitTransaction.h" | 27 #include "../Common/ImplicitTransaction.h" |
28 #include "../Common/Integer64Value.h" | 28 #include "../Common/Integer64Value.h" |
29 | 29 |
30 #include <Compatibility.h> // For std::unique_ptr<> | |
30 #include <Logging.h> | 31 #include <Logging.h> |
31 #include <OrthancException.h> | 32 #include <OrthancException.h> |
32 #include <Toolbox.h> | 33 #include <Toolbox.h> |
33 | 34 |
34 #include <errmsg.h> | 35 #include <errmsg.h> |
319 | 320 |
320 bool success; | 321 bool success; |
321 | 322 |
322 { | 323 { |
323 MySQLTransaction t(*this); | 324 MySQLTransaction t(*this); |
324 std::auto_ptr<IResult> result(t.Execute(statement, args)); | 325 std::unique_ptr<IResult> result(t.Execute(statement, args)); |
325 | 326 |
326 success = (!result->IsDone() && | 327 success = (!result->IsDone() && |
327 result->GetField(0).GetType() == ValueType_Integer64 && | 328 result->GetField(0).GetType() == ValueType_Integer64 && |
328 dynamic_cast<const Integer64Value&>(result->GetField(0)).GetValue() == 1); | 329 dynamic_cast<const Integer64Value&>(result->GetField(0)).GetValue() == 1); |
329 | 330 |
380 | 381 |
381 Dictionary args; | 382 Dictionary args; |
382 args.SetUtf8Value("database", parameters_.GetDatabase()); | 383 args.SetUtf8Value("database", parameters_.GetDatabase()); |
383 args.SetUtf8Value("table", name); | 384 args.SetUtf8Value("table", name); |
384 | 385 |
385 std::auto_ptr<IResult> result(statement.Execute(transaction, args)); | 386 std::unique_ptr<IResult> result(statement.Execute(transaction, args)); |
386 return (!result->IsDone() && | 387 return (!result->IsDone() && |
387 result->GetFieldsCount() == 1 && | 388 result->GetFieldsCount() == 1 && |
388 result->GetField(0).GetType() == ValueType_Integer64 && | 389 result->GetField(0).GetType() == ValueType_Integer64 && |
389 dynamic_cast<const Integer64Value&>(result->GetField(0)).GetValue() == 1); | 390 dynamic_cast<const Integer64Value&>(result->GetField(0)).GetValue() == 1); |
390 } | 391 } |
410 MySQLStatement statement(*this, query); | 411 MySQLStatement statement(*this, query); |
411 | 412 |
412 Dictionary args; | 413 Dictionary args; |
413 args.SetUtf8Value("database", name); | 414 args.SetUtf8Value("database", name); |
414 | 415 |
415 std::auto_ptr<IResult> result(statement.Execute(transaction, args)); | 416 std::unique_ptr<IResult> result(statement.Execute(transaction, args)); |
416 return (!result->IsDone() && | 417 return (!result->IsDone() && |
417 result->GetFieldsCount() == 1 && | 418 result->GetFieldsCount() == 1 && |
418 result->GetField(0).GetType() == ValueType_Integer64 && | 419 result->GetField(0).GetType() == ValueType_Integer64 && |
419 dynamic_cast<const Integer64Value&>(result->GetField(0)).GetValue() == 1); | 420 dynamic_cast<const Integer64Value&>(result->GetField(0)).GetValue() == 1); |
420 } | 421 } |
440 MySQLStatement statement(*this, query); | 441 MySQLStatement statement(*this, query); |
441 | 442 |
442 Dictionary args; | 443 Dictionary args; |
443 args.SetUtf8Value("trigger", name); | 444 args.SetUtf8Value("trigger", name); |
444 | 445 |
445 std::auto_ptr<IResult> result(statement.Execute(transaction, args)); | 446 std::unique_ptr<IResult> result(statement.Execute(transaction, args)); |
446 return (!result->IsDone() && | 447 return (!result->IsDone() && |
447 result->GetFieldsCount() == 1 && | 448 result->GetFieldsCount() == 1 && |
448 result->GetField(0).GetType() == ValueType_Integer64 && | 449 result->GetField(0).GetType() == ValueType_Integer64 && |
449 dynamic_cast<const Integer64Value&>(result->GetField(0)).GetValue() == 1); | 450 dynamic_cast<const Integer64Value&>(result->GetField(0)).GetValue() == 1); |
450 } | 451 } |