|
|
-
Casting parameters to custom LoadFunc (was RE: Restricting loading of log files based on parameter input)
Stevens, Ian 2013-02-21, 17:21
One quick question:
> A = LOAD '/foo/replace_me_with_regex' USING MyLoadFunc('2013', '1', '28');
Is there any way to use script parameters here and cast them to int? In other words, can LoadFunc constructors only accept Strings?
These do not work:
A = LOAD '/foo/replace_me_with_regex' USING MyLoadFunc($year, $month, $day); A = LOAD '/foo/replace_me_with_regex' USING MyLoadFunc((int)$year, (int)$month, (int)$day);
This does, but it forces my LoadFunc to accept String parameters and do the casting within:
A = LOAD '/foo/replace_me_with_regex' USING MyLoadFunc('$year', '$month', '$day');
Thanks, Ian.
+
Stevens, Ian 2013-02-21, 17:21
-
Re: Casting parameters to custom LoadFunc (was RE: Restricting loading of log files based on parameter input)
Cheolsoo Park 2013-02-21, 21:30
>> Can LoadFunc constructors only accept Strings?
Yes, it only takes strings. On Thu, Feb 21, 2013 at 9:21 AM, Stevens, Ian <[EMAIL PROTECTED]>wrote:
> One quick question: > > > A = LOAD '/foo/replace_me_with_regex' USING MyLoadFunc('2013', '1', > '28'); > > Is there any way to use script parameters here and cast them to int? In > other words, can LoadFunc constructors only accept Strings? > > These do not work: > > A = LOAD '/foo/replace_me_with_regex' USING MyLoadFunc($year, > $month, $day); > A = LOAD '/foo/replace_me_with_regex' USING MyLoadFunc((int)$year, > (int)$month, (int)$day); > > This does, but it forces my LoadFunc to accept String parameters and do > the casting within: > > A = LOAD '/foo/replace_me_with_regex' USING MyLoadFunc('$year', > '$month', '$day'); > > Thanks, > Ian. >
+
Cheolsoo Park 2013-02-21, 21:30
|
|