List:MySQL++« Previous MessageNext Message »
From:Benjamin Johnson Date:June 22 2011 3:20am
Subject:Re: Unsigned 64-bit Issue
View as plain text  
When I rebuilt the libmysql.lib and mysqlpp.lib as statically libraries and
linked mine in with /MT, the issue does not appear on win2008 r2.  I still
don't know the actual fault, but if I get any more info I will share.


On Tue, Jun 21, 2011 at 9:26 PM, Benjamin Johnson <
benjaminjohnson80@stripped> wrote:

> I appreciate the response, although you seem to doubt me a lot.  Answering
> inline:
>
> On Tue, Jun 21, 2011 at 8:47 PM, Warren Young <mysqlpp@stripped> wrote:
>
>> Some quotes come from the SO post, since it contains more detail.
>>
>> Answering here instead of there because I do not yet have "the answer".
>>
>> On 6/21/2011 4:12 PM, Benjamin Johnson wrote:
>>
>>> host_guid value...unsigned __int64,
>>>
>>
>> Why are you calling a 64-bit value a GUID?  GUIDs are 128 bits.
>>
>
> I can call the value whatever I want eh? For us 64-bits means it is
> globally unique for our purpose, and 64-bit values are much easier to work
> with in code than 128-bits as there are uint64_t and unsigned __int64 types
> on the platforms we care about.  We might later move to 128-bits for our
> "guids", but that doesn't matter for this case.
>
>
>>  a win32 c++ app
>>>
>>
>> Do you mean a Win64 app?
>>
>> Or is it the case that you are building 32-bit binaries and are relying on
>> MS's compiler to give you non-native 64-bit integer support?
>>
>
> Building 32-bit binary that will run on either 32-bit or 64-bit system.
>  Later I might have two versions, but for now that's how it is.
>
>>
>>  if I dump the mysql database, move it over to windows 7 and run the
>>> same binary that reads the database, it works great.
>>>
>>
>> I don't quite see how that can be the case with a statically-compiled,
>> statically-typed language like C++.  It is true that MySQL++ essentially
>> adds a dynamic typing system to your program, but once you compile code like
>> you show, the types get fixed in stone.
>>
>>
> We've had 3 people working on this for 2 days now, and yes, we agree -- we
> cannot see how that can be the case (thus the email to the list).
>
>
>> The only guess I have is that the C++ RTL is different, and you're linking
>> against a copy MS ships with the OS, and it is different between the two
>> OSes.  The way to test this is to statically link your program.  (/MT,
>> rather than /MD.)
>>
>>
> This is our guess too -- posting here to see if anyone has seen similar
> issues or insight into why this would happen.
>
>
>
>>  I'm including the code that reproduces it.
>>>
>>
>> Thanks, but I for one do not have a Windows 2008 server sitting around.
>>
>>
> Very understandable.  It's not pleasant.
>
>
>>      mysqlpp::Query query = conn.query();
>>>     query<<  "select 15216036968564760613 as host_guid";
>>>
>>
>> Do you get the same behavior if you select the data from an actual
>> database, so that the code has type info from the MySQL server to work with?
>>  I tried it on a 64-bit Linux box, and it works fine here:
>>
>
> The reason I wrote this app is because I was seeing the problem with real
> data.  When I select from an actual database, it works on Windows 7 and
> fails on Windows 2008r2.  I would expect Linux to work fine as I would
> expect every system to work fine.
>
>
>> Index: examples/stock.h
>> ==============================**==============================**=======
>> --- examples/stock.h    (revision 2692)
>> +++ examples/stock.h    (working copy)
>> @@ -39,7 +39,7 @@
>>  sql_create_6(stock,
>>    1, 6, // The meaning of these values is covered in the user manual
>>    mysqlpp::sql_char, item,
>> -   mysqlpp::sql_bigint, num,
>> +   mysqlpp::sql_bigint_unsigned, num,
>>    mysqlpp::sql_double, weight,
>>    mysqlpp::sql_double_null, price,
>>    mysqlpp::sql_date, sDate,           // SSQLS isn't case-sensitive!
>> Index: examples/resetdb.cpp
>> ==============================**==============================**=======
>> --- examples/resetdb.cpp    (revision 2692)
>> +++ examples/resetdb.cpp    (working copy)
>> @@ -135,7 +135,7 @@
>>        query <<
>>                "CREATE TABLE stock (" <<
>>                "  item CHAR(30) NOT NULL, " <<
>> -               "  num BIGINT NOT NULL, " <<
>> +               "  num BIGINT UNSIGNED NOT NULL, " <<
>>                "  weight DOUBLE NOT NULL, " <<
>>                "  price DECIMAL(6,2) NULL, " << // NaN & inf. == NULL
>>                "  sdate DATE NOT NULL, " <<
>> @@ -165,7 +165,10 @@
>>        query.execute("Pickle Relish", 87, 1.5, 1.75, "1998-09-04");
>>        query.execute("Hot Mustard", 73, .95, .97, "1998-05-25",
>>                "good American yellow mustard, not that European stuff");
>> -       query.execute("Hotdog Buns", 65, 1.1, 1.1, "1998-04-23");
>> +       query.execute("Hotdog Buns",
>> +               mysqlpp::sql_bigint_unsigned(**15216036968564760613ULL),
>> +               1.1, 1.1, "1998-04-23");
>> +       cout << "SIZEOF: " << sizeof(mysqlpp::sql_bigint_**unsigned)
> <<
>> endl;
>>
>>        // Test that above did what we wanted.
>>        cout << "inserted " << con.count_rows("stock") << "
> rows." << endl;
>>
>> --
>> MySQL++ Mailing List
>> For list archives:
> http://lists.mysql.com/**plusplus<http://lists.mysql.com/plusplus>
>> To unsubscribe:    http://lists.mysql.com/**plusplus?unsub=1
>> benjaminjohnson80@stripped<http://lists.mysql.com/plusplus?unsub=1
>>
>>
>

Thread
Unsigned 64-bit IssueBenjamin Johnson22 Jun
  • Re: Unsigned 64-bit IssueWarren Young22 Jun
    • Re: Unsigned 64-bit IssueBenjamin Johnson22 Jun
      • Re: Unsigned 64-bit IssueBenjamin Johnson22 Jun
        • Re: Unsigned 64-bit IssueWarren Young22 Jun