zamotivator

Untitled

Feb 15th, 2012
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 75.69 KB | None | 0 0
  1. diff -ruN 216/sql/field.cc 217/sql/field.cc
  2. --- 216/sql/field.cc 2012-02-15 16:28:19.115145015 +0900
  3. +++ 217/sql/field.cc 2012-02-15 16:28:27.521161706 +0900
  4. @@ -1123,9 +1123,8 @@
  5. 2 error: garbage at the end of string.
  6. */
  7.  
  8. -int Field_num::check_int_truncated(CHARSET_INFO *cs, const char *str,
  9. - int length, const char *int_end, int error,
  10. - bool *truncated)
  11. +int Field_num::check_int(CHARSET_INFO *cs, const char *str, int length,
  12. + const char *int_end, int error,bool *truncated)
  13. {
  14. if (truncated)
  15. {
  16. @@ -1142,7 +1141,7 @@
  17. *truncated= true;
  18. }
  19. push_warning_printf(table->in_use, MYSQL_ERROR::WARN_LEVEL_WARN,
  20. - ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
  21. + ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
  22. ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
  23. "integer", tmp.c_ptr(), field_name,
  24. (ulong) table->in_use->row_count);
  25. @@ -1185,10 +1184,10 @@
  26. 1 error
  27. */
  28.  
  29. -bool Field_num::get_int_truncated(CHARSET_INFO *cs, const char *from, uint len,
  30. - longlong *rnd, ulonglong unsigned_max,
  31. - longlong signed_min, longlong signed_max,
  32. - bool *truncated)
  33. +bool Field_num::get_int(CHARSET_INFO *cs, const char *from, uint len,
  34. + longlong *rnd, ulonglong unsigned_max,
  35. + longlong signed_min, longlong signed_max,
  36. + bool *truncated)
  37. {
  38. if (truncated)
  39. {
  40. @@ -1248,9 +1247,9 @@
  41. 0 no error or some other errors except overflow
  42. */
  43.  
  44. -int Field::warn_if_overflow_truncated(int op_result, bool *truncated)
  45. +int Field::warn_if_overflow(int op_result, bool *truncated)
  46. {
  47. - if_overflow_truncated(op_result, truncated);
  48. + if_overflow(op_result, truncated);
  49. if (op_result == E_DEC_OVERFLOW)
  50. {
  51. set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
  52. @@ -1632,9 +1631,9 @@
  53. @return
  54. value converted from val
  55. */
  56. -longlong Field::convert_decimal2longlong_truncated(const my_decimal *val,
  57. - bool unsigned_flag, int *err,
  58. - bool *truncated)
  59. +longlong Field::convert_decimal2longlong(const my_decimal *val,
  60. + bool unsigned_flag, int *err,
  61. + bool *truncated)
  62. {
  63. if (truncated)
  64. {
  65. @@ -1653,21 +1652,17 @@
  66. i= 0;
  67. *err= 1;
  68. }
  69. - else if (warn_if_overflow_truncated(my_decimal2int(E_DEC_ERROR &
  70. - ~E_DEC_OVERFLOW &
  71. - ~E_DEC_TRUNCATED,
  72. - val, TRUE, &i),
  73. - truncated))
  74. + else if (warn_if_overflow(my_decimal2int(E_DEC_ERROR & ~E_DEC_OVERFLOW &
  75. + ~E_DEC_TRUNCATED, val, TRUE, &i),
  76. + truncated))
  77. {
  78. i= ~(longlong) 0;
  79. *err= 1;
  80. }
  81. }
  82. - else if (warn_if_overflow_truncated(my_decimal2int(E_DEC_ERROR &
  83. - ~E_DEC_OVERFLOW &
  84. - ~E_DEC_TRUNCATED,
  85. - val, FALSE, &i),
  86. - truncated))
  87. + else if (warn_if_overflow(my_decimal2int(E_DEC_ERROR & ~E_DEC_OVERFLOW &
  88. + ~E_DEC_TRUNCATED, val, FALSE, &i),
  89. + truncated))
  90. {
  91. i= (val->sign() ? LONGLONG_MIN : LONGLONG_MAX);
  92. *err= 1;
  93. @@ -1690,14 +1685,14 @@
  94. !=0 error
  95. */
  96.  
  97. -int Field_num::store_decimal_truncated(const my_decimal *val, bool *truncated)
  98. +int Field_num::store_decimal(const my_decimal *val, bool *truncated)
  99. {
  100. ASSERT_COLUMN_MARKED_FOR_WRITE;
  101. int err= 0;
  102. - longlong i= convert_decimal2longlong_truncated(val, unsigned_flag,
  103. - &err, truncated);
  104. + longlong i= convert_decimal2longlong(val, unsigned_flag, &err,
  105. + truncated);
  106. bool truncated2= false;
  107. - int result= test(err | store_truncated(i, unsigned_flag, &truncated2));
  108. + int result= test(err | store(i, unsigned_flag, &truncated2));
  109. if (truncated)
  110. {
  111. *truncated= *truncated || truncated2;
  112. @@ -1769,15 +1764,15 @@
  113. !=0 error
  114. */
  115.  
  116. -int Field_str::store_decimal_truncated(const my_decimal *d, bool *truncated)
  117. +int Field_str::store_decimal(const my_decimal *d, bool *truncated)
  118. {
  119. ASSERT_COLUMN_MARKED_FOR_WRITE;
  120. double val;
  121. /* TODO: use decimal2string? */
  122. int err= my_decimal2double(E_DEC_FATAL_ERROR & ~E_DEC_OVERFLOW, d, &val);
  123. - err= warn_if_overflow_truncated(err, truncated);
  124. + err= warn_if_overflow(err, truncated);
  125. bool truncated2= false;
  126. - int result= err | store_truncated(val, &truncated2);
  127. + int result= err | store(val, &truncated2);
  128. if (truncated)
  129. {
  130. *truncated= (*truncated) || truncated2;
  131. @@ -1978,8 +1973,8 @@
  132. }
  133.  
  134.  
  135. -int Field_decimal::store_truncated(const char *from_arg, uint len,
  136. - CHARSET_INFO *cs, bool *truncated)
  137. +int Field_decimal::store(const char *from_arg, uint len, CHARSET_INFO *cs,
  138. + bool *truncated)
  139. {
  140. if (truncated)
  141. {
  142. @@ -2332,8 +2327,7 @@
  143. {
  144. *truncated= true;
  145. }
  146. - set_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
  147. - WARN_DATA_TRUNCATED, 1);
  148. + set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1);
  149. }
  150. return 0;
  151. }
  152. @@ -2375,7 +2369,7 @@
  153. }
  154.  
  155.  
  156. -int Field_decimal::store_truncated(double nr, bool *truncated)
  157. +int Field_decimal::store(double nr, bool *truncated)
  158. {
  159. if (truncated)
  160. {
  161. @@ -2432,7 +2426,7 @@
  162. }
  163.  
  164.  
  165. -int Field_decimal::store_truncated(longlong nr, bool unsigned_val, bool *truncated)
  166. +int Field_decimal::store(longlong nr, bool unsigned_val, bool *truncated)
  167. {
  168. if (truncated)
  169. {
  170. @@ -2720,8 +2714,8 @@
  171. 1 error
  172. */
  173.  
  174. -bool Field_new_decimal::store_value_truncated(const my_decimal *decimal_value,
  175. - bool *truncated)
  176. +bool Field_new_decimal::store_value(const my_decimal *decimal_value,
  177. + bool *truncated)
  178. {
  179. if (truncated)
  180. {
  181. @@ -2758,11 +2752,9 @@
  182. }
  183. #endif
  184.  
  185. - if (warn_if_overflow_truncated(my_decimal2binary(E_DEC_FATAL_ERROR &
  186. - ~E_DEC_OVERFLOW,
  187. - decimal_value, ptr,
  188. - precision, dec),
  189. - truncated))
  190. + if (warn_if_overflow(my_decimal2binary(E_DEC_FATAL_ERROR & ~E_DEC_OVERFLOW,
  191. + decimal_value, ptr, precision, dec),
  192. + truncated))
  193. {
  194. my_decimal buff;
  195. DBUG_PRINT("info", ("overflow"));
  196. @@ -2776,9 +2768,8 @@
  197. }
  198.  
  199.  
  200. -int Field_new_decimal::store_truncated(const char *from, uint length,
  201. - CHARSET_INFO *charset_arg,
  202. - bool *truncated)
  203. +int Field_new_decimal::store(const char *from, uint length,
  204. + CHARSET_INFO *charset_arg, bool *truncated)
  205. {
  206. if (truncated)
  207. {
  208. @@ -2851,7 +2842,7 @@
  209. dbug_decimal_as_string(dbug_buff, &decimal_value)));
  210. #endif
  211. bool truncated2= false;
  212. - store_value_truncated(&decimal_value, &truncated2);
  213. + store_value(&decimal_value, &truncated2);
  214. if (truncated)
  215. {
  216. *truncated= (*truncated) || truncated2;
  217. @@ -2866,7 +2857,7 @@
  218. will return E_DEC_TRUNCATED always correctly
  219. */
  220.  
  221. -int Field_new_decimal::store_truncated(double nr, bool *truncated)
  222. +int Field_new_decimal::store(double nr, bool *truncated)
  223. {
  224. if (truncated)
  225. {
  226. @@ -2883,7 +2874,7 @@
  227. TODO: fix following when double2my_decimal when double2decimal
  228. will return E_DEC_TRUNCATED always correctly
  229. */
  230. - if_overflow_truncated(err, truncated);
  231. + if_overflow(err, truncated);
  232. if (!err)
  233. {
  234. double nr2;
  235. @@ -2911,7 +2902,7 @@
  236. table->in_use->got_warning= 0;
  237. }
  238. bool truncated2= false;
  239. - if (store_value_truncated(&decimal_value, &truncated2))
  240. + if (store_value(&decimal_value, &truncated2))
  241. err= 1;
  242. else if (err && !table->in_use->got_warning)
  243. err= warn_if_overflow(err);
  244. @@ -2923,8 +2914,7 @@
  245. }
  246.  
  247.  
  248. -int Field_new_decimal::store_truncated(longlong nr, bool unsigned_val,
  249. - bool *truncated)
  250. +int Field_new_decimal::store(longlong nr, bool unsigned_val, bool *truncated)
  251. {
  252. if (truncated)
  253. {
  254. @@ -2941,12 +2931,12 @@
  255. {
  256. set_value_on_overflow(&decimal_value, decimal_value.sign());
  257. }
  258. - if_overflow_truncated(err, truncated);
  259. + if_overflow(err, truncated);
  260. /* Only issue a warning if store_value doesn't issue an warning */
  261. table->in_use->got_warning= 0;
  262. }
  263. bool truncated2= false;
  264. - if (store_value_truncated(&decimal_value, &truncated2))
  265. + if (store_value(&decimal_value, &truncated2))
  266. err= 1;
  267. else if (err && !table->in_use->got_warning)
  268. err= warn_if_overflow(err);
  269. @@ -2958,11 +2948,11 @@
  270. }
  271.  
  272.  
  273. -int Field_new_decimal::store_decimal_truncated(const my_decimal *decimal_value,
  274. - bool *truncated)
  275. +int Field_new_decimal::store_decimal(const my_decimal *decimal_value,
  276. + bool *truncated)
  277. {
  278. ASSERT_COLUMN_MARKED_FOR_WRITE;
  279. - return store_value_truncated(decimal_value, truncated);
  280. + return store_value(decimal_value, truncated);
  281. }
  282.  
  283.  
  284. @@ -3193,20 +3183,20 @@
  285. ** tiny int
  286. ****************************************************************************/
  287.  
  288. -int Field_tiny::store_truncated(const char *from, uint len, CHARSET_INFO *cs,
  289. - bool *truncated)
  290. +int Field_tiny::store(const char *from, uint len, CHARSET_INFO *cs,
  291. + bool *truncated)
  292. {
  293. ASSERT_COLUMN_MARKED_FOR_WRITE;
  294. int error;
  295. longlong rnd;
  296.  
  297. - error= get_int_truncated(cs, from, len, &rnd, 255, -128, 127, truncated);
  298. + error= get_int(cs, from, len, &rnd, 255, -128, 127, truncated);
  299. ptr[0]= unsigned_flag ? (char) (ulonglong) rnd : (char) rnd;
  300. return error;
  301. }
  302.  
  303.  
  304. -int Field_tiny::store_truncated(double nr, bool *truncated)
  305. +int Field_tiny::store(double nr, bool *truncated)
  306. {
  307. if (truncated)
  308. {
  309. @@ -3269,7 +3259,7 @@
  310. }
  311.  
  312.  
  313. -int Field_tiny::store_truncated(longlong nr, bool unsigned_val, bool *truncated)
  314. +int Field_tiny::store(longlong nr, bool unsigned_val, bool *truncated)
  315. {
  316. if (truncated)
  317. {
  318. @@ -3397,16 +3387,16 @@
  319. Field type short int (2 byte)
  320. ****************************************************************************/
  321.  
  322. -int Field_short::store_truncated(const char *from, uint len, CHARSET_INFO *cs,
  323. - bool *truncated)
  324. +int Field_short::store(const char *from, uint len, CHARSET_INFO *cs,
  325. + bool *truncated)
  326. {
  327. ASSERT_COLUMN_MARKED_FOR_WRITE;
  328. int store_tmp;
  329. int error;
  330. longlong rnd;
  331.  
  332. - error= get_int_truncated(cs, from, len, &rnd, UINT_MAX16, INT_MIN16,
  333. - INT_MAX16, truncated);
  334. + error= get_int(cs, from, len, &rnd, UINT_MAX16, INT_MIN16, INT_MAX16,
  335. + truncated);
  336. store_tmp= unsigned_flag ? (int) (ulonglong) rnd : (int) rnd;
  337. #ifdef WORDS_BIGENDIAN
  338. if (table->s->db_low_byte_first)
  339. @@ -3420,7 +3410,7 @@
  340. }
  341.  
  342.  
  343. -int Field_short::store_truncated(double nr, bool *truncated)
  344. +int Field_short::store(double nr, bool *truncated)
  345. {
  346. if (truncated)
  347. {
  348. @@ -3492,7 +3482,7 @@
  349. }
  350.  
  351.  
  352. -int Field_short::store_truncated(longlong nr, bool unsigned_val, bool *truncated)
  353. +int Field_short::store(longlong nr, bool unsigned_val, bool *truncated)
  354. {
  355. if (truncated)
  356. {
  357. @@ -3674,22 +3664,23 @@
  358. Field type medium int (3 byte)
  359. ****************************************************************************/
  360.  
  361. -int Field_medium::store_truncated(const char *from, uint len, CHARSET_INFO *cs,
  362. - bool *truncated)
  363. +int Field_medium::store(const char *from, uint len, CHARSET_INFO *cs,
  364. + bool *truncated)
  365. {
  366. ASSERT_COLUMN_MARKED_FOR_WRITE;
  367. int store_tmp;
  368. int error;
  369. longlong rnd;
  370.  
  371. - error= get_int_truncated(cs, from, len, &rnd, UINT_MAX24, INT_MIN24, INT_MAX24, truncated);
  372. + error= get_int(cs, from, len, &rnd, UINT_MAX24, INT_MIN24, INT_MAX24,
  373. + truncated);
  374. store_tmp= unsigned_flag ? (int) (ulonglong) rnd : (int) rnd;
  375. int3store(ptr, store_tmp);
  376. return error;
  377. }
  378.  
  379.  
  380. -int Field_medium::store_truncated(double nr, bool *truncated)
  381. +int Field_medium::store(double nr, bool *truncated)
  382. {
  383. if (truncated)
  384. {
  385. @@ -3743,7 +3734,7 @@
  386. }
  387.  
  388.  
  389. -int Field_medium::store_truncated(longlong nr, bool unsigned_val, bool *truncated)
  390. +int Field_medium::store(longlong nr, bool unsigned_val, bool *truncated)
  391. {
  392. if (truncated)
  393. {
  394. @@ -3881,16 +3872,16 @@
  395. ** long int
  396. ****************************************************************************/
  397.  
  398. -int Field_long::store_truncated(const char *from, uint len, CHARSET_INFO *cs,
  399. - bool *truncated)
  400. +int Field_long::store(const char *from, uint len, CHARSET_INFO *cs,
  401. + bool *truncated)
  402. {
  403. ASSERT_COLUMN_MARKED_FOR_WRITE;
  404. long store_tmp;
  405. int error;
  406. longlong rnd;
  407.  
  408. - error= get_int_truncated(cs, from, len, &rnd, UINT_MAX32, INT_MIN32,
  409. - INT_MAX32, truncated);
  410. + error= get_int(cs, from, len, &rnd, UINT_MAX32, INT_MIN32, INT_MAX32,
  411. + truncated);
  412. store_tmp= unsigned_flag ? (long) (ulonglong) rnd : (long) rnd;
  413. #ifdef WORDS_BIGENDIAN
  414. if (table->s->db_low_byte_first)
  415. @@ -3904,7 +3895,7 @@
  416. }
  417.  
  418.  
  419. -int Field_long::store_truncated(double nr, bool *truncated)
  420. +int Field_long::store(double nr, bool *truncated)
  421. {
  422. if (truncated)
  423. {
  424. @@ -3965,7 +3956,7 @@
  425. }
  426.  
  427.  
  428. -int Field_long::store_truncated(longlong nr, bool unsigned_val, bool *truncated)
  429. +int Field_long::store(longlong nr, bool unsigned_val, bool *truncated)
  430. {
  431. if (truncated)
  432. {
  433. @@ -4149,8 +4140,8 @@
  434. Field type longlong int (8 bytes)
  435. ****************************************************************************/
  436.  
  437. -int Field_longlong::store_truncated(const char *from, uint len,
  438. - CHARSET_INFO *cs, bool *truncated)
  439. +int Field_longlong::store(const char *from, uint len, CHARSET_INFO *cs,
  440. + bool *truncated)
  441. {
  442. if (truncated)
  443. {
  444. @@ -4171,8 +4162,8 @@
  445. set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
  446. error= 1;
  447. }
  448. - else if (table->in_use->count_cuted_fields &&
  449. - check_int_truncated(cs, from, len, end, error, truncated))
  450. + else if (table->in_use->count_cuted_fields &&
  451. + check_int(cs, from, len, end, error, truncated))
  452. error= 1;
  453. else
  454. error= 0;
  455. @@ -4188,7 +4179,7 @@
  456. }
  457.  
  458.  
  459. -int Field_longlong::store_truncated(double nr, bool *truncated)
  460. +int Field_longlong::store(double nr, bool *truncated)
  461. {
  462. if (truncated)
  463. {
  464. @@ -4250,7 +4241,7 @@
  465. }
  466.  
  467.  
  468. -int Field_longlong::store_truncated(longlong nr, bool unsigned_val, bool *truncated)
  469. +int Field_longlong::store(longlong nr, bool unsigned_val, bool *truncated)
  470. {
  471. if (truncated)
  472. {
  473. @@ -4467,8 +4458,8 @@
  474. single precision float
  475. ****************************************************************************/
  476.  
  477. -int Field_float::store_truncated(const char *from, uint len, CHARSET_INFO* cs,
  478. - bool *truncated)
  479. +int Field_float::store(const char *from, uint len, CHARSET_INFO* cs,
  480. + bool *truncated)
  481. {
  482. if (truncated)
  483. {
  484. @@ -4489,7 +4480,7 @@
  485. error= error ? 1 : 2;
  486. }
  487. bool truncated2= false;
  488. - Field_float::store_truncated(nr, &truncated2);
  489. + Field_float::store(nr, &truncated2);
  490. if (truncated)
  491. {
  492. *truncated= (*truncated) || truncated2;
  493. @@ -4498,10 +4489,10 @@
  494. }
  495.  
  496.  
  497. -int Field_float::store_truncated(double nr, bool *truncated)
  498. +int Field_float::store(double nr, bool *truncated)
  499. {
  500. ASSERT_COLUMN_MARKED_FOR_WRITE;
  501. - int error= truncate_truncated(&nr, FLT_MAX, truncated);
  502. + int error= truncate(&nr, FLT_MAX, truncated);
  503. float j= (float)nr;
  504.  
  505. #ifdef WORDS_BIGENDIAN
  506. @@ -4516,12 +4507,10 @@
  507. }
  508.  
  509.  
  510. -int Field_float::store_truncated(longlong nr, bool unsigned_val, bool *truncated)
  511. +int Field_float::store(longlong nr, bool unsigned_val, bool *truncated)
  512. {
  513. - return Field_float::store_truncated(unsigned_val ?
  514. - ulonglong2double((ulonglong) nr) :
  515. - (double) nr,
  516. - truncated);
  517. + return Field_float::store(unsigned_val ? ulonglong2double((ulonglong) nr) :
  518. + (double) nr, truncated);
  519. }
  520.  
  521.  
  522. @@ -4745,8 +4734,8 @@
  523. double precision floating point numbers
  524. ****************************************************************************/
  525.  
  526. -int Field_double::store_truncated(const char *from, uint len, CHARSET_INFO *cs,
  527. - bool *truncated)
  528. +int Field_double::store(const char *from, uint len, CHARSET_INFO *cs,
  529. + bool *truncated)
  530. {
  531. if (truncated)
  532. {
  533. @@ -4767,7 +4756,7 @@
  534. error= error ? 1 : 2;
  535. }
  536. bool truncated2= false;
  537. - Field_double::store_truncated(nr, &truncated2);
  538. + Field_double::store(nr, &truncated2);
  539. if (truncated)
  540. {
  541. *truncated= (*truncated) || truncated2;
  542. @@ -4776,10 +4765,10 @@
  543. }
  544.  
  545.  
  546. -int Field_double::store_truncated(double nr, bool *truncated)
  547. +int Field_double::store(double nr, bool *truncated)
  548. {
  549. ASSERT_COLUMN_MARKED_FOR_WRITE;
  550. - int error= truncate_truncated(&nr, DBL_MAX, truncated);
  551. + int error= truncate(&nr, DBL_MAX, truncated);
  552.  
  553. #ifdef WORDS_BIGENDIAN
  554. if (table->s->db_low_byte_first)
  555. @@ -4793,12 +4782,10 @@
  556. }
  557.  
  558.  
  559. -int Field_double::store_truncated(longlong nr, bool unsigned_val, bool *truncated)
  560. +int Field_double::store(longlong nr, bool unsigned_val, bool *truncated)
  561. {
  562. - return Field_double::store_truncated(unsigned_val ?
  563. - ulonglong2double((ulonglong) nr) :
  564. - (double) nr,
  565. - truncated);
  566. + return Field_double::store(unsigned_val ? ulonglong2double((ulonglong) nr) :
  567. + (double) nr, truncated);
  568. }
  569.  
  570. /*
  571. @@ -4807,8 +4794,7 @@
  572. Also ensure that the argument is within [-max_value; max_value] range.
  573. */
  574.  
  575. -int Field_real::truncate_truncated(double *nr, double max_value,
  576. - bool *truncated)
  577. +int Field_real::truncate(double *nr, double max_value, bool *truncated)
  578. {
  579. if (truncated)
  580. {
  581. @@ -4880,11 +4866,11 @@
  582. }
  583.  
  584.  
  585. -int Field_real::store_decimal_truncated(const my_decimal *dm, bool *truncated)
  586. +int Field_real::store_decimal(const my_decimal *dm, bool *truncated)
  587. {
  588. double dbl;
  589. my_decimal2double(E_DEC_FATAL_ERROR, dm, &dbl);
  590. - return store_truncated(dbl, truncated);
  591. + return store(dbl, truncated);
  592. }
  593.  
  594. double Field_double::val_real(void)
  595. @@ -5226,8 +5212,8 @@
  596. }
  597.  
  598.  
  599. -int Field_timestamp::store_truncated(const char *from, uint len,
  600. - CHARSET_INFO *cs, bool *truncated)
  601. +int Field_timestamp::store(const char *from, uint len, CHARSET_INFO *cs,
  602. + bool *truncated)
  603. {
  604. if (truncated)
  605. {
  606. @@ -5286,7 +5272,7 @@
  607. }
  608.  
  609.  
  610. -int Field_timestamp::store_truncated(double nr, bool *truncated)
  611. +int Field_timestamp::store(double nr, bool *truncated)
  612. {
  613. if (truncated)
  614. {
  615. @@ -5306,7 +5292,7 @@
  616. error= 1;
  617. }
  618. bool truncated2= false;
  619. - error|= Field_timestamp::store_truncated((longlong) rint(nr), FALSE, &truncated2);
  620. + error|= Field_timestamp::store((longlong) rint(nr), FALSE, &truncated2);
  621. if (truncated)
  622. {
  623. *truncated= (*truncated) || truncated2;
  624. @@ -5315,7 +5301,7 @@
  625. }
  626.  
  627.  
  628. -int Field_timestamp::store_truncated(longlong nr, bool unsigned_val, bool *truncated)
  629. +int Field_timestamp::store(longlong nr, bool unsigned_val, bool *truncated)
  630. {
  631. if (truncated)
  632. {
  633. @@ -5576,8 +5562,8 @@
  634. ** Stored as a 3 byte unsigned int
  635. ****************************************************************************/
  636.  
  637. -int Field_time::store_truncated(const char *from, uint len, CHARSET_INFO *cs,
  638. - bool *truncated)
  639. +int Field_time::store(const char *from, uint len, CHARSET_INFO *cs,
  640. + bool *truncated)
  641. {
  642. if (truncated)
  643. {
  644. @@ -5645,7 +5631,7 @@
  645. }
  646.  
  647.  
  648. -int Field_time::store_truncated(double nr, bool *truncated)
  649. +int Field_time::store(double nr, bool *truncated)
  650. {
  651. if (truncated)
  652. {
  653. @@ -5699,7 +5685,7 @@
  654. }
  655.  
  656.  
  657. -int Field_time::store_truncated(longlong nr, bool unsigned_val, bool *truncated)
  658. +int Field_time::store(longlong nr, bool unsigned_val, bool *truncated)
  659. {
  660. if (truncated)
  661. {
  662. @@ -5715,7 +5701,7 @@
  663. {
  664. *truncated= true;
  665. }
  666. - set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
  667. + set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
  668. ER_WARN_DATA_OUT_OF_RANGE, nr,
  669. MYSQL_TIMESTAMP_TIME, 1);
  670. error= 1;
  671. @@ -5727,7 +5713,7 @@
  672. {
  673. *truncated= true;
  674. }
  675. - set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
  676. + set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
  677. ER_WARN_DATA_OUT_OF_RANGE, nr,
  678. MYSQL_TIMESTAMP_TIME, 1);
  679. error= 1;
  680. @@ -5742,7 +5728,7 @@
  681. {
  682. *truncated= true;
  683. }
  684. - set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
  685. + set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
  686. ER_WARN_DATA_OUT_OF_RANGE, nr,
  687. MYSQL_TIMESTAMP_TIME, 1);
  688. error= 1;
  689. @@ -5873,8 +5859,8 @@
  690. ** Can handle 2 byte or 4 byte years!
  691. ****************************************************************************/
  692.  
  693. -int Field_year::store_truncated(const char *from, uint len, CHARSET_INFO *cs,
  694. - bool *truncated)
  695. +int Field_year::store(const char *from, uint len, CHARSET_INFO *cs,
  696. + bool *truncated)
  697. {
  698. if (truncated)
  699. {
  700. @@ -5919,18 +5905,18 @@
  701. }
  702.  
  703.  
  704. -int Field_year::store_truncated(double nr, bool *truncated)
  705. +int Field_year::store(double nr, bool *truncated)
  706. {
  707. if (nr < 0.0 || nr >= 2155.0)
  708. {
  709. - (void) Field_year::store_truncated((longlong) -1, FALSE, truncated);
  710. + (void) Field_year::store((longlong) -1, FALSE, truncated);
  711. return 1;
  712. }
  713. - return Field_year::store_truncated((longlong) nr, FALSE, truncated);
  714. + return Field_year::store((longlong) nr, FALSE, truncated);
  715. }
  716.  
  717.  
  718. -int Field_year::store_truncated(longlong nr, bool unsigned_val, bool *truncated)
  719. +int Field_year::store(longlong nr, bool unsigned_val, bool *truncated)
  720. {
  721. if (truncated)
  722. {
  723. @@ -6013,8 +5999,8 @@
  724. ** Stored as a 4 byte unsigned int
  725. ****************************************************************************/
  726.  
  727. -int Field_date::store_truncated(const char *from, uint len, CHARSET_INFO *cs,
  728. - bool *truncated)
  729. +int Field_date::store(const char *from, uint len, CHARSET_INFO *cs,
  730. + bool *truncated)
  731. {
  732. if (truncated)
  733. {
  734. @@ -6060,7 +6046,7 @@
  735. }
  736.  
  737.  
  738. -int Field_date::store_truncated(double nr, bool *truncated)
  739. +int Field_date::store(double nr, bool *truncated)
  740. {
  741. if (truncated)
  742. {
  743. @@ -6084,7 +6070,7 @@
  744. tmp= (longlong) rint(nr);
  745.  
  746. bool truncated2= false;
  747. - int result= Field_date::store_truncated(tmp, TRUE, &truncated2);
  748. + int result= Field_date::store(tmp, TRUE, &truncated2);
  749. if (truncated)
  750. {
  751. *truncated= (*truncated) || truncated2;
  752. @@ -6093,7 +6079,7 @@
  753. }
  754.  
  755.  
  756. -int Field_date::store_truncated(longlong nr, bool unsigned_val, bool *truncated)
  757. +int Field_date::store(longlong nr, bool unsigned_val, bool *truncated)
  758. {
  759. if (truncated)
  760. {
  761. @@ -6282,8 +6268,8 @@
  762. store function.
  763. */
  764.  
  765. -int Field_newdate::store_truncated(const char *from, uint len, CHARSET_INFO *cs,
  766. - bool *truncated)
  767. +int Field_newdate::store(const char *from, uint len, CHARSET_INFO *cs,
  768. + bool *truncated)
  769. {
  770. if (truncated)
  771. {
  772. @@ -6330,7 +6316,7 @@
  773. }
  774.  
  775.  
  776. -int Field_newdate::store_truncated(double nr, bool *truncated)
  777. +int Field_newdate::store(double nr, bool *truncated)
  778. {
  779. if (nr < 0.0 || nr > 99991231235959.0)
  780. {
  781. @@ -6343,11 +6329,11 @@
  782. WARN_DATA_TRUNCATED, nr, MYSQL_TIMESTAMP_DATE);
  783. return 1;
  784. }
  785. - return Field_newdate::store_truncated((longlong) rint(nr), FALSE, truncated);
  786. + return Field_newdate::store((longlong) rint(nr), FALSE, truncated);
  787. }
  788.  
  789.  
  790. -int Field_newdate::store_truncated(longlong nr, bool unsigned_val, bool *truncated)
  791. +int Field_newdate::store(longlong nr, bool unsigned_val, bool *truncated)
  792. {
  793. if (truncated)
  794. {
  795. @@ -6421,8 +6407,7 @@
  796. char buff[MAX_DATE_STRING_REP_LENGTH];
  797. String str(buff, sizeof(buff), &my_charset_latin1);
  798. make_datetime((DATE_TIME_FORMAT *) 0, ltime, &str);
  799. - set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_NOTE,
  800. - WARN_DATA_TRUNCATED,
  801. + set_datetime_warning(MYSQL_ERROR::WARN_LEVEL_NOTE, WARN_DATA_TRUNCATED,
  802. str.ptr(), str.length(), MYSQL_TIMESTAMP_DATE, 1);
  803. error= 3;
  804. }
  805. @@ -6540,8 +6525,8 @@
  806. ** Stored as a 8 byte unsigned int. Should sometimes be change to a 6 byte int.
  807. ****************************************************************************/
  808.  
  809. -int Field_datetime::store_truncated(const char *from, uint len,
  810. - CHARSET_INFO *cs, bool *truncated)
  811. +int Field_datetime::store(const char *from, uint len, CHARSET_INFO *cs,
  812. + bool *truncated)
  813. {
  814. if (truncated)
  815. {
  816. @@ -6588,7 +6573,7 @@
  817. }
  818.  
  819.  
  820. -int Field_datetime::store_truncated(double nr, bool *truncated)
  821. +int Field_datetime::store(double nr, bool *truncated)
  822. {
  823. if (truncated)
  824. {
  825. @@ -6608,8 +6593,7 @@
  826. error= 1;
  827. }
  828. bool truncated2= false;
  829. - error|= Field_datetime::store_truncated((longlong) rint(nr), FALSE,
  830. - &truncated2);
  831. + error|= Field_datetime::store((longlong) rint(nr), FALSE, &truncated2);
  832. if (truncated)
  833. {
  834. *truncated= (*truncated) || truncated2;
  835. @@ -6618,8 +6602,7 @@
  836. }
  837.  
  838.  
  839. -int Field_datetime::store_truncated(longlong nr, bool unsigned_val,
  840. - bool *truncated)
  841. +int Field_datetime::store(longlong nr, bool unsigned_val, bool *truncated)
  842. {
  843. if (truncated)
  844. {
  845. @@ -6970,8 +6953,8 @@
  846.  
  847. /* Copy a string and fill with space */
  848.  
  849. -int Field_string::store_truncated(const char *from, uint length, CHARSET_INFO *cs,
  850. - bool *truncated)
  851. +int Field_string::store(const char *from, uint length, CHARSET_INFO *cs,
  852. + bool *truncated)
  853. {
  854. if (truncated)
  855. {
  856. @@ -7020,7 +7003,7 @@
  857. @param nr number
  858. */
  859.  
  860. -int Field_str::store_truncated(double nr, bool *truncated)
  861. +int Field_str::store(double nr, bool *truncated)
  862. {
  863. ASSERT_COLUMN_MARKED_FOR_WRITE;
  864. char buff[DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE];
  865. @@ -7102,7 +7085,7 @@
  866. like inserting 500.0 in char(1)
  867. */
  868. DBUG_ASSERT(local_char_length < 5 || length <= local_char_length+1);
  869. - return store_truncated(buff, length, charset(), truncated);
  870. + return store(buff, length, charset(), truncated);
  871. }
  872.  
  873.  
  874. @@ -7123,18 +7106,18 @@
  875. }
  876.  
  877.  
  878. -int Field_string::store_truncated(longlong nr, bool unsigned_val, bool *truncated)
  879. +int Field_string::store(longlong nr, bool unsigned_val, bool *truncated)
  880. {
  881. char buff[64];
  882. int l;
  883. CHARSET_INFO *cs=charset();
  884. l= (cs->cset->longlong10_to_str)(cs,buff,sizeof(buff),
  885. unsigned_val ? 10 : -10, nr);
  886. - return Field_string::store_truncated(buff,(uint)l,cs, truncated);
  887. + return Field_string::store(buff,(uint)l,cs, truncated);
  888. }
  889.  
  890.  
  891. -int Field_longstr::store_decimal_truncated(const my_decimal *d, bool *truncated)
  892. +int Field_longstr::store_decimal(const my_decimal *d, bool *truncated)
  893. {
  894. if (truncated)
  895. {
  896. @@ -7143,12 +7126,13 @@
  897. char buff[DECIMAL_MAX_STR_LENGTH+1];
  898. String str(buff, sizeof(buff), &my_charset_bin);
  899. int op_result= my_decimal2string(E_DEC_FATAL_ERROR, d, 0, 0, 0, &str);
  900. - if (truncated && (E_DEC_OVERFLOW == op_result || E_DEC_TRUNCATED == op_result))
  901. + if (truncated && (E_DEC_OVERFLOW == op_result ||
  902. + E_DEC_TRUNCATED == op_result))
  903. {
  904. *truncated= true;
  905. }
  906. bool truncated2= false;
  907. - int result= store_truncated(str.ptr(), str.length(), str.charset(), &truncated2);
  908. + int result= store(str.ptr(), str.length(), str.charset(), &truncated2);
  909. if (truncated)
  910. {
  911. *truncated= (*truncated) || truncated2;
  912. @@ -7180,7 +7164,7 @@
  913. String tmp(buf, sizeof(buf), cs);
  914. tmp.copy((char*) ptr, field_length, cs);
  915. push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
  916. - ER_TRUNCATED_WRONG_VALUE,
  917. + ER_TRUNCATED_WRONG_VALUE,
  918. ER(ER_TRUNCATED_WRONG_VALUE),
  919. "DOUBLE", tmp.c_ptr());
  920. }
  921. @@ -7198,7 +7182,7 @@
  922.  
  923. result= my_strntoll(cs, (char*) ptr,field_length,10,&end,&error);
  924. if (!table->in_use->no_errors &&
  925. - (error || (field_length != (uint32)(end - (char*) ptr) &&
  926. + (error || (field_length != (uint32)(end - (char*) ptr) &&
  927. !check_if_only_end_space(cs, end,
  928. (char*) ptr + field_length))))
  929. {
  930. @@ -7206,7 +7190,7 @@
  931. String tmp(buf, sizeof(buf), cs);
  932. tmp.copy((char*) ptr, field_length, cs);
  933. push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
  934. - ER_TRUNCATED_WRONG_VALUE,
  935. + ER_TRUNCATED_WRONG_VALUE,
  936. ER(ER_TRUNCATED_WRONG_VALUE),
  937. "INTEGER", tmp.c_ptr());
  938. }
  939. @@ -7245,7 +7229,7 @@
  940. String tmp(buf, sizeof(buf), cs);
  941. tmp.copy((char*) ptr, field_length, cs);
  942. push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
  943. - ER_TRUNCATED_WRONG_VALUE,
  944. + ER_TRUNCATED_WRONG_VALUE,
  945. ER(ER_TRUNCATED_WRONG_VALUE),
  946. "DECIMAL", tmp.c_ptr());
  947. }
  948. @@ -7667,8 +7651,8 @@
  949. return 2;
  950. }
  951.  
  952. -int Field_varstring::store_truncated(const char *from, uint length,
  953. - CHARSET_INFO *cs, bool *truncated)
  954. +int Field_varstring::store(const char *from, uint length, CHARSET_INFO *cs,
  955. + bool *truncated)
  956. {
  957. if (truncated)
  958. {
  959. @@ -7706,7 +7690,7 @@
  960. }
  961.  
  962.  
  963. -int Field_varstring::store_truncated(longlong nr, bool unsigned_val, bool *truncated)
  964. +int Field_varstring::store(longlong nr, bool unsigned_val, bool *truncated)
  965. {
  966. char buff[64];
  967. uint length;
  968. @@ -7716,7 +7700,7 @@
  969. (unsigned_val ? 10:
  970. -10),
  971. nr);
  972. - return Field_varstring::store_truncated(buff, length, field_charset, truncated);
  973. + return Field_varstring::store(buff, length, field_charset, truncated);
  974. }
  975.  
  976.  
  977. @@ -8341,8 +8325,8 @@
  978. }
  979.  
  980.  
  981. -int Field_blob::store_truncated(const char *from, uint length, CHARSET_INFO *cs,
  982. - bool *truncated)
  983. +int Field_blob::store(const char *from, uint length, CHARSET_INFO *cs,
  984. + bool *truncated)
  985. {
  986. if (truncated)
  987. {
  988. @@ -8440,21 +8424,19 @@
  989. }
  990.  
  991.  
  992. -int Field_blob::store_truncated(double nr, bool *truncated)
  993. +int Field_blob::store(double nr, bool *truncated)
  994. {
  995. CHARSET_INFO *cs=charset();
  996. value.set_real(nr, 2, cs);
  997. - return Field_blob::store_truncated(value.ptr(), (uint) value.length(), cs,
  998. - truncated);
  999. + return Field_blob::store(value.ptr(), (uint) value.length(), cs, truncated);
  1000. }
  1001.  
  1002.  
  1003. -int Field_blob::store_truncated(longlong nr, bool unsigned_val, bool *truncated)
  1004. +int Field_blob::store(longlong nr, bool unsigned_val, bool *truncated)
  1005. {
  1006. CHARSET_INFO *cs=charset();
  1007. value.set_int(nr, unsigned_val, cs);
  1008. - return Field_blob::store_truncated(value.ptr(), (uint) value.length(), cs,
  1009. - truncated);
  1010. + return Field_blob::store(value.ptr(), (uint) value.length(), cs, truncated);
  1011. }
  1012.  
  1013.  
  1014. @@ -9000,7 +8982,7 @@
  1015. }
  1016.  
  1017.  
  1018. -int Field_geom::store_truncated(double nr, bool *truncated)
  1019. +int Field_geom::store(double nr, bool *truncated)
  1020. {
  1021. if (truncated)
  1022. {
  1023. @@ -9012,7 +8994,7 @@
  1024. }
  1025.  
  1026.  
  1027. -int Field_geom::store_truncated(longlong nr, bool unsigned_val, bool *truncated)
  1028. +int Field_geom::store(longlong nr, bool unsigned_val, bool *truncated)
  1029. {
  1030. if (truncated)
  1031. {
  1032. @@ -9024,7 +9006,7 @@
  1033. }
  1034.  
  1035.  
  1036. -int Field_geom::store_decimal_truncated(const my_decimal*, bool *truncated)
  1037. +int Field_geom::store_decimal(const my_decimal*, bool *truncated)
  1038. {
  1039. if (truncated)
  1040. {
  1041. @@ -9036,8 +9018,8 @@
  1042. }
  1043.  
  1044.  
  1045. -int Field_geom::store_truncated(const char *from, uint length,
  1046. - CHARSET_INFO *cs, bool *truncated)
  1047. +int Field_geom::store(const char *from, uint length, CHARSET_INFO *cs,
  1048. + bool *truncated)
  1049. {
  1050. if (truncated)
  1051. {
  1052. @@ -9137,8 +9119,8 @@
  1053. (if there isn't a empty value in the enum)
  1054. */
  1055.  
  1056. -int Field_enum::store_truncated(const char *from, uint length, CHARSET_INFO *cs,
  1057. - bool *truncated)
  1058. +int Field_enum::store(const char *from, uint length, CHARSET_INFO *cs,
  1059. + bool *truncated)
  1060. {
  1061. if (truncated)
  1062. {
  1063. @@ -9152,7 +9134,7 @@
  1064.  
  1065. /* Convert character set if necessary */
  1066. if (String::needs_conversion(length, cs, field_charset, &not_used))
  1067. - {
  1068. + {
  1069. uint dummy_errors;
  1070. tmpstr.copy(from, length, cs, field_charset, &dummy_errors);
  1071. from= tmpstr.ptr();
  1072. @@ -9195,13 +9177,13 @@
  1073. }
  1074.  
  1075.  
  1076. -int Field_enum::store_truncated(double nr, bool *truncated)
  1077. +int Field_enum::store(double nr, bool *truncated)
  1078. {
  1079. - return Field_enum::store_truncated((longlong) nr, FALSE, truncated);
  1080. + return Field_enum::store((longlong) nr, FALSE, truncated);
  1081. }
  1082.  
  1083.  
  1084. -int Field_enum::store_truncated(longlong nr, bool unsigned_val, bool *truncated)
  1085. +int Field_enum::store(longlong nr, bool unsigned_val, bool *truncated)
  1086. {
  1087. if (truncated)
  1088. {
  1089. @@ -9378,8 +9360,8 @@
  1090. */
  1091.  
  1092.  
  1093. -int Field_set::store_truncated(const char *from, uint length, CHARSET_INFO *cs,
  1094. - bool *truncated)
  1095. +int Field_set::store(const char *from, uint length, CHARSET_INFO *cs,
  1096. + bool *truncated)
  1097. {
  1098. if (truncated)
  1099. {
  1100. @@ -9412,7 +9394,7 @@
  1101. if (err || end != from+length ||
  1102. tmp > (ulonglong) (((longlong) 1 << typelib->count) - (longlong) 1))
  1103. {
  1104. - tmp=0;
  1105. + tmp=0;
  1106. if (truncated)
  1107. {
  1108. *truncated= true;
  1109. @@ -9420,7 +9402,7 @@
  1110. set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1);
  1111. }
  1112. }
  1113. - else
  1114. + else
  1115. {
  1116. if (got_warning)
  1117. set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1);
  1118. @@ -9430,7 +9412,7 @@
  1119. }
  1120.  
  1121.  
  1122. -int Field_set::store_truncated(longlong nr, bool unsigned_val, bool *truncated)
  1123. +int Field_set::store(longlong nr, bool unsigned_val, bool *truncated)
  1124. {
  1125. if (truncated)
  1126. {
  1127. @@ -9754,15 +9736,15 @@
  1128. }
  1129.  
  1130.  
  1131. -uint Field_bit::is_equal(Create_field *new_field)
  1132. +uint Field_bit::is_equal(Create_field *new_field)
  1133. {
  1134. return (new_field->sql_type == real_type() &&
  1135. new_field->length == max_display_length());
  1136. }
  1137.  
  1138. -
  1139. -int Field_bit::store_truncated(const char *from, uint length, CHARSET_INFO *cs,
  1140. - bool *truncated)
  1141. +
  1142. +int Field_bit::store(const char *from, uint length, CHARSET_INFO *cs,
  1143. + bool *truncated)
  1144. {
  1145. if (truncated)
  1146. {
  1147. @@ -9817,27 +9799,27 @@
  1148. }
  1149.  
  1150.  
  1151. -int Field_bit::store_truncated(double nr, bool *truncated)
  1152. +int Field_bit::store(double nr, bool *truncated)
  1153. {
  1154. - return Field_bit::store_truncated((longlong) nr, FALSE, truncated);
  1155. + return Field_bit::store((longlong) nr, FALSE, truncated);
  1156. }
  1157.  
  1158.  
  1159. -int Field_bit::store_truncated(longlong nr, bool unsigned_val, bool *truncated)
  1160. +int Field_bit::store(longlong nr, bool unsigned_val, bool *truncated)
  1161. {
  1162. char buf[8];
  1163.  
  1164. mi_int8store(buf, nr);
  1165. - return store_truncated(buf, 8, NULL, truncated);
  1166. + return store(buf, 8, NULL, truncated);
  1167. }
  1168.  
  1169.  
  1170. -int Field_bit::store_decimal_truncated(const my_decimal *val, bool *truncated)
  1171. +int Field_bit::store_decimal(const my_decimal *val, bool *truncated)
  1172. {
  1173. int err= 0;
  1174. - longlong i= convert_decimal2longlong_truncated(val, 1, &err, truncated);
  1175. + longlong i= convert_decimal2longlong(val, 1, &err, truncated);
  1176. bool truncated2= false;
  1177. - int result= test(err | store_truncated(i, TRUE, &truncated2));
  1178. + int result= test(err | store(i, TRUE, &truncated2));
  1179. if (truncated)
  1180. {
  1181. *truncated= (*truncated) || truncated2;
  1182. @@ -10232,8 +10214,8 @@
  1183. }
  1184.  
  1185.  
  1186. -int Field_bit_as_char::store_truncated(const char *from, uint length,
  1187. - CHARSET_INFO *cs, bool *truncated)
  1188. +int Field_bit_as_char::store(const char *from, uint length, CHARSET_INFO *cs,
  1189. + bool *truncated)
  1190. {
  1191. if (truncated)
  1192. {
  1193. diff -ruN 216/sql/field_conv.cc 217/sql/field_conv.cc
  1194. --- 216/sql/field_conv.cc 2012-02-15 16:28:18.668090945 +0900
  1195. +++ 217/sql/field_conv.cc 2012-02-15 16:28:26.899086467 +0900
  1196. @@ -298,10 +298,9 @@
  1197. static void do_conv_blob(Copy_field *copy)
  1198. {
  1199. copy->from_field->val_str(&copy->tmp);
  1200. - ((Field_blob *) copy->to_field)->store_truncated(copy->tmp.ptr(),
  1201. - copy->tmp.length(),
  1202. - copy->tmp.charset(),
  1203. - &(copy->truncated));
  1204. + ((Field_blob *) copy->to_field)->store(copy->tmp.ptr(), copy->tmp.length(),
  1205. + copy->tmp.charset(),
  1206. + &(copy->truncated));
  1207. }
  1208.  
  1209. /** Save blob in copy->tmp for GROUP BY. */
  1210. @@ -312,10 +311,9 @@
  1211. String res(buff,sizeof(buff),copy->tmp.charset());
  1212. copy->from_field->val_str(&res);
  1213. copy->tmp.copy(res);
  1214. - ((Field_blob *) copy->to_field)->store_truncated(copy->tmp.ptr(),
  1215. - copy->tmp.length(),
  1216. - copy->tmp.charset(),
  1217. - &(copy->truncated));
  1218. + ((Field_blob *) copy->to_field)->store(copy->tmp.ptr(), copy->tmp.length(),
  1219. + copy->tmp.charset(),
  1220. + &(copy->truncated));
  1221. }
  1222.  
  1223.  
  1224. @@ -324,10 +322,8 @@
  1225. char buff[MAX_FIELD_WIDTH];
  1226. copy->tmp.set_quick(buff,sizeof(buff),copy->tmp.charset());
  1227. copy->from_field->val_str(&copy->tmp);
  1228. - copy->to_field->store_truncated(copy->tmp.c_ptr_quick(),
  1229. - copy->tmp.length(),
  1230. - copy->tmp.charset(),
  1231. - &(copy->truncated));
  1232. + copy->to_field->store(copy->tmp.c_ptr_quick(), copy->tmp.length(),
  1233. + copy->tmp.charset(), &(copy->truncated));
  1234. }
  1235.  
  1236.  
  1237. @@ -353,33 +349,30 @@
  1238. uint length= my_lengthsp_8bit(&my_charset_bin, copy->tmp.c_ptr_quick(),
  1239. copy->from_field->field_length);
  1240.  
  1241. - copy->to_field->store_truncated(copy->tmp.c_ptr_quick(),
  1242. - length,
  1243. - copy->tmp.charset(),
  1244. - &(copy->truncated));
  1245. + copy->to_field->store(copy->tmp.c_ptr_quick(), length, copy->tmp.charset(),
  1246. + &(copy->truncated));
  1247. }
  1248.  
  1249.  
  1250. static void do_field_int(Copy_field *copy)
  1251. {
  1252. longlong value= copy->from_field->val_int();
  1253. - copy->to_field->store_truncated(value,
  1254. - test(copy->from_field->flags & UNSIGNED_FLAG),
  1255. + copy->to_field->store(value, test(copy->from_field->flags & UNSIGNED_FLAG),
  1256. &(copy->truncated));
  1257. }
  1258.  
  1259. static void do_field_real(Copy_field *copy)
  1260. {
  1261. double value=copy->from_field->val_real();
  1262. - copy->to_field->store_truncated(value,&(copy->truncated));
  1263. + copy->to_field->store(value,&(copy->truncated));
  1264. }
  1265.  
  1266.  
  1267. static void do_field_decimal(Copy_field *copy)
  1268. {
  1269. my_decimal value;
  1270. - copy->to_field->store_decimal_truncated(copy->from_field->val_decimal(&value),
  1271. - &(copy->truncated));
  1272. + copy->to_field->store_decimal(copy->from_field->val_decimal(&value),
  1273. + &(copy->truncated));
  1274. }
  1275.  
  1276.  
  1277. diff -ruN 216/sql/field.h 217/sql/field.h
  1278. --- 216/sql/field.h 2012-02-15 16:28:18.672091429 +0900
  1279. +++ 217/sql/field.h 2012-02-15 16:28:26.902086830 +0900
  1280. @@ -115,27 +115,11 @@
  1281. const char *field_name_arg);
  1282. virtual ~Field() {}
  1283. /* Store functions returns 1 on overflow and -1 on fatal error */
  1284. - virtual int store(const char *to, uint length, CHARSET_INFO *cs)
  1285. - {
  1286. - return store_truncated(to,length,cs,0);
  1287. - }
  1288. - virtual int store_truncated(const char *to, uint length, CHARSET_INFO *cs,
  1289. - bool *truncated)=0;
  1290. - virtual int store(double nr)
  1291. - {
  1292. - return store_truncated(nr, 0);
  1293. - }
  1294. - virtual int store_truncated(double nr, bool *truncated)=0;
  1295. - virtual int store(longlong nr, bool unsigned_val)
  1296. - {
  1297. - return store_truncated(nr, unsigned_val, 0);
  1298. - }
  1299. - virtual int store_truncated(longlong nr, bool unsigned_val, bool *truncated)=0;
  1300. - virtual int store_decimal(const my_decimal *d)
  1301. - {
  1302. - return store_decimal_truncated(d, 0);
  1303. - }
  1304. - virtual int store_decimal_truncated(const my_decimal *d, bool *truncated)=0;
  1305. + virtual int store(const char *to, uint length, CHARSET_INFO *cs,
  1306. + bool *truncated= 0)=0;
  1307. + virtual int store(double nr, bool *truncated= 0)=0;
  1308. + virtual int store(longlong nr, bool unsigned_val, bool *truncated= 0)=0;
  1309. + virtual int store_decimal(const my_decimal *d, bool *truncated= 0)=0;
  1310. virtual int store_time(MYSQL_TIME *ltime, timestamp_type t_type);
  1311. int store(const char *to, uint length, CHARSET_INFO *cs,
  1312. enum_check_fields check_level);
  1313. @@ -480,17 +464,12 @@
  1314. {
  1315. return (op_result == E_DEC_OVERFLOW);
  1316. }
  1317. - int warn_if_overflow(int op_result)
  1318. - {
  1319. - return warn_if_overflow_truncated(op_result, 0);
  1320. - }
  1321. - int warn_if_overflow_truncated(int op_result, bool *truncated);
  1322. - inline void if_overflow_truncated(int op_result, bool *truncated)
  1323. + int warn_if_overflow(int op_result, bool *truncated= 0);
  1324. + inline void if_overflow(int op_result, bool *truncated)
  1325. {
  1326. - if (truncated)
  1327. - {
  1328. - *truncated= (op_result == E_DEC_OVERFLOW) || (op_result == E_DEC_TRUNCATED);
  1329. - }
  1330. + if (!truncated)
  1331. + return;
  1332. + *truncated= (op_result == E_DEC_OVERFLOW) || (op_result == E_DEC_TRUNCATED);
  1333. }
  1334. void init(TABLE *table_arg)
  1335. {
  1336. @@ -511,13 +490,7 @@
  1337. virtual uint is_equal(Create_field *new_field);
  1338. /* convert decimal to longlong with overflow check */
  1339. longlong convert_decimal2longlong(const my_decimal *val, bool unsigned_flag,
  1340. - int *err)
  1341. - {
  1342. - return convert_decimal2longlong_truncated(val, unsigned_flag, err, 0);
  1343. - }
  1344. - longlong convert_decimal2longlong_truncated(const my_decimal *val,
  1345. - bool unsigned_flag, int *err,
  1346. - bool *truncated);
  1347. + int *err, bool *truncated= 0);
  1348. /* The max. number of characters */
  1349. inline uint32 char_length() const
  1350. {
  1351. @@ -670,11 +643,7 @@
  1352. uint decimals() const { return (uint) dec; }
  1353. uint size_of() const { return sizeof(*this); }
  1354. bool eq_def(Field *field);
  1355. - int store_decimal(const my_decimal *value)
  1356. - {
  1357. - return store_decimal_truncated(value, 0);
  1358. - }
  1359. - int store_decimal_truncated(const my_decimal*, bool *truncated);
  1360. + int store_decimal(const my_decimal*, bool *truncated= 0);
  1361. uint row_pack_length()
  1362. {
  1363. return pack_length();
  1364. @@ -689,22 +658,10 @@
  1365. my_decimal *val_decimal(my_decimal *);
  1366. uint is_equal(Create_field *new_field);
  1367. int check_int(CHARSET_INFO *cs, const char *str, int length,
  1368. - const char *int_end, int error)
  1369. - {
  1370. - return check_int_truncated(cs, str, length, int_end, error, 0);
  1371. - }
  1372. - int check_int_truncated(CHARSET_INFO *cs, const char *str, int length,
  1373. - const char *int_end, int error, bool *truncated);
  1374. + const char *int_end, int error, bool *truncated= 0);
  1375. bool get_int(CHARSET_INFO *cs, const char *from, uint len, longlong *rnd,
  1376. - ulonglong unsigned_max, longlong signed_min, longlong signed_max)
  1377. - {
  1378. - return get_int_truncated(cs, from,len, rnd, unsigned_max, signed_min,
  1379. - signed_max, 0);
  1380. - }
  1381. - bool get_int_truncated(CHARSET_INFO *cs, const char *from, uint len,
  1382. - longlong *rnd, ulonglong unsigned_max,
  1383. - longlong signed_min, longlong signed_max,
  1384. - bool *truncated);
  1385. + ulonglong unsigned_max, longlong signed_min, longlong signed_max,
  1386. + bool *truncated= 0);
  1387. };
  1388.  
  1389.  
  1390. @@ -718,27 +675,10 @@
  1391. const char *field_name_arg, CHARSET_INFO *charset);
  1392. Item_result result_type () const { return STRING_RESULT; }
  1393. uint decimals() const { return NOT_FIXED_DEC; }
  1394. - int store(double nr)
  1395. - {
  1396. - return store_truncated(nr, 0);
  1397. - }
  1398. - int store_truncated(double nr, bool *truncated);
  1399. - int store(longlong nr, bool unsigned_val)
  1400. - {
  1401. - return store_truncated(nr, unsigned_val, 0);
  1402. - }
  1403. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated)=0;
  1404. - int store_decimal(const my_decimal *value)
  1405. - {
  1406. - return store_decimal_truncated(value, 0);
  1407. - }
  1408. - int store_decimal_truncated(const my_decimal*, bool *truncated);
  1409. - int store(const char *to, uint length, CHARSET_INFO *cs)
  1410. - {
  1411. - return store_truncated(to, length, cs, 0);
  1412. - }
  1413. - int store_truncated(const char* to, uint length, CHARSET_INFO *cs,
  1414. - bool *truncated)=0;
  1415. + int store(double nr, bool *truncated= 0);
  1416. + int store(longlong nr, bool unsigned_val, bool *truncated= 0)=0;
  1417. + int store_decimal(const my_decimal *value, bool *truncated= 0);
  1418. + int store(const char *to, uint length, CHARSET_INFO *cs, bool *truncated= 0)=0;
  1419. uint size_of() const { return sizeof(*this); }
  1420. CHARSET_INFO *charset(void) const { return field_charset; }
  1421. void set_charset(CHARSET_INFO *charset_arg) { field_charset= charset_arg; }
  1422. @@ -769,11 +709,7 @@
  1423. field_name_arg, charset_arg)
  1424. {}
  1425.  
  1426. - int store_decimal(const my_decimal *d)
  1427. - {
  1428. - return store_decimal_truncated(d, 0);
  1429. - }
  1430. - int store_decimal_truncated(const my_decimal *d, bool *truncated);
  1431. + int store_decimal(const my_decimal *d, bool *truncated= 0);
  1432. uint32 max_data_length() const;
  1433. };
  1434.  
  1435. @@ -790,17 +726,9 @@
  1436. field_name_arg, dec_arg, zero_arg, unsigned_arg),
  1437. not_fixed(dec_arg >= NOT_FIXED_DEC)
  1438. {}
  1439. - int store_decimal(const my_decimal *value)
  1440. - {
  1441. - return store_decimal_truncated(value, 0);
  1442. - }
  1443. - int store_decimal_truncated(const my_decimal*, bool *truncated);
  1444. + int store_decimal(const my_decimal *value, bool *truncated= 0);
  1445. my_decimal *val_decimal(my_decimal *);
  1446. - int truncate(double *nr, double max_length)
  1447. - {
  1448. - return truncate_truncated(nr, max_length, 0);
  1449. - }
  1450. - int truncate_truncated(double *nr, double max_length, bool *truncated);
  1451. + int truncate(double *nr, double max_length, bool *truncated= 0);
  1452. uint32 max_display_length() { return field_length; }
  1453. uint size_of() const { return sizeof(*this); }
  1454. virtual const uchar *unpack(uchar* to, const uchar *from,
  1455. @@ -824,22 +752,10 @@
  1456. enum ha_base_keytype key_type() const
  1457. { return zerofill ? HA_KEYTYPE_BINARY : HA_KEYTYPE_NUM; }
  1458. int reset(void);
  1459. - int store(const char *to, uint length, CHARSET_INFO *charset)
  1460. - {
  1461. - return store_truncated(to, length, charset, 0);
  1462. - }
  1463. - int store_truncated(const char* to, uint length, CHARSET_INFO *charset,
  1464. - bool *truncated);
  1465. - int store(double nr)
  1466. - {
  1467. - return store_truncated(nr, 0);
  1468. - }
  1469. - int store_truncated(double nr, bool *truncated);
  1470. - int store(longlong nr, bool unsigned_val)
  1471. - {
  1472. - return store_truncated(nr, unsigned_val, 0);
  1473. - }
  1474. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated);
  1475. + int store(const char *to, uint length, CHARSET_INFO *charset,
  1476. + bool *truncated= 0);
  1477. + int store(double nr, bool *truncated= 0);
  1478. + int store(longlong nr, bool unsigned_val, bool *truncated= 0);
  1479. double val_real(void);
  1480. longlong val_int(void);
  1481. String *val_str(String*,String *);
  1482. @@ -886,34 +802,14 @@
  1483. enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; }
  1484. Item_result result_type () const { return DECIMAL_RESULT; }
  1485. int reset(void);
  1486. - bool store_value(const my_decimal *decimal_value)
  1487. - {
  1488. - return store_value_truncated(decimal_value, 0);
  1489. - }
  1490. - bool store_value_truncated(const my_decimal *decimal_value, bool *truncated);
  1491. + bool store_value(const my_decimal *decimal_value, bool *truncated= 0);
  1492. void set_value_on_overflow(my_decimal *decimal_value, bool sign);
  1493. - int store(const char *to, uint length, CHARSET_INFO *charset)
  1494. - {
  1495. - return store_truncated(to, length, charset, 0);
  1496. - }
  1497. - int store_truncated(const char *to, uint length, CHARSET_INFO *charset,
  1498. - bool *truncated);
  1499. - int store(double nr)
  1500. - {
  1501. - return store_truncated(nr, 0);
  1502. - }
  1503. - int store_truncated(double nr, bool *truncated);
  1504. - int store(longlong nr, bool unsigned_val)
  1505. - {
  1506. - return store_truncated(nr, unsigned_val, 0);
  1507. - }
  1508. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated);
  1509. + int store(const char *to, uint length, CHARSET_INFO *charset,
  1510. + bool *truncated= 0);
  1511. + int store(double nr, bool *truncated= 0);
  1512. + int store(longlong nr, bool unsigned_val, bool *truncated= 0);
  1513. int store_time(MYSQL_TIME *ltime, timestamp_type t_type);
  1514. - int store_decimal(const my_decimal *value)
  1515. - {
  1516. - return store_decimal_truncated(value, 0);
  1517. - }
  1518. - int store_decimal_truncated(const my_decimal*, bool *truncated);
  1519. + int store_decimal(const my_decimal *value, bool *truncated= 0);
  1520. double val_real(void);
  1521. longlong val_int(void);
  1522. my_decimal *val_decimal(my_decimal *);
  1523. @@ -950,22 +846,10 @@
  1524. enum_field_types type() const { return MYSQL_TYPE_TINY;}
  1525. enum ha_base_keytype key_type() const
  1526. { return unsigned_flag ? HA_KEYTYPE_BINARY : HA_KEYTYPE_INT8; }
  1527. - int store(const char *to, uint length, CHARSET_INFO *charset)
  1528. - {
  1529. - return store_truncated(to, length, charset, 0);
  1530. - }
  1531. - int store_truncated(const char *to, uint length, CHARSET_INFO *charset,
  1532. - bool *truncated);
  1533. - int store(double nr)
  1534. - {
  1535. - return store_truncated(nr, 0);
  1536. - }
  1537. - int store_truncated(double nr, bool *truncated);
  1538. - int store(longlong nr, bool unsigned_val)
  1539. - {
  1540. - return store_truncated(nr, unsigned_val, 0);
  1541. - }
  1542. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated);
  1543. + int store(const char *to, uint length, CHARSET_INFO *charset,
  1544. + bool *truncated= 0);
  1545. + int store(double nr, bool *truncated= 0);
  1546. + int store(longlong nr, bool unsigned_val, bool *truncated= 0);
  1547. int reset(void) { ptr[0]=0; return 0; }
  1548. double val_real(void);
  1549. longlong val_int(void);
  1550. @@ -1012,22 +896,10 @@
  1551. enum_field_types type() const { return MYSQL_TYPE_SHORT;}
  1552. enum ha_base_keytype key_type() const
  1553. { return unsigned_flag ? HA_KEYTYPE_USHORT_INT : HA_KEYTYPE_SHORT_INT;}
  1554. - int store(const char *to, uint length, CHARSET_INFO *charset)
  1555. - {
  1556. - return store_truncated(to, length, charset, 0);
  1557. - }
  1558. - int store_truncated(const char *to, uint length, CHARSET_INFO *charset,
  1559. - bool *truncated);
  1560. - int store(double nr)
  1561. - {
  1562. - return store_truncated(nr, 0);
  1563. - }
  1564. - int store_truncated(double nr, bool *truncated);
  1565. - int store(longlong nr, bool unsigned_val)
  1566. - {
  1567. - return store_truncated(nr, unsigned_val, 0);
  1568. - }
  1569. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated);
  1570. + int store(const char *to, uint length, CHARSET_INFO *charset,
  1571. + bool *truncated= 0);
  1572. + int store(double nr, bool *truncated= 0);
  1573. + int store(longlong nr, bool unsigned_val, bool *truncated= 0);
  1574. int reset(void) { ptr[0]=ptr[1]=0; return 0; }
  1575. double val_real(void);
  1576. longlong val_int(void);
  1577. @@ -1094,22 +966,10 @@
  1578. enum_field_types type() const { return MYSQL_TYPE_INT24;}
  1579. enum ha_base_keytype key_type() const
  1580. { return unsigned_flag ? HA_KEYTYPE_UINT24 : HA_KEYTYPE_INT24; }
  1581. - int store(const char *to, uint length, CHARSET_INFO *charset)
  1582. - {
  1583. - return store_truncated(to, length, charset, 0);
  1584. - }
  1585. - int store_truncated(const char* to, uint length, CHARSET_INFO *charset,
  1586. - bool *truncated);
  1587. - int store(double nr)
  1588. - {
  1589. - return store_truncated(nr, 0);
  1590. - }
  1591. - int store_truncated(double nr, bool *truncated);
  1592. - int store(longlong nr, bool unsigned_val)
  1593. - {
  1594. - return store_truncated(nr, unsigned_val, 0);
  1595. - }
  1596. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated);
  1597. + int store(const char *to, uint length, CHARSET_INFO *charset,
  1598. + bool *truncated= 0);
  1599. + int store(double nr, bool *truncated= 0);
  1600. + int store(longlong nr, bool unsigned_val, bool *truncated= 0);
  1601. int reset(void) { ptr[0]=ptr[1]=ptr[2]=0; return 0; }
  1602. double val_real(void);
  1603. longlong val_int(void);
  1604. @@ -1154,22 +1014,10 @@
  1605. enum_field_types type() const { return MYSQL_TYPE_LONG;}
  1606. enum ha_base_keytype key_type() const
  1607. { return unsigned_flag ? HA_KEYTYPE_ULONG_INT : HA_KEYTYPE_LONG_INT; }
  1608. - int store(const char *to, uint length, CHARSET_INFO *charset)
  1609. - {
  1610. - return store_truncated(to, length, charset, 0);
  1611. - }
  1612. - int store_truncated(const char *to, uint length, CHARSET_INFO *charset,
  1613. - bool *truncated);
  1614. - int store(double nr)
  1615. - {
  1616. - return store_truncated(nr, 0);
  1617. - }
  1618. - int store_truncated(double nr, bool *truncated);
  1619. - int store(longlong nr, bool unsigned_val)
  1620. - {
  1621. - return store_truncated(nr, unsigned_val, 0);
  1622. - }
  1623. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated);
  1624. + int store(const char *to, uint length, CHARSET_INFO *charset,
  1625. + bool *truncated= 0);
  1626. + int store(double nr, bool *truncated= 0);
  1627. + int store(longlong nr, bool unsigned_val, bool *truncated= 0);
  1628. int reset(void) { ptr[0]=ptr[1]=ptr[2]=ptr[3]=0; return 0; }
  1629. double val_real(void);
  1630. longlong val_int(void);
  1631. @@ -1216,22 +1064,10 @@
  1632. enum_field_types type() const { return MYSQL_TYPE_LONGLONG;}
  1633. enum ha_base_keytype key_type() const
  1634. { return unsigned_flag ? HA_KEYTYPE_ULONGLONG : HA_KEYTYPE_LONGLONG; }
  1635. - int store(const char* to, uint length, CHARSET_INFO *charset)
  1636. - {
  1637. - return store_truncated(to, length, charset, 0);
  1638. - }
  1639. - int store_truncated(const char *to, uint length, CHARSET_INFO *charset,
  1640. - bool *truncated);
  1641. - int store(double nr)
  1642. - {
  1643. - return store_truncated(nr, 0);
  1644. - }
  1645. - int store_truncated(double nr, bool *truncated);
  1646. - int store(longlong nr, bool unsigned_val)
  1647. - {
  1648. - return store_truncated(nr, unsigned_val, 0);
  1649. - }
  1650. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated);
  1651. + int store(const char* to, uint length, CHARSET_INFO *charset,
  1652. + bool *truncated= 0);
  1653. + int store(double nr, bool *truncated= 0);
  1654. + int store(longlong nr, bool unsigned_val, bool *truncated= 0);
  1655. int reset(void)
  1656. {
  1657. ptr[0]=ptr[1]=ptr[2]=ptr[3]=ptr[4]=ptr[5]=ptr[6]=ptr[7]=0;
  1658. @@ -1280,22 +1116,10 @@
  1659. {}
  1660. enum_field_types type() const { return MYSQL_TYPE_FLOAT;}
  1661. enum ha_base_keytype key_type() const { return HA_KEYTYPE_FLOAT; }
  1662. - int store(const char *to, uint length, CHARSET_INFO *charset)
  1663. - {
  1664. - return store_truncated(to, length, charset, 0);
  1665. - }
  1666. - int store_truncated(const char *to, uint length, CHARSET_INFO *charset,
  1667. - bool *truncated);
  1668. - int store(double nr)
  1669. - {
  1670. - return store_truncated(nr, 0);
  1671. - }
  1672. - int store_truncated(double nr, bool *truncated);
  1673. - int store(longlong nr, bool unsigned_val)
  1674. - {
  1675. - return store_truncated(nr, unsigned_val, 0);
  1676. - }
  1677. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated);
  1678. + int store(const char *to, uint length, CHARSET_INFO *charset,
  1679. + bool *truncated= 0);
  1680. + int store(double nr, bool *truncated= 0);
  1681. + int store(longlong nr, bool unsigned_val, bool *truncated= 0);
  1682. int reset(void) { bzero(ptr,sizeof(float)); return 0; }
  1683. double val_real(void);
  1684. longlong val_int(void);
  1685. @@ -1333,22 +1157,10 @@
  1686. {not_fixed= not_fixed_arg; }
  1687. enum_field_types type() const { return MYSQL_TYPE_DOUBLE;}
  1688. enum ha_base_keytype key_type() const { return HA_KEYTYPE_DOUBLE; }
  1689. - int store(const char *to, uint length, CHARSET_INFO *charset)
  1690. - {
  1691. - return store_truncated(to, length, charset, 0);
  1692. - }
  1693. - int store_truncated(const char *to, uint length, CHARSET_INFO *charset,
  1694. - bool *truncated);
  1695. - int store(double nr)
  1696. - {
  1697. - return store_truncated(nr, 0);
  1698. - }
  1699. - int store_truncated(double nr, bool *truncated);
  1700. - int store(longlong nr, bool unsigned_val)
  1701. - {
  1702. - return store_truncated(nr, unsigned_val, 0);
  1703. - }
  1704. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated);
  1705. + int store(const char *to, uint length, CHARSET_INFO *charset,
  1706. + bool *truncated= 0);
  1707. + int store(double nr, bool *truncated= 0);
  1708. + int store(longlong nr, bool unsigned_val, bool *truncated= 0);
  1709. int reset(void) { bzero(ptr,sizeof(double)); return 0; }
  1710. double val_real(void);
  1711. longlong val_int(void);
  1712. @@ -1376,12 +1188,8 @@
  1713. unireg_check_arg, field_name_arg, cs)
  1714. {}
  1715. enum_field_types type() const { return MYSQL_TYPE_NULL;}
  1716. - int store(const char *to, uint length, CHARSET_INFO *cs)
  1717. - {
  1718. - return store_truncated(to, length, cs, 0);
  1719. - }
  1720. - int store_truncated(const char *to, uint length, CHARSET_INFO *cs,
  1721. - bool *truncated)
  1722. + int store(const char *to, uint length, CHARSET_INFO *cs,
  1723. + bool *truncated= 0)
  1724. {
  1725. if (truncated)
  1726. {
  1727. @@ -1390,11 +1198,7 @@
  1728. null[0]= 1;
  1729. return 0;
  1730. }
  1731. - int store(double nr)
  1732. - {
  1733. - return store_truncated(nr, 0);
  1734. - }
  1735. - int store_truncated(double nr, bool *truncated)
  1736. + int store(double nr, bool *truncated= 0)
  1737. {
  1738. if (truncated)
  1739. {
  1740. @@ -1403,11 +1207,7 @@
  1741. null[0]=1;
  1742. return 0;
  1743. }
  1744. - int store(longlong nr, bool unsigned_val)
  1745. - {
  1746. - return store_truncated(nr, unsigned_val, 0);
  1747. - }
  1748. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated)
  1749. + int store(longlong nr, bool unsigned_val, bool *truncated= 0)
  1750. {
  1751. if (truncated)
  1752. {
  1753. @@ -1416,11 +1216,7 @@
  1754. null[0]= 1;
  1755. return 0;
  1756. }
  1757. - int store_decimal(const my_decimal *d)
  1758. - {
  1759. - return store_decimal_truncated(d, 0);
  1760. - }
  1761. - int store_decimal_truncated(const my_decimal *d, bool *truncated)
  1762. + int store_decimal(const my_decimal *d, bool *truncated= 0)
  1763. {
  1764. if (truncated)
  1765. {
  1766. @@ -1455,22 +1251,10 @@
  1767. enum_field_types type() const { return MYSQL_TYPE_TIMESTAMP;}
  1768. enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONG_INT; }
  1769. enum Item_result cmp_type () const { return INT_RESULT; }
  1770. - int store(const char *to, uint length, CHARSET_INFO *charset)
  1771. - {
  1772. - return store_truncated(to, length, charset, 0);
  1773. - }
  1774. - int store_truncated(const char *to, uint length, CHARSET_INFO *charset,
  1775. - bool *truncated);
  1776. - int store(double nr)
  1777. - {
  1778. - return store_truncated(nr, 0);
  1779. - }
  1780. - int store_truncated(double nr, bool *truncated);
  1781. - int store(longlong nr, bool unsigned_val)
  1782. - {
  1783. - return store_truncated(nr, unsigned_val, 0);
  1784. - }
  1785. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated);
  1786. + int store(const char *to, uint length, CHARSET_INFO *charset,
  1787. + bool *truncated= 0);
  1788. + int store(double nr, bool *truncated= 0);
  1789. + int store(longlong nr, bool unsigned_val, bool *truncated= 0);
  1790. int reset(void) { ptr[0]=ptr[1]=ptr[2]=ptr[3]=0; return 0; }
  1791. double val_real(void);
  1792. longlong val_int(void);
  1793. @@ -1541,22 +1325,10 @@
  1794. unireg_check_arg, field_name_arg, 1, 1)
  1795. {}
  1796. enum_field_types type() const { return MYSQL_TYPE_YEAR;}
  1797. - int store(const char *to, uint length, CHARSET_INFO *charset)
  1798. - {
  1799. - return store_truncated(to, length, charset, 0);
  1800. - }
  1801. - int store_truncated(const char *to, uint length, CHARSET_INFO *charset,
  1802. - bool *truncated);
  1803. - int store(double nr)
  1804. - {
  1805. - return store_truncated(nr, 0);
  1806. - }
  1807. - int store_truncated(double nr, bool *truncated);
  1808. - int store(longlong nr, bool unsigned_val)
  1809. - {
  1810. - return store_truncated(nr, unsigned_val, 0);
  1811. - }
  1812. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated);
  1813. + int store(const char *to, uint length, CHARSET_INFO *charset,
  1814. + bool *truncated= 0);
  1815. + int store(double nr, bool *truncated= 0);
  1816. + int store(longlong nr, bool unsigned_val, bool *truncated= 0);
  1817. double val_real(void);
  1818. longlong val_int(void);
  1819. String *val_str(String*,String *);
  1820. @@ -1581,22 +1353,10 @@
  1821. enum_field_types type() const { return MYSQL_TYPE_DATE;}
  1822. enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONG_INT; }
  1823. enum Item_result cmp_type () const { return INT_RESULT; }
  1824. - int store(const char *to, uint length, CHARSET_INFO *charset)
  1825. - {
  1826. - return store_truncated(to, length, charset, 0);
  1827. - }
  1828. - int store_truncated(const char *to, uint length, CHARSET_INFO *charset,
  1829. - bool *truncated);
  1830. - int store(double nr)
  1831. - {
  1832. - return store_truncated(nr, 0);
  1833. - }
  1834. - int store_truncated(double nr, bool *truncated);
  1835. - int store(longlong nr, bool unsigned_val)
  1836. - {
  1837. - return store_truncated(nr, unsigned_val, 0);
  1838. - }
  1839. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated);
  1840. + int store(const char *to, uint length, CHARSET_INFO *charset,
  1841. + bool *truncated= 0);
  1842. + int store(double nr, bool *truncated= 0);
  1843. + int store(longlong nr, bool unsigned_val, bool *truncated= 0);
  1844. int reset(void) { ptr[0]=ptr[1]=ptr[2]=ptr[3]=0; return 0; }
  1845. double val_real(void);
  1846. longlong val_int(void);
  1847. @@ -1639,22 +1399,10 @@
  1848. enum_field_types real_type() const { return MYSQL_TYPE_NEWDATE; }
  1849. enum ha_base_keytype key_type() const { return HA_KEYTYPE_UINT24; }
  1850. enum Item_result cmp_type () const { return INT_RESULT; }
  1851. - int store(const char *to, uint length, CHARSET_INFO *charset)
  1852. - {
  1853. - return store_truncated(to, length, charset, 0);
  1854. - }
  1855. - int store_truncated(const char *to, uint length, CHARSET_INFO *charset,
  1856. - bool *truncated);
  1857. - int store(double nr)
  1858. - {
  1859. - return store_truncated(nr, 0);
  1860. - }
  1861. - int store_truncated(double nr, bool *truncated);
  1862. - int store(longlong nr, bool unsigned_val)
  1863. - {
  1864. - return store_truncated(nr, unsigned_val, 0);
  1865. - }
  1866. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated);
  1867. + int store(const char *to, uint length, CHARSET_INFO *charset,
  1868. + bool *truncated= 0);
  1869. + int store(double nr, bool *truncated= 0);
  1870. + int store(longlong nr, bool unsigned_val, bool *truncated= 0);
  1871. int store_time(MYSQL_TIME *ltime, timestamp_type type);
  1872. int reset(void) { ptr[0]=ptr[1]=ptr[2]=0; return 0; }
  1873. double val_real(void);
  1874. @@ -1688,22 +1436,10 @@
  1875. enum ha_base_keytype key_type() const { return HA_KEYTYPE_INT24; }
  1876. enum Item_result cmp_type () const { return INT_RESULT; }
  1877. int store_time(MYSQL_TIME *ltime, timestamp_type type);
  1878. - int store(const char *to, uint length, CHARSET_INFO *charset)
  1879. - {
  1880. - return store_truncated(to, length, charset, 0);
  1881. - }
  1882. - int store_truncated(const char *to, uint length, CHARSET_INFO *charset,
  1883. - bool *truncated);
  1884. - int store(double nr)
  1885. - {
  1886. - return store_truncated(nr, 0);
  1887. - }
  1888. - int store_truncated(double nr, bool *truncated);
  1889. - int store(longlong nr, bool unsigned_val)
  1890. - {
  1891. - return store_truncated(nr, unsigned_val, 0);
  1892. - }
  1893. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated);
  1894. + int store(const char *to, uint length, CHARSET_INFO *charset,
  1895. + bool *truncated= 0);
  1896. + int store(double nr, bool *truncated= 0);
  1897. + int store(longlong nr, bool unsigned_val, bool *truncated= 0);
  1898. int reset(void) { ptr[0]=ptr[1]=ptr[2]=0; return 0; }
  1899. double val_real(void);
  1900. longlong val_int(void);
  1901. @@ -1738,22 +1474,10 @@
  1902. #endif
  1903. enum Item_result cmp_type () const { return INT_RESULT; }
  1904. uint decimals() const { return DATETIME_DEC; }
  1905. - int store(const char *to, uint length, CHARSET_INFO *charset)
  1906. - {
  1907. - return store_truncated(to, length, charset, 0);
  1908. - }
  1909. - int store_truncated(const char *to, uint length, CHARSET_INFO *charset,
  1910. - bool *truncated);
  1911. - int store(double nr)
  1912. - {
  1913. - return store_truncated(nr, 0);
  1914. - }
  1915. - int store_truncated(double nr, bool *truncated);
  1916. - int store(longlong nr, bool unsigned_val)
  1917. - {
  1918. - return store_truncated(nr, unsigned_val, 0);
  1919. - }
  1920. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated);
  1921. + int store(const char *to, uint length, CHARSET_INFO *charset,
  1922. + bool *truncated= 0);
  1923. + int store(double nr, bool *truncated= 0);
  1924. + int store(longlong nr, bool unsigned_val, bool *truncated= 0);
  1925. int store_time(MYSQL_TIME *ltime, timestamp_type type);
  1926. int reset(void)
  1927. {
  1928. @@ -1819,24 +1543,12 @@
  1929. (has_charset() ? ' ' : 0));
  1930. return 0;
  1931. }
  1932. - int store(const char *to, uint length, CHARSET_INFO *charset)
  1933. - {
  1934. - return store_truncated(to, length, charset, 0);
  1935. - }
  1936. - int store_truncated(const char *to, uint length, CHARSET_INFO *charset,
  1937. - bool *truncated);
  1938. - int store(longlong nr, bool unsigned_val)
  1939. - {
  1940. - return store_truncated(nr, unsigned_val, 0);
  1941. - }
  1942. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated);
  1943. - int store(double nr) /* QQ: To be deleted */
  1944. + int store(const char *to, uint length, CHARSET_INFO *charset,
  1945. + bool *truncated= 0);
  1946. + int store(longlong nr, bool unsigned_val, bool *truncated= 0);
  1947. + int store(double nr, bool *truncated= 0) /* QQ: To be deleted */
  1948. {
  1949. - return store_truncated(nr, 0);
  1950. - }
  1951. - int store_truncated(double nr, bool *truncated)/* QQ: To be deleted */
  1952. - {
  1953. - return Field_str::store_truncated(nr, truncated);
  1954. + return Field_str::store(nr, truncated);
  1955. }
  1956. double val_real(void);
  1957. longlong val_int(void);
  1958. @@ -1920,25 +1632,13 @@
  1959. return (uint32) field_length + (field_charset == &my_charset_bin ?
  1960. length_bytes : 0);
  1961. }
  1962. - int store(const char *to, uint length, CHARSET_INFO *charset)
  1963. - {
  1964. - return store_truncated(to, length, charset, 0);
  1965. - }
  1966. - int store_truncated(const char *to, uint length, CHARSET_INFO *charset,
  1967. - bool *truncated);
  1968. - int store(longlong nr, bool unsigned_val)
  1969. - {
  1970. - return store_truncated(nr, unsigned_val, 0);
  1971. - }
  1972. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated);
  1973. - int store(double nr) /* QQ: To be deleted */
  1974. + int store(const char *to, uint length, CHARSET_INFO *charset,
  1975. + bool *truncated= 0);
  1976. + int store(longlong nr, bool unsigned_val, bool *truncated= 0);
  1977. + int store(double nr, bool *truncated= 0) /* QQ: To be deleted */
  1978. {
  1979. - return store_truncated(nr, 0);
  1980. + return Field_str::store(nr, truncated);
  1981. }
  1982. - int store_truncated(double nr, bool *truncated)/* QQ: To be deleted */
  1983. - {
  1984. - return Field_str::store_truncated(nr, truncated);
  1985. - }
  1986. double val_real(void);
  1987. longlong val_int(void);
  1988. String *val_str(String*,String *);
  1989. @@ -2030,22 +1730,10 @@
  1990. enum_field_types type() const { return MYSQL_TYPE_BLOB;}
  1991. enum ha_base_keytype key_type() const
  1992. { return binary() ? HA_KEYTYPE_VARBINARY2 : HA_KEYTYPE_VARTEXT2; }
  1993. - int store(const char *to, uint length, CHARSET_INFO *charset)
  1994. - {
  1995. - return store_truncated(to, length, charset, 0);
  1996. - }
  1997. - int store_truncated(const char *to, uint length, CHARSET_INFO *charset,
  1998. - bool *truncated);
  1999. - int store(double nr)
  2000. - {
  2001. - return store_truncated(nr, 0);
  2002. - }
  2003. - int store_truncated(double nr, bool *truncated);
  2004. - int store(longlong nr, bool unsigned_val)
  2005. - {
  2006. - return store_truncated(nr, unsigned_val, 0);
  2007. - }
  2008. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated);
  2009. + int store(const char *to, uint length, CHARSET_INFO *charset,
  2010. + bool *truncated= 0);
  2011. + int store(double nr, bool *truncated= 0);
  2012. + int store(longlong nr, bool unsigned_val, bool *truncated= 0);
  2013. double val_real(void);
  2014. longlong val_int(void);
  2015. String *val_str(String*,String *);
  2016. @@ -2199,27 +1887,11 @@
  2017. enum ha_base_keytype key_type() const { return HA_KEYTYPE_VARBINARY2; }
  2018. enum_field_types type() const { return MYSQL_TYPE_GEOMETRY; }
  2019. void sql_type(String &str) const;
  2020. - int store(const char *to, uint length, CHARSET_INFO *charset)
  2021. - {
  2022. - return store_truncated(to, length, charset, 0);
  2023. - }
  2024. - int store_truncated(const char *to, uint length, CHARSET_INFO *charset,
  2025. - bool* truncated);
  2026. - int store(double nr)
  2027. - {
  2028. - return store_truncated(nr, 0);
  2029. - }
  2030. - int store_truncated(double nr, bool *truncated);
  2031. - int store(longlong nr, bool unsigned_val)
  2032. - {
  2033. - return store_truncated(nr, unsigned_val, 0);
  2034. - }
  2035. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated);
  2036. - int store_decimal(const my_decimal *value)
  2037. - {
  2038. - return store_decimal_truncated(value, 0);
  2039. - }
  2040. - int store_decimal_truncated(const my_decimal*, bool *truncated);
  2041. + int store(const char *to, uint length, CHARSET_INFO *charset,
  2042. + bool *truncated= 0);
  2043. + int store(double nr, bool *truncated= 0);
  2044. + int store(longlong nr, bool unsigned_val, bool *truncated= 0);
  2045. + int store_decimal(const my_decimal *value, bool *truncated= 0);
  2046. uint size_of() const { return sizeof(*this); }
  2047. int reset(void) { return !maybe_null() || Field_blob::reset(); }
  2048. geometry_type get_geometry_type() { return geom_type; };
  2049. @@ -2249,22 +1921,10 @@
  2050. enum Item_result cmp_type () const { return INT_RESULT; }
  2051. enum Item_result cast_to_int_type () const { return INT_RESULT; }
  2052. enum ha_base_keytype key_type() const;
  2053. - int store(const char *to, uint length,CHARSET_INFO *charset)
  2054. - {
  2055. - return store_truncated(to, length, charset, 0);
  2056. - }
  2057. - int store_truncated(const char *to, uint length, CHARSET_INFO *charset,
  2058. - bool *truncated);
  2059. - int store(double nr)
  2060. - {
  2061. - return store_truncated(nr, 0);
  2062. - }
  2063. - int store_truncated(double nr, bool *truncated);
  2064. - int store(longlong nr, bool unsigned_val)
  2065. - {
  2066. - return store_truncated(nr, unsigned_val, 0);
  2067. - }
  2068. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated);
  2069. + int store(const char *to, uint length,CHARSET_INFO *charset,
  2070. + bool *truncated= 0);
  2071. + int store(double nr, bool *truncated= 0);
  2072. + int store(longlong nr, bool unsigned_val, bool *truncated= 0);
  2073. double val_real(void);
  2074. longlong val_int(void);
  2075. String *val_str(String*,String *);
  2076. @@ -2304,25 +1964,13 @@
  2077. {
  2078. flags=(flags & ~ENUM_FLAG) | SET_FLAG;
  2079. }
  2080. - int store(const char *to, uint length, CHARSET_INFO *charset)
  2081. - {
  2082. - return store_truncated(to, length, charset, 0);
  2083. - }
  2084. - int store_truncated(const char *to, uint length, CHARSET_INFO *charset,
  2085. - bool *truncated);
  2086. - int store(double nr)
  2087. - {
  2088. - return store_truncated(nr, 0);
  2089. - }
  2090. - int store_truncated(double nr, bool *truncated)
  2091. - {
  2092. - return Field_set::store_truncated((longlong) nr, FALSE, truncated);
  2093. - }
  2094. - int store(longlong nr, bool unsigned_val)
  2095. + int store(const char *to, uint length, CHARSET_INFO *charset,
  2096. + bool *truncated= 0);
  2097. + int store(double nr, bool *truncated= 0)
  2098. {
  2099. - return store_truncated(nr, unsigned_val, 0);
  2100. + return Field_set::store((longlong) nr, FALSE, truncated);
  2101. }
  2102. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated);
  2103. + int store(longlong nr, bool unsigned_val, bool *truncated= 0);
  2104.  
  2105. virtual bool zero_pack() const { return 1; }
  2106. String *val_str(String*,String *);
  2107. @@ -2368,27 +2016,11 @@
  2108. clr_rec_bits(bit_ptr, bit_ofs, bit_len);
  2109. return 0;
  2110. }
  2111. - int store(const char *to, uint length, CHARSET_INFO *charset)
  2112. - {
  2113. - return store_truncated(to, length, charset, 0);
  2114. - }
  2115. - int store_truncated(const char *to, uint length, CHARSET_INFO *charset,
  2116. - bool *truncated);
  2117. - int store(double nr)
  2118. - {
  2119. - return store_truncated(nr, 0);
  2120. - }
  2121. - int store_truncated(double nr, bool *truncated);
  2122. - int store(longlong nr, bool unsigned_val)
  2123. - {
  2124. - return store_truncated(nr, unsigned_val, 0);
  2125. - }
  2126. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated);
  2127. - int store_decimal(const my_decimal *value)
  2128. - {
  2129. - return store_decimal_truncated(value, 0);
  2130. - }
  2131. - int store_decimal_truncated(const my_decimal*, bool *truncated);
  2132. + int store(const char *to, uint length, CHARSET_INFO *charset,
  2133. + bool *truncated= 0);
  2134. + int store(double nr, bool *truncated= 0);
  2135. + int store(longlong nr, bool unsigned_val, bool *truncated= 0);
  2136. + int store_decimal(const my_decimal *value, bool *truncated= 0);
  2137. double val_real(void);
  2138. longlong val_int(void);
  2139. String *val_str(String*, String *);
  2140. @@ -2471,27 +2103,15 @@
  2141. enum utype unireg_check_arg, const char *field_name_arg);
  2142. enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; }
  2143. uint size_of() const { return sizeof(*this); }
  2144. - int store(const char *to, uint length, CHARSET_INFO *charset)
  2145. - {
  2146. - return store_truncated(to, length, charset, 0);
  2147. - }
  2148. - int store_truncated(const char *to, uint length, CHARSET_INFO *charset,
  2149. - bool *truncated);
  2150. - int store(double nr)
  2151. - {
  2152. - return store_truncated(nr, 0);
  2153. - }
  2154. - int store_truncated(double nr, bool *truncated)
  2155. - {
  2156. - return Field_bit::store_truncated(nr, truncated);
  2157. - }
  2158. - int store(longlong nr, bool unsigned_val)
  2159. + int store(const char *to, uint length, CHARSET_INFO *charset,
  2160. + bool *truncated= 0);
  2161. + int store(double nr, bool *truncated= 0)
  2162. {
  2163. - return store_truncated(nr, unsigned_val, 0);
  2164. + return Field_bit::store(nr, truncated);
  2165. }
  2166. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated)
  2167. + int store(longlong nr, bool unsigned_val, bool *truncated= 0)
  2168. {
  2169. - return Field_bit::store_truncated(nr, unsigned_val, truncated);
  2170. + return Field_bit::store(nr, unsigned_val, truncated);
  2171. }
  2172. void sql_type(String &str) const;
  2173. };
Advertisement
Add Comment
Please, Sign In to add comment