Comments (20)
I would put this in the resources\oradewrc-schema.json:
"source.pattern": {
"description": "Naming patterns for the sources of different object types",
"type": "object",
"properties": {
"package-spec": {
"default": "./src/{schema-name}/PACKAGES/{object-name}.sql",
"description": "Naming pattern for package specifications",
"type": "string"
},
"package-body": {
"default": "./src/{schema-name}/PACKAGE_BODIES/{object-name}.sql",
"description": "Naming pattern for package bodies",
"type": "string"
},
"trigger": {
"default": "./src/{schema-name}/TRIGGERS/{object-name}.sql",
"description": "Naming pattern for triggers",
"type": "string"
},
"type-spec": {
"default": "./src/{schema-name}/TYPES/{object-name}.sql",
"description": "Naming pattern for type specifications",
"type": "string"
},
"type-body": {
"default": "./src/{schema-name}/TYPE_BODIES/{object-name}.sql",
"description": "Naming pattern for type bodies",
"type": "string"
},
"view": {
"default": "./src/{schema-name}/VIEWS/{object-name}.sql",
"description": "Naming pattern for views",
"type": "string"
},
"function": {
"default": "./src/{schema-name}/FUNCTIONS/{object-name}.sql",
"description": "Naming pattern for functions",
"type": "string"
},
"procedure": {
"default": "./src/{schema-name}/PROCEDURES/{object-name}.sql",
"description": "Naming pattern for procedures",
"type": "string"
}
}
}
from oradew-vscode.
Amendment: Even when I select an invalid statement and use "Run Selected Statement" by right mouse button, the errors are shown in problems window.
But when I select the whole package source using Ctrl+a and subsequently use "Run Selected Statement", the errors are not shown.
from oradew-vscode.
Hi, can you please post printscreen or terminal output after compiling?
from oradew-vscode.
this is terminal output (partly in german, sorry):
Executing task: C:\Program Files\nodejs\node.exe c:\Users\Truetken-H.vscode\extensions\mp.oradew-vscode-0.3.11\node_modules\gulp\bin\gulp.js --cwd c:\cvs\resusDB --gulpfile c:\Users\Truetken-H.vscode\extensions\mp.oradew-vscode-0.3.11\out\gulpfile.js --color true --silent true compile --env RES_TEST --file c:\cvs\resusDB\packages\RD_POI-body.SQL <
Success => RESUS@RES_TEST $c:\cvs\resusDB\packages\RD_POI-body.SQL
Das Terminal wird von Aufgaben wiederverwendet, drücken Sie zum Schließen eine beliebige Taste.
from oradew-vscode.
What kind of error do you expect?
Can you send me a peace of code so I can reproduce?
Thanks a lot.
from oradew-vscode.
Take this one:
CREATE OR REPLACE PACKAGE test_oradew AS
FUNCTION incorrect (n NUMBER)
RETURN VARCHAR22;
END test_oradew;
/
The answer is
> Executing task: C:\Program Files\nodejs\node.exe c:\Users\Truetken-H\.vscode\extensions\mp.oradew-vscode-0.3.11\node_modules\gulp\bin\gulp.js --cwd c:\cvs\resusDB --gulpfile c:\Users\Truetken-H\.vscode\extensions\mp.oradew-vscode-0.3.11\out\gulpfile.js --color true --silent true compile --env RES_TEST --file c:\cvs\resusDB\packages\test_oradew.sql <
Success => RESUS@RES_TEST $c:\cvs\resusDB\packages\test_oradew.sql
Das Terminal wird von Aufgaben wiederverwendet, drücken Sie zum Schließen eine beliebige Taste.
When I execute the following statement:
select name,type,line,position,text,attribute,message_number from user_errors
order by 1,2,3
I get this:
NAME TYPE LINE POSITION TEXT ATTRIBUTE MESSAGE_NUMBER
------------ -------- ---- -------- ---------------------------------------- --------- --------------
TEST_ORADEW PACKAGE 2 2 PL/SQL: Declaration ignored ERROR 0
TEST_ORADEW PACKAGE 3 9 PLS-00201: identifier 'VARCHAR22' must ERROR 201
be declared
from oradew-vscode.
btw.: I'm working with Windows 10, the database ist Oracle 11g and sqlcl in Version 19.2.0.
May be interesting: When I work directly with sqlcl, I get
java.io.UnsupportedEncodingException: WE8MSWIN1252
for any Select-Statement until I do the following:
set encoding ibm852
from oradew-vscode.
I think the problem is that you have to put your package into correct file structure, as Oradew gets from file structure object information to then query from errors:
./src/RESUS/PACKAGES/TEST_ORADEW.sql
would be a correct one in your case.
If you run it outside of SRC structure, you can run it with "Run Current File as Script" (F5) and see errors from SqlPlus, but they are not parsed as Problems...
from oradew-vscode.
Yeah, this works. But I'm not satisfied, because we have another directory structure in git.
We use the following structure:
- ./packages/{object-name}-spec.sql für Package-Specifications
- ./packages/{object-name}-body.sql für Package-Bodies
- ./trigger/{object-name}-trigger.sql für Triggers
- ./views/{object-name}-view.sql für Views
Currently we don't have any more objecttypes in git.
We use just one database-schema, so we don't need the schema-name.
We don't use the schema name in our database-scripts, so the syntax always is
CREATE OR REPLACE {object-type} {object-name} AS ...
instead of
CREATE OR REPLACE {object-type} "{schema-name}"."{object-name}" AS ...
Is it possible to define such a structure by configuration?
from oradew-vscode.
Hey, thanks for your feedback.
- If you have only one schema in your project, you can ommit schema directory from structure. It will work.
- Unnused directories (objecttypes) can be removed as well.
- Ommiting schema name in object code is also not a problem when compiling.
- Custom structure and object-file name is a problem right now. but something could be done to make it configurable as you suggest...
Any ideas on how to make this object-structure mapping configurable ?
from oradew-vscode.
you might add following to ensure that the object-name is part of the pattern:
"pattern" : "([\w_.-](\{schema-name\})?[\w_.-]/)+[\w_.-]\{object-name\}[\w_.-]"
from oradew-vscode.
Great suggestion!
Could we use regex to extract "schema-name", "object-type" and "object-name" from file path based on configured pattern?
We have this function that extracts object info from path:
oradew-vscode/src/common/utility.js
Line 41 in 01f5582
that should be modified to use "source.patterns".
from oradew-vscode.
Oooh, sorry, I'm no javascript geek.
But I will try ;-)
// something like this may be used to get the object-typ to a filename
let mapObjectTypeToPattern = {
"PACKAGE" : source.pattern.package-spec.pattern,
"PACKAGE BODY" : source.pattern.package-body.pattern,
"TRIGGER" : source.pattern.trigger.pattern,
"TYPE" : source.pattern.type-spec.pattern,
"TYPE BODY" : source.pattern.type-body.pattern,
"VIEW" : source.pattern.view.pattern,
"FUNCTION" : source.pattern.function.pattern,
"PROCEDURE" : source.pattern.procedure.pattern
};
const invertPattern = obj => val => {
for (let key in obj) {
if (obj[key].match(val) )
return key;
}
};
From now it get's really difficult. Maybe you can use something like the split-function for patterns.
I will try to look for something like that later ...
from oradew-vscode.
I got an idea. First you switch the pattern ton another pattern:
altPattern = new RegExp ('^(' + replace (source.pattern, '{object-name}', '|') + ')$';)
So, if source.pattern
is "package/{object-name}-spec.sql", altPattern
should be "^(package/|-spec.sql$)"
Now you can do somehing like this:
objectName = fileName.replace (altPattern);
Ok?
from oradew-vscode.
Could we just add regex to "source.pattern" and then use this pattern to extract data from filepath.
For example:
We have filepath: "./src/RESUS/PACKAGES/TEST_ORADEW.sql", is it possible to write a regex with groups that would extract "RESUS", "PACKAGES" and "TEST_ORADEW"?
Thanks for your help, @true-hb.
from oradew-vscode.
Sorry, I'm not sure if not know what you mean.
If you have
filepath="./src/RESUS/PACKAGES/TEST_ORADEW.sql";
with
var regex=new RegExp('\w+');
var match=regex.exec (filepath);
you should get an array with ["src","RESUS","PACKAGES","TEST_ORADEW","sql"]
Is that what you need?
Sorry again, my javascript is not so good ;-)
from oradew-vscode.
I got an idea. First you switch the pattern ton another pattern:
altPattern = new RegExp ('^(' + replace (source.pattern, '{object-name}', '|') + ')$';)
So, ifsource.pattern
is "package/{object-name}-spec.sql",altPattern
should be "^(package/|-spec.sql$)"
Now you can do somehing like this:
objectName = fileName.replace (altPattern);
Ok?
This does not work with a path lile "./src/{schema-name}/PACKAGES/{object-name}.sql".
The path has to be "src/{schema-name}/PACKAGES/{object-name}.sql" (without ./ at the beginning).
from oradew-vscode.
What about using globs to match object-type from path?
Convert all patterns to:
"./src/*/FUNCTIONS/*.sql"
"./src/*/PROCEDURES/*.sql"
....
etc. and then try to match those with actual file path:
"./src/RESUS/FUNCTIONS/my-object.sql" for example.
When a match is found we get the object-type.
Then extract object-name etc as you suggest....
from oradew-vscode.
this looks like a good idea to me!
from oradew-vscode.
@true-hb , I released 0.3.12 with "source.pattern" configuration.
from oradew-vscode.
Related Issues (20)
- Run as Script hangs for a few minutes HOT 3
- Windows econding UTF8 problem HOT 42
- Compile error "ERROR ORA-06550: line 3, column 40:" HOT 8
- problems importing packages from the DB HOT 3
- Terminal output problem matcher HOT 26
- Generate: "output" doesn't work
- Extension causes high cpu load HOT 1
- Encoding error when importing the selected object HOT 8
- Displaying umlauts in terminal output
- Encoding problem in SQL-Statements HOT 3
- dbms_metadata.get_ddl does not work when used in UTL_GENERATE_ORADEW HOT 3
- Initialize Workspace not working HOT 8
- Oracle wallet authentication compatibility, userless & passwordless HOT 9
- Error while trying to retrieve text for error ORA-01804 HOT 5
- Drop support for sqlplus, sqlcl Liquibase ci/cd HOT 8
- Support latest version of node HOT 6
- Generating a source from a database HOT 5
- Create source from a non-DEV env
- Problem importing when object has "SQL" in the name HOT 1
- problems connecting to oracle database (proxy authentication) HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from oradew-vscode.