zamotivator

Untitled

Feb 14th, 2012
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 72.39 KB | None | 0 0
  1. diff -ruN 216/sql/field.cc 217/sql/field.cc
  2. --- 216/sql/field.cc 2012-02-15 13:16:39.587929365 +0900
  3. +++ 217/sql/field.cc 2012-02-15 13:16:45.909693715 +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(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.h 217/sql/field.h
  1194. --- 216/sql/field.h 2012-02-15 13:16:38.873843026 +0900
  1195. +++ 217/sql/field.h 2012-02-15 13:16:45.413633739 +0900
  1196. @@ -115,27 +115,11 @@
  1197. const char *field_name_arg);
  1198. virtual ~Field() {}
  1199. /* Store functions returns 1 on overflow and -1 on fatal error */
  1200. - virtual int store(const char *to, uint length, CHARSET_INFO *cs)
  1201. - {
  1202. - return store_truncated(to,length,cs,0);
  1203. - }
  1204. - virtual int store_truncated(const char *to, uint length, CHARSET_INFO *cs,
  1205. - bool *truncated)=0;
  1206. - virtual int store(double nr)
  1207. - {
  1208. - return store_truncated(nr, 0);
  1209. - }
  1210. - virtual int store_truncated(double nr, bool *truncated)=0;
  1211. - virtual int store(longlong nr, bool unsigned_val)
  1212. - {
  1213. - return store_truncated(nr, unsigned_val, 0);
  1214. - }
  1215. - virtual int store_truncated(longlong nr, bool unsigned_val, bool *truncated)=0;
  1216. - virtual int store_decimal(const my_decimal *d)
  1217. - {
  1218. - return store_decimal_truncated(d, 0);
  1219. - }
  1220. - virtual int store_decimal_truncated(const my_decimal *d, bool *truncated)=0;
  1221. + virtual int store(const char *to, uint length, CHARSET_INFO *cs,
  1222. + bool *truncated= 0)=0;
  1223. + virtual int store(double nr, bool *truncated= 0)=0;
  1224. + virtual int store(longlong nr, bool unsigned_val, bool *truncated= 0)=0;
  1225. + virtual int store_decimal(const my_decimal *d, bool *truncated= 0)=0;
  1226. virtual int store_time(MYSQL_TIME *ltime, timestamp_type t_type);
  1227. int store(const char *to, uint length, CHARSET_INFO *cs,
  1228. enum_check_fields check_level);
  1229. @@ -480,17 +464,12 @@
  1230. {
  1231. return (op_result == E_DEC_OVERFLOW);
  1232. }
  1233. - int warn_if_overflow(int op_result)
  1234. - {
  1235. - return warn_if_overflow_truncated(op_result, 0);
  1236. - }
  1237. - int warn_if_overflow_truncated(int op_result, bool *truncated);
  1238. - inline void if_overflow_truncated(int op_result, bool *truncated)
  1239. + int warn_if_overflow(int op_result, bool *truncated= 0);
  1240. + inline void if_overflow(int op_result, bool *truncated)
  1241. {
  1242. - if (truncated)
  1243. - {
  1244. - *truncated= (op_result == E_DEC_OVERFLOW) || (op_result == E_DEC_TRUNCATED);
  1245. - }
  1246. + if (!truncated)
  1247. + return;
  1248. + *truncated= (op_result == E_DEC_OVERFLOW) || (op_result == E_DEC_TRUNCATED);
  1249. }
  1250. void init(TABLE *table_arg)
  1251. {
  1252. @@ -511,13 +490,7 @@
  1253. virtual uint is_equal(Create_field *new_field);
  1254. /* convert decimal to longlong with overflow check */
  1255. longlong convert_decimal2longlong(const my_decimal *val, bool unsigned_flag,
  1256. - int *err)
  1257. - {
  1258. - return convert_decimal2longlong_truncated(val, unsigned_flag, err, 0);
  1259. - }
  1260. - longlong convert_decimal2longlong_truncated(const my_decimal *val,
  1261. - bool unsigned_flag, int *err,
  1262. - bool *truncated);
  1263. + int *err, bool *truncated= 0);
  1264. /* The max. number of characters */
  1265. inline uint32 char_length() const
  1266. {
  1267. @@ -670,11 +643,7 @@
  1268. uint decimals() const { return (uint) dec; }
  1269. uint size_of() const { return sizeof(*this); }
  1270. bool eq_def(Field *field);
  1271. - int store_decimal(const my_decimal *value)
  1272. - {
  1273. - return store_decimal_truncated(value, 0);
  1274. - }
  1275. - int store_decimal_truncated(const my_decimal*, bool *truncated);
  1276. + int store_decimal(const my_decimal*, bool *truncated= 0);
  1277. uint row_pack_length()
  1278. {
  1279. return pack_length();
  1280. @@ -689,22 +658,10 @@
  1281. my_decimal *val_decimal(my_decimal *);
  1282. uint is_equal(Create_field *new_field);
  1283. int check_int(CHARSET_INFO *cs, const char *str, int length,
  1284. - const char *int_end, int error)
  1285. - {
  1286. - return check_int_truncated(cs, str, length, int_end, error, 0);
  1287. - }
  1288. - int check_int_truncated(CHARSET_INFO *cs, const char *str, int length,
  1289. - const char *int_end, int error, bool *truncated);
  1290. + const char *int_end, int error, bool *truncated= 0);
  1291. bool get_int(CHARSET_INFO *cs, const char *from, uint len, longlong *rnd,
  1292. - ulonglong unsigned_max, longlong signed_min, longlong signed_max)
  1293. - {
  1294. - return get_int_truncated(cs, from,len, rnd, unsigned_max, signed_min,
  1295. - signed_max, 0);
  1296. - }
  1297. - bool get_int_truncated(CHARSET_INFO *cs, const char *from, uint len,
  1298. - longlong *rnd, ulonglong unsigned_max,
  1299. - longlong signed_min, longlong signed_max,
  1300. - bool *truncated);
  1301. + ulonglong unsigned_max, longlong signed_min, longlong signed_max,
  1302. + bool *truncated= 0);
  1303. };
  1304.  
  1305.  
  1306. @@ -718,27 +675,10 @@
  1307. const char *field_name_arg, CHARSET_INFO *charset);
  1308. Item_result result_type () const { return STRING_RESULT; }
  1309. uint decimals() const { return NOT_FIXED_DEC; }
  1310. - int store(double nr)
  1311. - {
  1312. - return store_truncated(nr, 0);
  1313. - }
  1314. - int store_truncated(double nr, bool *truncated);
  1315. - int store(longlong nr, bool unsigned_val)
  1316. - {
  1317. - return store_truncated(nr, unsigned_val, 0);
  1318. - }
  1319. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated)=0;
  1320. - int store_decimal(const my_decimal *value)
  1321. - {
  1322. - return store_decimal_truncated(value, 0);
  1323. - }
  1324. - int store_decimal_truncated(const my_decimal*, bool *truncated);
  1325. - int store(const char *to, uint length, CHARSET_INFO *cs)
  1326. - {
  1327. - return store_truncated(to, length, cs, 0);
  1328. - }
  1329. - int store_truncated(const char* to, uint length, CHARSET_INFO *cs,
  1330. - bool *truncated)=0;
  1331. + int store(double nr, bool *truncated= 0);
  1332. + int store(longlong nr, bool unsigned_val, bool *truncated= 0);
  1333. + int store(const my_decimal *value, bool *truncated= 0);
  1334. + int store(const char *to, uint length, CHARSET_INFO *cs, bool *truncated= 0);
  1335. uint size_of() const { return sizeof(*this); }
  1336. CHARSET_INFO *charset(void) const { return field_charset; }
  1337. void set_charset(CHARSET_INFO *charset_arg) { field_charset= charset_arg; }
  1338. @@ -769,11 +709,7 @@
  1339. field_name_arg, charset_arg)
  1340. {}
  1341.  
  1342. - int store_decimal(const my_decimal *d)
  1343. - {
  1344. - return store_decimal_truncated(d, 0);
  1345. - }
  1346. - int store_decimal_truncated(const my_decimal *d, bool *truncated);
  1347. + int store_decimal(const my_decimal *d, bool *truncated= 0);
  1348. uint32 max_data_length() const;
  1349. };
  1350.  
  1351. @@ -790,17 +726,9 @@
  1352. field_name_arg, dec_arg, zero_arg, unsigned_arg),
  1353. not_fixed(dec_arg >= NOT_FIXED_DEC)
  1354. {}
  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 *value, bool *truncated= 0);
  1361. my_decimal *val_decimal(my_decimal *);
  1362. - int truncate(double *nr, double max_length)
  1363. - {
  1364. - return truncate_truncated(nr, max_length, 0);
  1365. - }
  1366. - int truncate_truncated(double *nr, double max_length, bool *truncated);
  1367. + int truncate(double *nr, double max_length, bool *truncated= 0);
  1368. uint32 max_display_length() { return field_length; }
  1369. uint size_of() const { return sizeof(*this); }
  1370. virtual const uchar *unpack(uchar* to, const uchar *from,
  1371. @@ -824,22 +752,10 @@
  1372. enum ha_base_keytype key_type() const
  1373. { return zerofill ? HA_KEYTYPE_BINARY : HA_KEYTYPE_NUM; }
  1374. int reset(void);
  1375. - int store(const char *to, uint length, CHARSET_INFO *charset)
  1376. - {
  1377. - return store_truncated(to, length, charset, 0);
  1378. - }
  1379. - int store_truncated(const char* to, uint length, CHARSET_INFO *charset,
  1380. - bool *truncated);
  1381. - int store(double nr)
  1382. - {
  1383. - return store_truncated(nr, 0);
  1384. - }
  1385. - int store_truncated(double nr, bool *truncated);
  1386. - int store(longlong nr, bool unsigned_val)
  1387. - {
  1388. - return store_truncated(nr, unsigned_val, 0);
  1389. - }
  1390. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated);
  1391. + int store(const char *to, uint length, CHARSET_INFO *charset,
  1392. + bool *truncated= 0);
  1393. + int store(double nr, bool *truncated= 0);
  1394. + int store(longlong nr, bool unsigned_val, bool *truncated= 0);
  1395. double val_real(void);
  1396. longlong val_int(void);
  1397. String *val_str(String*,String *);
  1398. @@ -886,34 +802,14 @@
  1399. enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; }
  1400. Item_result result_type () const { return DECIMAL_RESULT; }
  1401. int reset(void);
  1402. - bool store_value(const my_decimal *decimal_value)
  1403. - {
  1404. - return store_value_truncated(decimal_value, 0);
  1405. - }
  1406. - bool store_value_truncated(const my_decimal *decimal_value, bool *truncated);
  1407. + bool store_value(const my_decimal *decimal_value, bool *truncated= 0);
  1408. void set_value_on_overflow(my_decimal *decimal_value, bool sign);
  1409. - int store(const char *to, uint length, CHARSET_INFO *charset)
  1410. - {
  1411. - return store_truncated(to, length, charset, 0);
  1412. - }
  1413. - int store_truncated(const char *to, uint length, CHARSET_INFO *charset,
  1414. - bool *truncated);
  1415. - int store(double nr)
  1416. - {
  1417. - return store_truncated(nr, 0);
  1418. - }
  1419. - int store_truncated(double nr, bool *truncated);
  1420. - int store(longlong nr, bool unsigned_val)
  1421. - {
  1422. - return store_truncated(nr, unsigned_val, 0);
  1423. - }
  1424. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated);
  1425. + int store(const char *to, uint length, CHARSET_INFO *charset,
  1426. + bool *truncated= 0);
  1427. + int store(double nr, bool *truncated= 0);
  1428. + int store(longlong nr, bool unsigned_val, bool *truncated= 0);
  1429. int store_time(MYSQL_TIME *ltime, timestamp_type t_type);
  1430. - int store_decimal(const my_decimal *value)
  1431. - {
  1432. - return store_decimal_truncated(value, 0);
  1433. - }
  1434. - int store_decimal_truncated(const my_decimal*, bool *truncated);
  1435. + int store_decimal(const my_decimal *value, bool *truncated= 0);
  1436. double val_real(void);
  1437. longlong val_int(void);
  1438. my_decimal *val_decimal(my_decimal *);
  1439. @@ -950,22 +846,10 @@
  1440. enum_field_types type() const { return MYSQL_TYPE_TINY;}
  1441. enum ha_base_keytype key_type() const
  1442. { return unsigned_flag ? HA_KEYTYPE_BINARY : HA_KEYTYPE_INT8; }
  1443. - int store(const char *to, uint length, CHARSET_INFO *charset)
  1444. - {
  1445. - return store_truncated(to, length, charset, 0);
  1446. - }
  1447. - int store_truncated(const char *to, uint length, CHARSET_INFO *charset,
  1448. - bool *truncated);
  1449. - int store(double nr)
  1450. - {
  1451. - return store_truncated(nr, 0);
  1452. - }
  1453. - int store_truncated(double nr, bool *truncated);
  1454. - int store(longlong nr, bool unsigned_val)
  1455. - {
  1456. - return store_truncated(nr, unsigned_val, 0);
  1457. - }
  1458. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated);
  1459. + int store(const char *to, uint length, CHARSET_INFO *charset,
  1460. + bool *truncated= 0);
  1461. + int store(double nr, bool *truncated= 0);
  1462. + int store(longlong nr, bool unsigned_val, bool *truncated= 0);
  1463. int reset(void) { ptr[0]=0; return 0; }
  1464. double val_real(void);
  1465. longlong val_int(void);
  1466. @@ -1012,22 +896,10 @@
  1467. enum_field_types type() const { return MYSQL_TYPE_SHORT;}
  1468. enum ha_base_keytype key_type() const
  1469. { return unsigned_flag ? HA_KEYTYPE_USHORT_INT : HA_KEYTYPE_SHORT_INT;}
  1470. - int store(const char *to, uint length, CHARSET_INFO *charset)
  1471. - {
  1472. - return store_truncated(to, length, charset, 0);
  1473. - }
  1474. - int store_truncated(const char *to, uint length, CHARSET_INFO *charset,
  1475. - bool *truncated);
  1476. - int store(double nr)
  1477. - {
  1478. - return store_truncated(nr, 0);
  1479. - }
  1480. - int store_truncated(double nr, bool *truncated);
  1481. - int store(longlong nr, bool unsigned_val)
  1482. - {
  1483. - return store_truncated(nr, unsigned_val, 0);
  1484. - }
  1485. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated);
  1486. + int store(const char *to, uint length, CHARSET_INFO *charset,
  1487. + bool *truncated= 0);
  1488. + int store(double nr, bool *truncated= 0);
  1489. + int store(longlong nr, bool unsigned_val, bool *truncated= 0);
  1490. int reset(void) { ptr[0]=ptr[1]=0; return 0; }
  1491. double val_real(void);
  1492. longlong val_int(void);
  1493. @@ -1094,22 +966,10 @@
  1494. enum_field_types type() const { return MYSQL_TYPE_INT24;}
  1495. enum ha_base_keytype key_type() const
  1496. { return unsigned_flag ? HA_KEYTYPE_UINT24 : HA_KEYTYPE_INT24; }
  1497. - int store(const char *to, uint length, CHARSET_INFO *charset)
  1498. - {
  1499. - return store_truncated(to, length, charset, 0);
  1500. - }
  1501. - int store_truncated(const char* to, uint length, CHARSET_INFO *charset,
  1502. - bool *truncated);
  1503. - int store(double nr)
  1504. - {
  1505. - return store_truncated(nr, 0);
  1506. - }
  1507. - int store_truncated(double nr, bool *truncated);
  1508. - int store(longlong nr, bool unsigned_val)
  1509. - {
  1510. - return store_truncated(nr, unsigned_val, 0);
  1511. - }
  1512. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated);
  1513. + int store(const char *to, uint length, CHARSET_INFO *charset,
  1514. + bool *truncated= 0);
  1515. + int store(double nr, bool *truncated= 0);
  1516. + int store(longlong nr, bool unsigned_val, bool *truncated= 0);
  1517. int reset(void) { ptr[0]=ptr[1]=ptr[2]=0; return 0; }
  1518. double val_real(void);
  1519. longlong val_int(void);
  1520. @@ -1154,22 +1014,10 @@
  1521. enum_field_types type() const { return MYSQL_TYPE_LONG;}
  1522. enum ha_base_keytype key_type() const
  1523. { return unsigned_flag ? HA_KEYTYPE_ULONG_INT : HA_KEYTYPE_LONG_INT; }
  1524. - int store(const char *to, uint length, CHARSET_INFO *charset)
  1525. - {
  1526. - return store_truncated(to, length, charset, 0);
  1527. - }
  1528. - int store_truncated(const char *to, uint length, CHARSET_INFO *charset,
  1529. - bool *truncated);
  1530. - int store(double nr)
  1531. - {
  1532. - return store_truncated(nr, 0);
  1533. - }
  1534. - int store_truncated(double nr, bool *truncated);
  1535. - int store(longlong nr, bool unsigned_val)
  1536. - {
  1537. - return store_truncated(nr, unsigned_val, 0);
  1538. - }
  1539. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated);
  1540. + int store(const char *to, uint length, CHARSET_INFO *charset,
  1541. + bool *truncated= 0);
  1542. + int store(double nr, bool *truncated= 0);
  1543. + int store(longlong nr, bool unsigned_val, bool *truncated= 0);
  1544. int reset(void) { ptr[0]=ptr[1]=ptr[2]=ptr[3]=0; return 0; }
  1545. double val_real(void);
  1546. longlong val_int(void);
  1547. @@ -1216,22 +1064,10 @@
  1548. enum_field_types type() const { return MYSQL_TYPE_LONGLONG;}
  1549. enum ha_base_keytype key_type() const
  1550. { return unsigned_flag ? HA_KEYTYPE_ULONGLONG : HA_KEYTYPE_LONGLONG; }
  1551. - int store(const char* to, uint length, CHARSET_INFO *charset)
  1552. - {
  1553. - return store_truncated(to, length, charset, 0);
  1554. - }
  1555. - int store_truncated(const char *to, uint length, CHARSET_INFO *charset,
  1556. - bool *truncated);
  1557. - int store(double nr)
  1558. - {
  1559. - return store_truncated(nr, 0);
  1560. - }
  1561. - int store_truncated(double nr, bool *truncated);
  1562. - int store(longlong nr, bool unsigned_val)
  1563. - {
  1564. - return store_truncated(nr, unsigned_val, 0);
  1565. - }
  1566. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated);
  1567. + int store(const char* to, uint length, CHARSET_INFO *charset,
  1568. + bool *truncated= 0);
  1569. + int store(double nr, bool *truncated= 0);
  1570. + int store(longlong nr, bool unsigned_val, bool *truncated= 0);
  1571. int reset(void)
  1572. {
  1573. ptr[0]=ptr[1]=ptr[2]=ptr[3]=ptr[4]=ptr[5]=ptr[6]=ptr[7]=0;
  1574. @@ -1280,22 +1116,10 @@
  1575. {}
  1576. enum_field_types type() const { return MYSQL_TYPE_FLOAT;}
  1577. enum ha_base_keytype key_type() const { return HA_KEYTYPE_FLOAT; }
  1578. - int store(const char *to, uint length, CHARSET_INFO *charset)
  1579. - {
  1580. - return store_truncated(to, length, charset, 0);
  1581. - }
  1582. - int store_truncated(const char *to, uint length, CHARSET_INFO *charset,
  1583. - bool *truncated);
  1584. - int store(double nr)
  1585. - {
  1586. - return store_truncated(nr, 0);
  1587. - }
  1588. - int store_truncated(double nr, bool *truncated);
  1589. - int store(longlong nr, bool unsigned_val)
  1590. - {
  1591. - return store_truncated(nr, unsigned_val, 0);
  1592. - }
  1593. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated);
  1594. + int store(const char *to, uint length, CHARSET_INFO *charset,
  1595. + bool *truncated= 0);
  1596. + int store(double nr, bool *truncated= 0);
  1597. + int store(longlong nr, bool unsigned_val, bool *truncated= 0);
  1598. int reset(void) { bzero(ptr,sizeof(float)); return 0; }
  1599. double val_real(void);
  1600. longlong val_int(void);
  1601. @@ -1333,22 +1157,10 @@
  1602. {not_fixed= not_fixed_arg; }
  1603. enum_field_types type() const { return MYSQL_TYPE_DOUBLE;}
  1604. enum ha_base_keytype key_type() const { return HA_KEYTYPE_DOUBLE; }
  1605. - int store(const char *to, uint length, CHARSET_INFO *charset)
  1606. - {
  1607. - return store_truncated(to, length, charset, 0);
  1608. - }
  1609. - int store_truncated(const char *to, uint length, CHARSET_INFO *charset,
  1610. - bool *truncated);
  1611. - int store(double nr)
  1612. - {
  1613. - return store_truncated(nr, 0);
  1614. - }
  1615. - int store_truncated(double nr, bool *truncated);
  1616. - int store(longlong nr, bool unsigned_val)
  1617. - {
  1618. - return store_truncated(nr, unsigned_val, 0);
  1619. - }
  1620. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated);
  1621. + int store(const char *to, uint length, CHARSET_INFO *charset,
  1622. + bool *truncated= 0);
  1623. + int store(double nr, bool *truncated= 0);
  1624. + int store(longlong nr, bool unsigned_val, bool *truncated= 0);
  1625. int reset(void) { bzero(ptr,sizeof(double)); return 0; }
  1626. double val_real(void);
  1627. longlong val_int(void);
  1628. @@ -1376,12 +1188,8 @@
  1629. unireg_check_arg, field_name_arg, cs)
  1630. {}
  1631. enum_field_types type() const { return MYSQL_TYPE_NULL;}
  1632. - int store(const char *to, uint length, CHARSET_INFO *cs)
  1633. - {
  1634. - return store_truncated(to, length, cs, 0);
  1635. - }
  1636. - int store_truncated(const char *to, uint length, CHARSET_INFO *cs,
  1637. - bool *truncated)
  1638. + int store(const char *to, uint length, CHARSET_INFO *cs,
  1639. + bool *truncated= 0)
  1640. {
  1641. if (truncated)
  1642. {
  1643. @@ -1390,11 +1198,7 @@
  1644. null[0]= 1;
  1645. return 0;
  1646. }
  1647. - int store(double nr)
  1648. - {
  1649. - return store_truncated(nr, 0);
  1650. - }
  1651. - int store_truncated(double nr, bool *truncated)
  1652. + int store(double nr, bool *truncated= 0)
  1653. {
  1654. if (truncated)
  1655. {
  1656. @@ -1403,11 +1207,7 @@
  1657. null[0]=1;
  1658. return 0;
  1659. }
  1660. - int store(longlong nr, bool unsigned_val)
  1661. - {
  1662. - return store_truncated(nr, unsigned_val, 0);
  1663. - }
  1664. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated)
  1665. + int store(longlong nr, bool unsigned_val, bool *truncated= 0)
  1666. {
  1667. if (truncated)
  1668. {
  1669. @@ -1416,11 +1216,7 @@
  1670. null[0]= 1;
  1671. return 0;
  1672. }
  1673. - int store_decimal(const my_decimal *d)
  1674. - {
  1675. - return store_decimal_truncated(d, 0);
  1676. - }
  1677. - int store_decimal_truncated(const my_decimal *d, bool *truncated)
  1678. + int store_decimal(const my_decimal *d, bool *truncated= 0)
  1679. {
  1680. if (truncated)
  1681. {
  1682. @@ -1455,22 +1251,10 @@
  1683. enum_field_types type() const { return MYSQL_TYPE_TIMESTAMP;}
  1684. enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONG_INT; }
  1685. enum Item_result cmp_type () const { return INT_RESULT; }
  1686. - int store(const char *to, uint length, CHARSET_INFO *charset)
  1687. - {
  1688. - return store_truncated(to, length, charset, 0);
  1689. - }
  1690. - int store_truncated(const char *to, uint length, CHARSET_INFO *charset,
  1691. - bool *truncated);
  1692. - int store(double nr)
  1693. - {
  1694. - return store_truncated(nr, 0);
  1695. - }
  1696. - int store_truncated(double nr, bool *truncated);
  1697. - int store(longlong nr, bool unsigned_val)
  1698. - {
  1699. - return store_truncated(nr, unsigned_val, 0);
  1700. - }
  1701. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated);
  1702. + int store(const char *to, uint length, CHARSET_INFO *charset,
  1703. + bool *truncated= 0);
  1704. + int store(double nr, bool *truncated= 0);
  1705. + int store(longlong nr, bool unsigned_val, bool *truncated= 0);
  1706. int reset(void) { ptr[0]=ptr[1]=ptr[2]=ptr[3]=0; return 0; }
  1707. double val_real(void);
  1708. longlong val_int(void);
  1709. @@ -1541,22 +1325,10 @@
  1710. unireg_check_arg, field_name_arg, 1, 1)
  1711. {}
  1712. enum_field_types type() const { return MYSQL_TYPE_YEAR;}
  1713. - int store(const char *to, uint length, CHARSET_INFO *charset)
  1714. - {
  1715. - return store_truncated(to, length, charset, 0);
  1716. - }
  1717. - int store_truncated(const char *to, uint length, CHARSET_INFO *charset,
  1718. - bool *truncated);
  1719. - int store(double nr)
  1720. - {
  1721. - return store_truncated(nr, 0);
  1722. - }
  1723. - int store_truncated(double nr, bool *truncated);
  1724. - int store(longlong nr, bool unsigned_val)
  1725. - {
  1726. - return store_truncated(nr, unsigned_val, 0);
  1727. - }
  1728. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated);
  1729. + int store(const char *to, uint length, CHARSET_INFO *charset,
  1730. + bool *truncated= 0);
  1731. + int store(double nr, bool *truncated= 0);
  1732. + int store(longlong nr, bool unsigned_val, bool *truncated= 0);
  1733. double val_real(void);
  1734. longlong val_int(void);
  1735. String *val_str(String*,String *);
  1736. @@ -1581,22 +1353,10 @@
  1737. enum_field_types type() const { return MYSQL_TYPE_DATE;}
  1738. enum ha_base_keytype key_type() const { return HA_KEYTYPE_ULONG_INT; }
  1739. enum Item_result cmp_type () const { return INT_RESULT; }
  1740. - int store(const char *to, uint length, CHARSET_INFO *charset)
  1741. - {
  1742. - return store_truncated(to, length, charset, 0);
  1743. - }
  1744. - int store_truncated(const char *to, uint length, CHARSET_INFO *charset,
  1745. - bool *truncated);
  1746. - int store(double nr)
  1747. - {
  1748. - return store_truncated(nr, 0);
  1749. - }
  1750. - int store_truncated(double nr, bool *truncated);
  1751. - int store(longlong nr, bool unsigned_val)
  1752. - {
  1753. - return store_truncated(nr, unsigned_val, 0);
  1754. - }
  1755. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated);
  1756. + int store(const char *to, uint length, CHARSET_INFO *charset,
  1757. + bool *truncated= 0);
  1758. + int store(double nr, bool *truncated= 0);
  1759. + int store(longlong nr, bool unsigned_val, bool *truncated= 0);
  1760. int reset(void) { ptr[0]=ptr[1]=ptr[2]=ptr[3]=0; return 0; }
  1761. double val_real(void);
  1762. longlong val_int(void);
  1763. @@ -1639,22 +1399,10 @@
  1764. enum_field_types real_type() const { return MYSQL_TYPE_NEWDATE; }
  1765. enum ha_base_keytype key_type() const { return HA_KEYTYPE_UINT24; }
  1766. enum Item_result cmp_type () const { return INT_RESULT; }
  1767. - int store(const char *to, uint length, CHARSET_INFO *charset)
  1768. - {
  1769. - return store_truncated(to, length, charset, 0);
  1770. - }
  1771. - int store_truncated(const char *to, uint length, CHARSET_INFO *charset,
  1772. - bool *truncated);
  1773. - int store(double nr)
  1774. - {
  1775. - return store_truncated(nr, 0);
  1776. - }
  1777. - int store_truncated(double nr, bool *truncated);
  1778. - int store(longlong nr, bool unsigned_val)
  1779. - {
  1780. - return store_truncated(nr, unsigned_val, 0);
  1781. - }
  1782. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated);
  1783. + int store(const char *to, uint length, CHARSET_INFO *charset,
  1784. + bool *truncated= 0);
  1785. + int store(double nr, bool *truncated= 0);
  1786. + int store(longlong nr, bool unsigned_val, bool *truncated= 0);
  1787. int store_time(MYSQL_TIME *ltime, timestamp_type type);
  1788. int reset(void) { ptr[0]=ptr[1]=ptr[2]=0; return 0; }
  1789. double val_real(void);
  1790. @@ -1688,22 +1436,10 @@
  1791. enum ha_base_keytype key_type() const { return HA_KEYTYPE_INT24; }
  1792. enum Item_result cmp_type () const { return INT_RESULT; }
  1793. int store_time(MYSQL_TIME *ltime, timestamp_type type);
  1794. - int store(const char *to, uint length, CHARSET_INFO *charset)
  1795. - {
  1796. - return store_truncated(to, length, charset, 0);
  1797. - }
  1798. - int store_truncated(const char *to, uint length, CHARSET_INFO *charset,
  1799. - bool *truncated);
  1800. - int store(double nr)
  1801. - {
  1802. - return store_truncated(nr, 0);
  1803. - }
  1804. - int store_truncated(double nr, bool *truncated);
  1805. - int store(longlong nr, bool unsigned_val)
  1806. - {
  1807. - return store_truncated(nr, unsigned_val, 0);
  1808. - }
  1809. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated);
  1810. + int store(const char *to, uint length, CHARSET_INFO *charset,
  1811. + bool *truncated= 0);
  1812. + int store(double nr, bool *truncated= 0);
  1813. + int store(longlong nr, bool unsigned_val, bool *truncated= 0);
  1814. int reset(void) { ptr[0]=ptr[1]=ptr[2]=0; return 0; }
  1815. double val_real(void);
  1816. longlong val_int(void);
  1817. @@ -1738,22 +1474,10 @@
  1818. #endif
  1819. enum Item_result cmp_type () const { return INT_RESULT; }
  1820. uint decimals() const { return DATETIME_DEC; }
  1821. - int store(const char *to, uint length, CHARSET_INFO *charset)
  1822. - {
  1823. - return store_truncated(to, length, charset, 0);
  1824. - }
  1825. - int store_truncated(const char *to, uint length, CHARSET_INFO *charset,
  1826. - bool *truncated);
  1827. - int store(double nr)
  1828. - {
  1829. - return store_truncated(nr, 0);
  1830. - }
  1831. - int store_truncated(double nr, bool *truncated);
  1832. - int store(longlong nr, bool unsigned_val)
  1833. - {
  1834. - return store_truncated(nr, unsigned_val, 0);
  1835. - }
  1836. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated);
  1837. + int store(const char *to, uint length, CHARSET_INFO *charset,
  1838. + bool *truncated= 0);
  1839. + int store(double nr, bool *truncated= 0);
  1840. + int store(longlong nr, bool unsigned_val, bool *truncated= 0);
  1841. int store_time(MYSQL_TIME *ltime, timestamp_type type);
  1842. int reset(void)
  1843. {
  1844. @@ -1819,24 +1543,12 @@
  1845. (has_charset() ? ' ' : 0));
  1846. return 0;
  1847. }
  1848. - int store(const char *to, uint length, CHARSET_INFO *charset)
  1849. - {
  1850. - return store_truncated(to, length, charset, 0);
  1851. - }
  1852. - int store_truncated(const char *to, uint length, CHARSET_INFO *charset,
  1853. - bool *truncated);
  1854. - int store(longlong nr, bool unsigned_val)
  1855. - {
  1856. - return store_truncated(nr, unsigned_val, 0);
  1857. - }
  1858. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated);
  1859. - int store(double nr) /* QQ: To be deleted */
  1860. + int store(const char *to, uint length, CHARSET_INFO *charset,
  1861. + bool *truncated= 0);
  1862. + int store(longlong nr, bool unsigned_val, bool *truncated= 0);
  1863. + int store(double nr, bool *truncated= 0) /* QQ: To be deleted */
  1864. {
  1865. - return store_truncated(nr, 0);
  1866. - }
  1867. - int store_truncated(double nr, bool *truncated)/* QQ: To be deleted */
  1868. - {
  1869. - return Field_str::store_truncated(nr, truncated);
  1870. + return Field_str::store(nr, truncated);
  1871. }
  1872. double val_real(void);
  1873. longlong val_int(void);
  1874. @@ -1920,25 +1632,13 @@
  1875. return (uint32) field_length + (field_charset == &my_charset_bin ?
  1876. length_bytes : 0);
  1877. }
  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(longlong nr, bool unsigned_val)
  1885. - {
  1886. - return store_truncated(nr, unsigned_val, 0);
  1887. - }
  1888. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated);
  1889. - int store(double nr) /* QQ: To be deleted */
  1890. + int store(const char *to, uint length, CHARSET_INFO *charset
  1891. + bool *truncated= 0);
  1892. + int store(longlong nr, bool unsigned_val, bool *truncated= 0);
  1893. + int store(double nr, bool *truncated= 0) /* QQ: To be deleted */
  1894. {
  1895. - return store_truncated(nr, 0);
  1896. + return Field_str::store(nr, truncated);
  1897. }
  1898. - int store_truncated(double nr, bool *truncated)/* QQ: To be deleted */
  1899. - {
  1900. - return Field_str::store_truncated(nr, truncated);
  1901. - }
  1902. double val_real(void);
  1903. longlong val_int(void);
  1904. String *val_str(String*,String *);
  1905. @@ -2030,22 +1730,10 @@
  1906. enum_field_types type() const { return MYSQL_TYPE_BLOB;}
  1907. enum ha_base_keytype key_type() const
  1908. { return binary() ? HA_KEYTYPE_VARBINARY2 : HA_KEYTYPE_VARTEXT2; }
  1909. - int store(const char *to, uint length, CHARSET_INFO *charset)
  1910. - {
  1911. - return store_truncated(to, length, charset, 0);
  1912. - }
  1913. - int store_truncated(const char *to, uint length, CHARSET_INFO *charset,
  1914. - bool *truncated);
  1915. - int store(double nr)
  1916. - {
  1917. - return store_truncated(nr, 0);
  1918. - }
  1919. - int store_truncated(double nr, bool *truncated);
  1920. - int store(longlong nr, bool unsigned_val)
  1921. - {
  1922. - return store_truncated(nr, unsigned_val, 0);
  1923. - }
  1924. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated);
  1925. + int store(const char *to, uint length, CHARSET_INFO *charset,
  1926. + bool *truncated= 0);
  1927. + int store(double nr, bool *truncated= 0);
  1928. + int store(longlong nr, bool unsigned_val, bool *truncated= 0);
  1929. double val_real(void);
  1930. longlong val_int(void);
  1931. String *val_str(String*,String *);
  1932. @@ -2199,27 +1887,11 @@
  1933. enum ha_base_keytype key_type() const { return HA_KEYTYPE_VARBINARY2; }
  1934. enum_field_types type() const { return MYSQL_TYPE_GEOMETRY; }
  1935. void sql_type(String &str) const;
  1936. - int store(const char *to, uint length, CHARSET_INFO *charset)
  1937. - {
  1938. - return store_truncated(to, length, charset, 0);
  1939. - }
  1940. - int store_truncated(const char *to, uint length, CHARSET_INFO *charset,
  1941. - bool* truncated);
  1942. - int store(double nr)
  1943. - {
  1944. - return store_truncated(nr, 0);
  1945. - }
  1946. - int store_truncated(double nr, bool *truncated);
  1947. - int store(longlong nr, bool unsigned_val)
  1948. - {
  1949. - return store_truncated(nr, unsigned_val, 0);
  1950. - }
  1951. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated);
  1952. - int store_decimal(const my_decimal *value)
  1953. - {
  1954. - return store_decimal_truncated(value, 0);
  1955. - }
  1956. - int store_decimal_truncated(const my_decimal*, bool *truncated);
  1957. + int store(const char *to, uint length, CHARSET_INFO *charset,
  1958. + bool *truncated= 0);
  1959. + int store(double nr, bool *truncated= 0);
  1960. + int store(longlong nr, bool unsigned_val, bool *truncated= 0);
  1961. + int store_decimal(const my_decimal *value, bool *truncated= 0);
  1962. uint size_of() const { return sizeof(*this); }
  1963. int reset(void) { return !maybe_null() || Field_blob::reset(); }
  1964. geometry_type get_geometry_type() { return geom_type; };
  1965. @@ -2249,22 +1921,10 @@
  1966. enum Item_result cmp_type () const { return INT_RESULT; }
  1967. enum Item_result cast_to_int_type () const { return INT_RESULT; }
  1968. enum ha_base_keytype key_type() const;
  1969. - int store(const char *to, uint length,CHARSET_INFO *charset)
  1970. - {
  1971. - return store_truncated(to, length, charset, 0);
  1972. - }
  1973. - int store_truncated(const char *to, uint length, CHARSET_INFO *charset,
  1974. - bool *truncated);
  1975. - int store(double nr)
  1976. - {
  1977. - return store_truncated(nr, 0);
  1978. - }
  1979. - int store_truncated(double nr, bool *truncated);
  1980. - int store(longlong nr, bool unsigned_val)
  1981. - {
  1982. - return store_truncated(nr, unsigned_val, 0);
  1983. - }
  1984. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated);
  1985. + int store(const char *to, uint length,CHARSET_INFO *charset,
  1986. + bool *truncated= 0);
  1987. + int store(double nr, bool *truncated= 0);
  1988. + int store(longlong nr, bool unsigned_val, bool *truncated= 0);
  1989. double val_real(void);
  1990. longlong val_int(void);
  1991. String *val_str(String*,String *);
  1992. @@ -2304,25 +1964,13 @@
  1993. {
  1994. flags=(flags & ~ENUM_FLAG) | SET_FLAG;
  1995. }
  1996. - int store(const char *to, uint length, CHARSET_INFO *charset)
  1997. - {
  1998. - return store_truncated(to, length, charset, 0);
  1999. - }
  2000. - int store_truncated(const char *to, uint length, CHARSET_INFO *charset,
  2001. - bool *truncated);
  2002. - int store(double nr)
  2003. - {
  2004. - return store_truncated(nr, 0);
  2005. - }
  2006. - int store_truncated(double nr, bool *truncated)
  2007. - {
  2008. - return Field_set::store_truncated((longlong) nr, FALSE, truncated);
  2009. - }
  2010. - int store(longlong nr, bool unsigned_val)
  2011. + int store(const char *to, uint length, CHARSET_INFO *charset,
  2012. + bool *truncated= 0);
  2013. + int store(double nr, bool *truncated= 0);
  2014. {
  2015. - return store_truncated(nr, unsigned_val, 0);
  2016. + return Field_set::store((longlong) nr, FALSE, truncated);
  2017. }
  2018. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated);
  2019. + int store(longlong nr, bool unsigned_val, bool *truncated= 0);
  2020.  
  2021. virtual bool zero_pack() const { return 1; }
  2022. String *val_str(String*,String *);
  2023. @@ -2368,27 +2016,11 @@
  2024. clr_rec_bits(bit_ptr, bit_ofs, bit_len);
  2025. return 0;
  2026. }
  2027. - int store(const char *to, uint length, CHARSET_INFO *charset)
  2028. - {
  2029. - return store_truncated(to, length, charset, 0);
  2030. - }
  2031. - int store_truncated(const char *to, uint length, CHARSET_INFO *charset,
  2032. - bool *truncated);
  2033. - int store(double nr)
  2034. - {
  2035. - return store_truncated(nr, 0);
  2036. - }
  2037. - int store_truncated(double nr, bool *truncated);
  2038. - int store(longlong nr, bool unsigned_val)
  2039. - {
  2040. - return store_truncated(nr, unsigned_val, 0);
  2041. - }
  2042. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated);
  2043. - int store_decimal(const my_decimal *value)
  2044. - {
  2045. - return store_decimal_truncated(value, 0);
  2046. - }
  2047. - int store_decimal_truncated(const my_decimal*, bool *truncated);
  2048. + int store(const char *to, uint length, CHARSET_INFO *charset,
  2049. + bool *truncated= 0);
  2050. + int store(double nr, bool *truncated= 0);
  2051. + int store(longlong nr, bool unsigned_val, bool *truncated= 0);
  2052. + int store_decimal(const my_decimal *value, bool *truncated= 0);
  2053. double val_real(void);
  2054. longlong val_int(void);
  2055. String *val_str(String*, String *);
  2056. @@ -2471,27 +2103,15 @@
  2057. enum utype unireg_check_arg, const char *field_name_arg);
  2058. enum ha_base_keytype key_type() const { return HA_KEYTYPE_BINARY; }
  2059. uint size_of() const { return sizeof(*this); }
  2060. - int store(const char *to, uint length, CHARSET_INFO *charset)
  2061. - {
  2062. - return store_truncated(to, length, charset, 0);
  2063. - }
  2064. - int store_truncated(const char *to, uint length, CHARSET_INFO *charset,
  2065. - bool *truncated);
  2066. - int store(double nr)
  2067. - {
  2068. - return store_truncated(nr, 0);
  2069. - }
  2070. - int store_truncated(double nr, bool *truncated)
  2071. - {
  2072. - return Field_bit::store_truncated(nr, truncated);
  2073. - }
  2074. - int store(longlong nr, bool unsigned_val)
  2075. + int store(const char *to, uint length, CHARSET_INFO *charset,
  2076. + bool *truncated= 0);
  2077. + int store(double nr, bool *truncated= 0);
  2078. {
  2079. - return store_truncated(nr, unsigned_val, 0);
  2080. + return Field_bit::store(nr, truncated);
  2081. }
  2082. - int store_truncated(longlong nr, bool unsigned_val, bool *truncated)
  2083. + int store(longlong nr, bool unsigned_val, bool *truncated= 0)
  2084. {
  2085. - return Field_bit::store_truncated(nr, unsigned_val, truncated);
  2086. + return Field_bit::store(nr, unsigned_val, truncated);
  2087. }
  2088. void sql_type(String &str) const;
  2089. };
Advertisement
Add Comment
Please, Sign In to add comment