How to use Mysql function in Php Editor SET

How to use Mysql function in Php Editor SET

khellendros74khellendros74 Posts: 4Questions: 2Answers: 0
edited September 2023 in Editor

Description of problem: theoretical question
with the following syntax i know how to extract data from a table field (example how im using it below) so it basically inject a mysql function while doing a get

here is the table essential definition

CREATE TABLE `collect_ip` (
  `uuid` binary(16) DEFAULT NULL,
  `router_ip` varbinary(16) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin;

to extract binary to string i use the following php code

,   Field::inst( "BIN_TO_UUID(collect_ip.uuid)", "collect_ip.uuid" )
,   Field::inst( "INET6_NTOA(collect_ip.router_ip)", "collect_ip.router_ip" )

but i cant manage to write data using mysql function that should be respectively (or haven't found the good example

UUID_TO_BIN("ST-RI-NG")
INET6_ATON("10.0.0.3")

the closet example are formatters but they refer to php function, and mostly respond to date format

so is there a way to push mysql function inside ?

Field::inst( "BIN_TO_UUID(collect_ip.uuid)", "collect_ip.uuid" )->setFormatter( Format::UuidToBin() )
Field::inst( "INET6_NTOA(collect_ip.router_ip)", "collect_ip.router_ip" )->setFormatter( Format::INET6_ATON() )

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin
    Answer ✓

    Unfortunately no, there isn't a way to use an SQL function along with submitted data as part of the set operation I'm afraid. That is something of an oversight and I'll need to look into how it might be possible to add something like that in future. Apologies.

    Allan

  • khellendros74khellendros74 Posts: 4Questions: 2Answers: 0

    thanks for your quick answer,
    so i will modify your code to match my desire :smile:

Sign In or Register to comment.