You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@age.apache.org by "M4rcxs (via GitHub)" <gi...@apache.org> on 2023/07/11 04:02:29 UTC

[GitHub] [age] M4rcxs opened a new issue, #1023: Have a function similar to float8in_internal_null( ) for Integer types?

M4rcxs opened a new issue, #1023:
URL: https://github.com/apache/age/issues/1023

   I am currently developing a function that converts a list of values to integers. In the case of float types, we have the convenient `float8in_internal_null()` function at `toFloatList()`, which returns the appropriate float value if the conversion is successful, but returns **NULL** if the conversion of a list element fails.
   
   However, when working with integers and using the `atoi()` function, I encountered a limitation. Unlike `float8in_internal_null()`, `atoi()` does not return **NULL** when it fails to convert an element of the list to an integer. Instead, it returns 0.
   
   Is there an alternative function within some library in **AGE**, that can help me achieve the desired behavior of returning **NULL** when a conversion to an integer is not possible? I would appreciate any guidance on this matter.
   
   The PR of the `toFloatList()` function implemented is #1016 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [age] kenwoon commented on issue #1023: Have a function similar to float8in_internal_null( ) for Integer types?

Posted by "kenwoon (via GitHub)" <gi...@apache.org>.
kenwoon commented on issue #1023:
URL: https://github.com/apache/age/issues/1023#issuecomment-1633159020

   I don't think there is an alternative function available in the AGE library. In your function, it may be easier if you just change the condition when using `atoi()` to check for the value `0` instead of `NULL` since the function will always return `0` when it fails in the conversion. For example:
   
   ```
   int_elem.val.int_value = atoi(string) ? NULL : atoi(string);
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [age] M4rcxs closed issue #1023: Have a function similar to float8in_internal_null( ) for Integer types?

Posted by "M4rcxs (via GitHub)" <gi...@apache.org>.
M4rcxs closed issue #1023: Have a function similar to float8in_internal_null( ) for Integer types?
URL: https://github.com/apache/age/issues/1023


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [age] Amr-Shams commented on issue #1023: Have a function similar to float8in_internal_null( ) for Integer types?

Posted by "Amr-Shams (via GitHub)" <gi...@apache.org>.
Amr-Shams commented on issue #1023:
URL: https://github.com/apache/age/issues/1023#issuecomment-1630580680

   I believe you encountered this problem to make a double check about the input what if it is zero and how to differentiate between the input is zero or the conversion was valid if that's the case then you can use an end pointer passed to the Atoi() then check in case of successful conversion the end pointer points to the null terminated string-"\0" other than this will be an error or un successful conversion.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org