Éibhear Ó hAnluain
f33add7663
+ contrib/pls-mode.el: pls-mode for emacs. Used for building PL/SQL files. + docs/oracle-lisp-functions.txt: Another document file + For creating explain plans.
71 lines
No EOL
2.9 KiB
Text
71 lines
No EOL
2.9 KiB
Text
- get-explain-plan-for-region
|
|
+ determine enode-stage-buffer
|
|
~ create a buffer called " *enode-stage-buffer*"
|
|
~ empty it
|
|
+ go to that buffer
|
|
+ add the SQL text to plan
|
|
+ get-explain-plan
|
|
~ set the progress message
|
|
~ Determine the get-statement-id
|
|
* Return a string of the format ENODE_YYYYMMDD_HH24MMSS
|
|
~ prepare the plan with enode-prepare-explain-plan
|
|
* Determine the full explain plan command with
|
|
get-sql-explain-plan-command
|
|
$ return the string starting with "explain plan..." and finishing
|
|
with get-sql-command-to-explain
|
|
> return the SQL command to explain with blank lines and ';'
|
|
characters removed.
|
|
* Send the explain plan command to the SQL buffer and redirect output
|
|
$ to a buffer determined by enode-temp-output-buffer
|
|
$ create a buffer named " *enode-comint-sql-output*"
|
|
$ empty it
|
|
* wait for command to complete with enode-oracle-wait-for-command
|
|
~ enode-output-explain-plan
|
|
* Get the line size
|
|
$ run "show linesize" through enode-oracle-get-sqlplus-param
|
|
* Get the page size
|
|
$ run "show pagesize" through enode-oracle-get-sqlplus-param
|
|
* get the explain plan output command from
|
|
get-explain-plan-output-command
|
|
$ return the SQL command to output an explain plan.
|
|
* get the SQL buffer
|
|
* clean output buffer
|
|
* prepare the sql buffer with prepare-sql-buffer-for-command
|
|
$ set the SQL parameters heading(off), linesize(1024) and
|
|
pagesize(0) with enode-oracle-set-sqlplus-param
|
|
> send the "set" command to the SQL buffer redirecting any output
|
|
* send the command, redirecting the output
|
|
* wait for command to complete with enode-oracle-wait-for-command
|
|
* Set the SQL buffer back to it's standard output presentation with
|
|
reset-sql-buffer-after-command
|
|
$ Sets the heading(on), pagesize(original_val) and
|
|
linesize(original_val) SQL*Plus parameters.
|
|
~ enode-oracle-remove-prompt-from-plan-output
|
|
* Get the prompt from enode-oracle-get-sql-prompt
|
|
$ Return the sqlprompt parameter through
|
|
enode-oracle-get-sqlplus-param
|
|
* replace every instance of the prompt with "" in the buffer.
|
|
~ present the buffer with the plan
|
|
|
|
|
|
- Present the PL/SQL code
|
|
+ Determine a buffer to take the code.
|
|
~ enode-pls-code-buffer
|
|
+ Determine SQL buffer settings
|
|
~ line size
|
|
~ page size
|
|
+ Query the longest line in the PL/SQL block sending the output to the
|
|
prepared buffer
|
|
~ enode-oracle-plsql-max-line-length
|
|
+ Prepare the SQL buffer for the output
|
|
~ set heading off
|
|
~ set linesize to the longest line
|
|
~ set pagesize 0
|
|
+ Send the select statement to the SQL buffer sending output to the
|
|
prepared buffer
|
|
~ comint...
|
|
+ Reset the SQL buffer.
|
|
~ set heading on
|
|
~ set linesize to original value
|
|
~ set pagesize to original value
|
|
+ Present the buffer with the PL/SQL code |