MySQL使用bigint

1、bigint占用8个字节

有符号数范围:

-9223372036854775808 9223372036854775807

无符号数范围:

0 18446744073709551615

2、通过绿色工具打开表直接输入18446744073709551615保存不上,只能通过SQL语句保存

3、sql语句中可以使用整数常量

update table set cmd = cmd & (1 << n),其中的1,MySQL会自动解析为64位的,因此不必担心越界问题

4、在vc中使用64位整数相关的类型和函数

__int64, unsigned __int64;

__int64 _atoi64( const char *string );

char *_i64toa( __int64 value, char *string, int radix );

char * _ui64toa( unsigned _int64 value, char *string, int radix );


注意在vc中使用常量64位数就不能直接写数字了

__int64 nCmd = 0xFF;

nCmd = nCmd & (1 << n);

其中,直接写1的话,不对,编译器为认为是16位的1,可以显式定义一个变量__int64 nMask = 1;然后使用nMask:

nCmd = nCmd & (nMask <<n);

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值