cybertec-postgresql / poc-plpgsql-analyzer

Proof of concept for tooling to migrate PL/SQL code to PL/pgSQL written in Rust
MIT License
7 stars 0 forks source link

Analyzer: Determine number of statements #94

Open KieranKaelin opened 1 year ago

KieranKaelin commented 1 year ago

Goal

Given a function, procedure or trigger, the analyzer should determine the number of statements.

Notes

Example

CREATE PROCEDURE showcase
    IS
DECLARE
    formatted_output VARCHAR2(100);
BEGIN
    SELECT 'name: ' || dummy || ', last login: '  INTO formatted_output FROM DUAL;

    IF (formatted_output != '') THEN
        DBMS_OUTPUT.PUT_LINE(formatted_output);
    ELSIF TRUE != FALSE THEN
        NULL;
    ELSE
        NULL;
    END IF;
END;

Number of statements: 6

How to demo

Rust and TS tests demonstrate the new analyzer statistics.