4Dv11.5 MC3 -> Integer 64 bits field -> string() -> output blank -> only if compiled

View: New views
5 Messages — Rating Filter:   Alert me  

Re: 4Dv11.5 MC3 -> Integer 64 bits field -> string() -> output blank -> only if compiled

by MIYAKO :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

HI,

it seems the String function (or maybe functions in general, have to test more)
can't resolve pointers to Integer 64.

I wrote a method,

$p:=new int64
$p->:=1

ALERT(String($p->))
ALERT(String([Table_1]int64))

where the subroutine int64 reads,

C_POINTER($0)

CREATE RECORD([Table_1])
$0:=->[Table_1]int64

both alerts show "1" interpreted,
but the first is blank when compiled.

however,
the second line does function so its not as if String can't handle Integer 64;
it's resolving the $p-> that fails.

miyako

On 2009/11/12, at 3:00, Balinder Walia wrote:

> Another thing is baffling me a little, I have a function which returns time
> stamp and it is returning $0 C_LONGINT but field is of type int 64.
> Does it mean I can actually process int 64 bits data using variable and
> arrays?
> I suppose I use type casting to convert into alpha.
>
> Am I on the right track for a scalable large system?
>
> Bal
>
> 2009/11/10 Balinder Walia <balinder.walia@...>
>
>> ...running Mac Snow Leopard
>>
>> I have a loop which outputs table rows into JSON format. Interpreted mode
>> all works fine, example
>>
>> [{"t9_f1_id":"AAA000000000000000000000000000015517","t9_f2_timestamp_created":1257892195,"t9_f3_timestamp_modified"
>> :1257892196,,"t9_f30_Prefix":"AAA"},...
>>
>> When I switch to compiled mode the integer 64 bit fields output blank
>> values, example
>>
>> [{"t9_f1_id":"AAA000000000000000000000000000015517","t9_f2_timestamp_created":,"t9_f3_timestamp_modified"
>> :,,"t9_f30_Prefix":"AAA"},...
>>
>> Only integer 64 bits are effected...code which outputs data ( into array
>> first and then into JSON blob ) looks like:
>>
>> APPEND TO ARRAY($2->;String($pFieldPtr->)) where pFieldPtr points to field
>> of type integer 64 bit
>>
>> I added result of to String($pFieldPtr->) pasteboard and it seems to be
>> failing to output data just after String($pFieldPtr->) so nothing wrong with
>> Arrays or JSON encoder etc.
>>
>> Have a just found a bug? Or did I miss something crucial from 4Dv11 The
>> missing manual/Summit
>>
>> Balinder
**********************************************************************
Get up to $600 to spend on Amazon.com
this holiday season - http://www.4d.com/serverpromo.html


4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4D.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4D_Tech-Unsubscribe@...
**********************************************************************

Re: 4Dv11.5 MC3 -> Integer 64 bits field -> string() -> output blank -> only if compiled

by MIYAKO :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

it seems like the -> expression itself is quite compatible with integer 64,
as the following line did work compiled;

C_TEXT($vn)
C_LONGINT($tn;$fn)
RESOLVE POINTER($p;$vn;$tn;$fn)
ALERT(String(Type(Field($tn;$fn)->)))

however,
there seems to be an omission in the compiler due to the
multi-purpose nature of String (not that it is an excuse)...

I will file a bug report as soon as I nail down the exact problem,
as well as look for a workaround (if any...I can imagine EXECUTE FORMULA but maybe something else)

miyako

On 2009/11/12, at 10:16, Balinder Walia wrote:

> You know what that means? I can't write a generic method to pull data from
> any table in JSON format as easily I envisaged.
>
> like JSON_Encode_Selection(->[aTable])
>
> what else do it?
>
> Balinder
>
> 2009/11/12 miyako <miyako@...>
>>
>> ALERT(String($p->))
>> ALERT(String([Table_1]int64))
>>
>> however,
>> the second line does function so its not as if String can't handle Integer
>> 64; it's resolving the $p-> that fails.

**********************************************************************
Get up to $600 to spend on Amazon.com
this holiday season - http://www.4d.com/serverpromo.html


4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4D.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4D_Tech-Unsubscribe@...
**********************************************************************

Re: 4Dv11.5 MC3 -> Integer 64 bits field -> string() -> output blank -> only if compiled

by MIYAKO :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Hi,

I have posted on the forums a quick workaround;

http://forums.4d.fr/4DBB_Main/x_User/298210/files/3099896.zip

miyako

ALERT(String($p->))`NG compiled
ALERT(StringEx ($p))`OK

where StringEx reads,

                $formula_t:=Command name(10)  `String/Chaine
                $formula_t:=$formula_t+"("+eval ($1)+")"
               
                $code_t:="<!--#4dvar "+$formula_t+"-->"
                PROCESS HTML TAGS($code_t;$code_t)
               
                $0:=$code_t

and eval reads;

                C_TEXT($vn)
                C_LONGINT($tn;$fn)
                RESOLVE POINTER($1;$vn;$tn;$fn)
               
                Case of
                        : ($fn#0)  `is a field
                                $0:="["+Table name($tn)+"]"+Field name($tn;$fn)
                        : ($vn="")
                                If ($tn=0)  `is NIL
                                Else   `is a table
                                        $0:="["+Table name($tn)+"]"
                                End if
                        Else
                                If ($tn=-1)  `is a variable or array
                                        $0:=$vn
                                Else   `is an array element
                                        $0:=$vn+"{"+String($tn)+"}"
                                End if
                End case

On 2009/11/12, at 10:35, miyako wrote:

> as well as look for a workaround (if any...I can imagine EXECUTE FORMULA but maybe something else)


**********************************************************************
Get up to $600 to spend on Amazon.com
this holiday season - http://www.4d.com/serverpromo.html


4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4D.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4D_Tech-Unsubscribe@...
**********************************************************************

Re: 4Dv11.5 MC3 -> Integer 64 bits field -> string() -> output blank -> only if compiled

by MIYAKO :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

...and notified engineering of the problem.

miyako

ACI0063948: The String function does not accept pointer to Integer 64bits compiled**********************************************************************
Get up to $600 to spend on Amazon.com
this holiday season - http://www.4d.com/serverpromo.html


4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4D.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4D_Tech-Unsubscribe@...
**********************************************************************

Re: 4Dv11.5 MC3 -> Integer 64 bits field -> string() -> output blank -> only if compiled

by MIYAKO :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi, Balinder,

were you able to test the CAST function compiled with values larger than MAXLONG ?

this is what I (or rather, David Dancy) found;

http://forums.4d.fr/Post//3099905/1/

miyako

On 2009/11/12, at 19:46, Balinder Walia wrote:

> Thank you very much. I do appreciate you valiant efforts to reproduce and
> file a bug report. I will wait for the fix to implement a generic function
> In the mean time I have done just a few tables function using CAST which
> does work:
>
> Begin SQL
> SELECT id,CAST(timestamp_created AS VARCHAR) FROM table WHERE ....
>
> End SQL
>
> Balinder - www.tenthmatrix.co.uk
>
> 2009/11/12 miyako <miyako@...>
>
>> ...and notified engineering of the problem.
>>
>> miyako
>>
>> ACI0063948: The String function does not accept pointer to Integer 64bits
>> compiled



**********************************************************************
Get up to $600 to spend on Amazon.com
this holiday season - http://www.4d.com/serverpromo.html


4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4D.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4D_Tech-Unsubscribe@...
**********************************************************************