Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-4502

INTERNAL FUNCTIONS - Add parse_url returning Dynamic Column Object

    Details

    • Type: Task
    • Status: Open
    • Priority: Trivial
    • Resolution: Unresolved
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      Hi guys, could we develop a function to get information from a url, and 'convert' it to a dynamic column?

      i have a big apache log, with some fields:
      start time,total time,url,bytes in,bytes out

      and i do some searchs in this database, for example, try to get how many users was quering some url with some variable=xxx

      i do this search inside url value, it works, but it's not perfect

      what i do?

      SELECT * FROM log WHERE url LIKE '%USER=1234%'
      

      in other words, it return all rows that have USER=1234, this include users 12345,123456, and others kinds of url values
      ok, here i have some optimization from LIKE operator, but it's not perfect
      after, i run in php side a parse in url and check if it's from user 1234

      what i was thinking...
      a function that convert a string url, to a dynamic column, like
      http://www.php.net/manual/en/function.parse-url.php
      and a function that convert a string of GET http values, to dynamic column, like
      http://www.php.net/manual/en/function.parse-str.php

      could it be done? this realy made my log very easier to analyze

      the 'like' part is good to query just some rows, but this two functions could be done to optimize the php part

      i could done some search like:

      SELECT * FROM log WHERE 
      URL_PARSE_VAR(url,'USER')='1234' 
      AND
      URL_PARSE(url,'path')='some_file.php'
      

      and do some analytic tools, COUNT(*), SUM(total time)... etc

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            serg Sergei Golubchik added a comment -

            Sure, it's possible. Just write an UDF as described here: http://dev.mysql.com/doc/refman/5.6/en/adding-udf.html and parse the url any way you want.

            Show
            serg Sergei Golubchik added a comment - Sure, it's possible. Just write an UDF as described here: http://dev.mysql.com/doc/refman/5.6/en/adding-udf.html and parse the url any way you want.

              People

              • Assignee:
                Unassigned
                Reporter:
                rspadim roberto spadim
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: