This is a PoC to check how to add the toggle layout functionality for oracle databases.
In schemas.vim:
New variable created in "s:oracle_toggle_layout_query" which contains a PL/SQL script to read row by row from the database and then put the "column_name : value". The PL/SQL procedure is called: print_cols_as_rows
Changes in "s:oracle":
add this new variable: layout_query and set it to oracle_toggle_layout_query
add variable layout_flag: and set it to empty => The ";" of the SELECT statement must be deleted
In dbout.vim:
In case the filetype is plsql, there are many substitutions to make. The main steps are:
Extract ONLY the SELECT statement from content. If we send other sql commands like "column xxx format a20" to the PLS/SQL procedure it will not work.
Substitute the ";" at the end of the select command with layout_flag. Note: The extract command could be written to not include the last ";" from the select statement. If so, this substitute is not needed, but I've leave for consistency for other databases.
Substitute all carriage return with a space, otherwise the PL/SQL procedure does not work
Substitute all single quotes (') with two single quotes. This is needed to "escape" the single quote in the PL/SQL procedure. Needed for cases like "... where COLUMN = 'value'"
The content variable is constructed as:
The PL/SQL procedure
an exec command to start the procedure. As parameter the procedure sends the SQL statement extracted.
As the script inserts this procedure to the Oracle schema, we need to drop it again from the schema to leave the schema untouched.
Hope that other people can check this before merging it to master.
This is a PoC to check how to add the toggle layout functionality for oracle databases.
In schemas.vim: New variable created in "s:oracle_toggle_layout_query" which contains a PL/SQL script to read row by row from the database and then put the "column_name : value". The PL/SQL procedure is called: print_cols_as_rows
Changes in "s:oracle":
In dbout.vim: In case the filetype is plsql, there are many substitutions to make. The main steps are:
The content variable is constructed as:
Hope that other people can check this before merging it to master.