[Commits] Review comments for MDEV-6112 multiple triggers per table

Vicențiu Ciorbaru vicentiu at mariadb.org
Wed Sep 28 14:42:19 EEST 2016


>
> 3. Regarding Item_timestamp_literal and Item_datetime_literal and (at
> least) it's parent Item_temporal_literal:
> The parameter MYSQL_TIME is hard copied within the constructor of
> Item_temporal_literal. To ensure a bit of extra type safety, you can add
> the const parameter to (MYSQL_TIME *) argument.
>
> I personally would make it a const reference (const MYSQL_TIME &) in the
> constructor of Item_temporal_literal. This way you force the caller to
> always provide a valid entry when creating the object (NULL would crash the
> server anyway).
>
> Making it a const pointer would only involve changing
> Item_temporal_literal's, Item_datetime_literal and Item_timestamp_literal's
> constructor definitions.
> Making it a const reference would involve changing the call sites for
> these constructors as well. I think this is the best option type-safety
> wise, but it requires potentially more changes around the codebase. We're
> touching this area a bit anyway so perhaps it's worth it to do it now?
>

Also, the global variable MYSQL_TIME zero_time should be declared const in
this case, that's where all this reasoning started actually. Obviously
making it const implies that the changes above have to happen, else you end
up casting it to not-const during the constructor.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.askmonty.org/pipermail/commits/attachments/20160928/a9f7ebd7/attachment.html>


More information about the commits mailing list