MySQL Forums
Forum List  »  Connector/C++

Connector 1.1.19 cpp getstring error more Information
Posted by: Jean BEZET
Date: February 01, 2020 08:49AM

* configuration
- use MFC in a share DLL
- use char MBCS
- use commun languages runtime

2) If i test this code
if (result->next())
{
string tt = "Here" ;
ofstream fichier("c:\\temp\\ofstream.txt");
fichier << tt;
fichier.close();
cout << tt;

} It's good

2) If i test that code
if (result->next())
{
string tt = result->getString("date"); // the date read is good from database web
ofstream fichier("c:\\temp\\ofstream.txt");
fichier << tt;
fichier.close(); // the file is a correct data

} It's bad

3)Bad again

while (result->next())
{
// string tt = result->getString("date"); // the date read is good from database web
ofstream fichier("c:\\temp\\ofstream.txt");
fichier << result->getString("date");
fichier.close(); // Error

} It's bad


With the case 2 and 3 DEbug Viusal sutdio 2019 Open the file xmory ans show the code
<<


fisrt file open wstring
<<
~basic_string() noexcept {
_Tidy_deallocate();
#if _ITERATOR_DEBUG_LEVEL != 0
auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alty, _Getal());
const auto _To_delete = _Mypair._Myval2._Myproxy;
_Mypair._Myval2._Myproxy = nullptr;
_Delete_plain_internal(_Alproxy, _To_delete);
#endif // _ITERATOR_DEBUG_LEVEL != 0
>>

And then
// MEMBER FUNCTIONS FOR _Container_base12
inline void _Container_base12::_Orphan_all() noexcept {
#if _ITERATOR_DEBUG_LEVEL == 2
if (_Myproxy) { // proxy allocated, drain it
_Lockit _Lock(_LOCK_DEBUG);

for (auto _Pnext = &_Myproxy->_Myfirstiter; *_Pnext; *_Pnext = (*_Pnext)->_Mynextiter) {
(*_Pnext)->_Myproxy = nullptr;
}

_Myproxy->_Myfirstiter = nullptr;
}
#endif // _ITERATOR_DEBUG_LEVEL == 2
}
>>

4) If i wrote
string tt;
while (result->next())
{
tt = result->getString("date"); // failed like case 2 and 3
}

5) If i try to use result->getString(1); it's the same like 4)

Options: ReplyQuote


Subject
Views
Written By
Posted
387
January 31, 2020 09:29AM
Connector 1.1.19 cpp getstring error more Information
206
February 01, 2020 08:49AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.