var xsds = $.sap.hana.xs.libs.dbutils.xsds;
var Post = XSDS.$importEntity(...)
const XSDS = $.sap.hana.xs.libs.dbutils.xsds;
var Post = XSDS.$importEntity(...)
const XSDS = $.import("sap.hana.xs.libs.dbutils", "xsds");
const XSDS_GEN = $.import("sap.hana.xs.libs.dbutils", "xsds_gen");
namespace com.sap.test.something;
@Schema: 'Vlad'
context someContext {
@Catalog.tableType : #COLUMN
Entity MyEntry {
...
}
}
function generateEntity(cdsNamespace, cdsName, fields, options) { }
$.response.status = $.net.http.OK;
// you can use text/plain to get the formatted output, however
// application/javascript is a correct Content-Type value.
$.response.contentType = "application/javascript";
$.response.setBody(XSDS_GEN.generateEntity("com.sap.test.something",
"someContext.MyEntry"));
Found the following errors:
===========================
InternalError: dberror(Connection.prepareStatement): 259 - invalid table name: Could not find table/view com.sap.test.something::MyEntry in schema Vlad: line 1 col 21 (at pos 20) (line 76 position 1 in /sap/hana/xs/libs/dbutils/xsds.xsjslib)
Error: XSDS: register: duplicate entity: com.sap.test.something::someContext.MyEntry (line 33 position 1 in enerateEntity@/sap/hana/xs/libs/dbutils/xsds_gen.xsjsli)
if ($.request.method === $.net.http.GET) {
const action = $.request.parameters.get("action");
if (action === "gensrc") {
// . . . . . . .
$.response.setBody(XSDS_GEN.generateEntity("com.sap.test.something",
"someContext.MyEntry"));
} else {
const MyEntry = XSDS.$importEntity("com.sap.test.something",
"someContext.MyEntry");
// . . . . . . .
}
}
let test1 = new MyEntry();
test1.$save();
$.response.setBody("ok");
<static> Entity#$save() → {boolean}
Entity.prototype.$save = function(tx) { ... }
test1.$save(); // no argument, no return.
Entity MyEntry {
...
success: Boolean default FALSE;
startDate: UTCDateTime default CURRENT_TIMESTAMP;
};
INSERT INTO "PUBLIC"."test.cds::myContext.MyEntry" ("id") VALUES (23)
17:47:44 (SQL Editor) Statement 'INSERT INTO "PUBLIC"."test.cds::myContext.MyEntry" ("id") VALUES (23)'
successfully executed in 5 ms - Rows Affected: 1
INSERT INTO "test.cds::myContext.MyEntry" ("startDate", "success", "quantity", "name", "id") VALUES (?, ?, ?, ?, ?)
INSERT INTO "PUBLIC"."test.cds::myContext.MyEntry" ("id", "startDate") VALUES(24, NULL);
Entity MyEntry {
...
success: Boolean;
};
const MyEntry = XSDS.$importEntity("...", "...", {
success: {
$init: false
}
});
let test1 = new MyEntry();
test1.$save();
...
success: {
$init: function() { return false; }
}
...
Error: PreparedStatement.setString: expected string for second argument, but got: boolean (line 1291 position 1 in /sap/hana/xs/libs/dbutils/xsds_queries.xsjslib)
context myContext {
Entity MyEntry {
...
success: Boolean default FALSE;
};
};
const MyEntry = XSDS.$importEntity("test.cds", "myContext.MyEntry", {
id: {
$key: '"test.cds::sample_sequence"'
},
success: {
$init: "true"
}
});
let test1 = new MyEntry();
test1.$save();
// test1.success = false; // uncomment me to break
// test1.success = "false"; // uncomment me to fix
test1.$save();
$.response.setBody(test1.id + " - " + test1.success + ", type: " + typeof(test1.success));
Error: PreparedStatement.setString: expected string for second argument, but got: boolean
42 - false, type: string
null
Defines if an entity element can (null) or cannot (not null) have the value NULL. If neither null nor not null is specified for the element, the default value null applies (except for the key element).
entity Token {
...
owner: String(7);
...
};
function createToken() {
const token = new TokenEntity({
owner: null
});
token.$save();
// ... other things, e.g. check the result from $save()
}
Error: PreparedStatement.setNString: expected string for second argument, but got: null
_setParam@/sap/hana/xs/libs/dbutils/xsds_queries.xsjslib:1267
executePlain@/sap/hana/xs/libs/dbutils/xsds_queries.xsjslib:1334
executeAndPreFormat@/sap/hana/xs/libs/dbutils/xsds_queries.xsjslib:1371
execute@/sap/hana/xs/libs/dbutils/xsds_queries.xsjslib:1673
Manager.put@/sap/hana/xs/libs/dbutils/xsds.xsjslib:1570
Entities.makeEntity/Entity.prototype.$save@/sap/hana/xs/libs/dbutils/xsds.xsjslib:707
createToken@/somewhere/somehow/token.xsjs:xxx
const token = new TokenEntity({
// owner: null
});
function _setParam(pstmt, type, index, value) {
if (typeof value === "undefined") {
pstmt.setNull(index); // undefined => NULL
return;
}
switch (type) {
// ...
case $.db.types.SHORTTEXT:
pstmt.setNString(index, value);
break;
const token = new TokenEntity({
owner: undefined
});
schema= "VLAD";
depends_on=["test::myContext.MyEntry"];
const MyEntry = XSDS.$importEntity("test.cds", "myContext.MyEntry", {
id: {
$key: "test.cds::sample_sequence"
}
});
InternalError: dberror(Connection.prepareStatement): 257 - sql syntax error: incorrect syntax near "::sample_sequence": line 1 col 13 (at pos 13)
1327: var stmt = conn.prepareStatement(sqlString);
sqlString = 'SELECT test.cds::sample_sequence.NEXTVAL AS "NEXTVAL" FROM DUMMY "0"'
14:08:41 (SQL Editor) Could not execute 'SELECT test.cds::sample_sequence.NEXTVAL AS "NEXTVAL" FROM DUMMY "0"'
Error: (dberror) 257 - sql syntax error: incorrect syntax near "::sample_sequence": line 1 col 12 (at pos 13
SELECT "test.cds::sample_sequence".NEXTVAL AS "NEXTVAL" FROM DUMMY "0"
const MyEntry = XSDS.$importEntity("test.cds", "myContext.MyEntry", {
id: {
$key: "\"test.cds::sample_sequence\""
}
});
schema="xxx";
query = "SELECT s1.\"siteId\", ... ,
ROW_NUMBER() OVER (PARTITION BY \"siteId\", ...) AS \"rowNumber\"
FROM \"com.xxx.cds::someView\"";
depends_on=["com.xxx.cds::someView"];
[11:41:15] File /myapp/myappodata.hdbrole saved successfully.
[11:41:15] Error while activating /myapp/myappodata.hdbrole:[myapp:myappodata.hdbrole] insufficient privilege: Not authorized at /sapmnt/ld7272/a/HDB/jenkins_prod/workspace/8uyiojyvla/s/ptime/query/checker/query_check.cc:4003
ALTER SYSTEM ALTER CONFIGURATION('indexserver.ini','SYSTEM') SET ('trace','authorization') = 'info' WITH RECONFIGURE;
ALTER SYSTEM ALTER CONFIGURATION('indexserver.ini','SYSTEM') UNSET ('trace','authorization') WITH RECONFIGURE;
SELECT to_varchar(TIMESTAMP,'YYYY-MM-DD HH24:MI:SS') TIMESTAMP,
host ,
trace_level ,
component ,
user_name ,
application_user_name ,
service_name ,
trace_file_name ,
trace_text
FROM M_MERGED_TRACES
WHERE (LOWER(trace_text) LIKE '%auth%'
OR component = 'Authorization')
AND TIMESTAMP > ADD_SECONDS(NOW(), -3600)
ORDER BY TIMESTAMP DESC;
TIMESTAMP | HOST | TRACE_LEVEL | COMPONENT | USER_NAME | APPLICATION_USER_NAME | SERVICE_NAME | TRACE_FILE_NAME | TRACE_TEXT |
07.11.2018 16:44:50 | somewhere-in-cloud.od.sap.biz | Error | REPOSITORY | VLAD | VLAD | indexserver | indexserver_somewhere-in-cloud.od.sap.biz.30003.633.trc | Activator::activateObjects: Activation 11875 completed with errors. Session error: Repository: Activation failed for at least one object;At least one error was encountered during activation. Please see the CheckResult information for detailed information about the root cause. No objects have been activated.(40136) Check results with severity "error": (ERROR, error code: 258, error message: insufficient privilege: Not authorized at /sapmnt/ld7272/a/HDB/jenkins_prod/workspace/8uyiojyvla/s/ptime/query/checker/query_check.cc:4003, object: {tenant: , package: myapp, name: myappodata, suffix: hdbrole}, location: , time stamp: 2018-11-07,16:44:50.282, unformatted error message: insufficient privilege: Not authorized at /sapmnt/ld7272/a/HDB/jenkins_prod/workspace/8uyiojyvla/s/ptime/query/checker/query_check.cc:4003) |
07.11.2018 16:44:50 | somewhere-in-cloud.od.sap.biz | Error | REPOSITORY | VLAD | VLAD | indexserver | indexserver_somewhere-in-cloud.od.sap.biz.30003.633.trc | activateObjectsInternalFast2: ActivationID 11875, activation phase: Runtime Role runtime reported an error. Session error: insufficient privilege: Not authorized at /sapmnt/ld7272/a/HDB/jenkins_prod/workspace/8uyiojyvla/s/ptime/query/checker/query_check.cc:4003(258) Check results with severity "error": (ERROR, error code: 258, error message: insufficient privilege: Not authorized at /sapmnt/ld7272/a/HDB/jenkins_prod/workspace/8uyiojyvla/s/ptime/query/checker/query_check.cc:4003, object: {tenant: , package: myapp, name: myappodata, suffix: hdbrole}, location: , time stamp: 2018-11-07,16:44:50.282, unformatted error message: insufficient privilege: Not authorized at /sapmnt/ld7272/a/HDB/jenkins_prod/workspace/8uyiojyvla/s/ptime/query/checker/query_check.cc:4003) |
07.11.2018 16:44:50 | somewhere-in-cloud.od.sap.biz | Info | Authorization | VLAD | VLAD | indexserver | indexserver_somewhere-in-cloud.od.sap.biz.30003.633.trc | User _SYS_REPO tried to execute 'GRANT INSERT ON "MYAPP"."myapp::TBL" TO "myapp::myappodata"' [23288]{361853}[137/162689914] 2018-11-07 16:44:50.282666 e RoleRuntime RoleRuntime.cpp(00130) : activationID 11875: Granting SQL privilege INSERT on "MYAPP"."myapp::TBL" failed {tenant: , package: myapp, name: myappodata, suffix: hdbrole}: [258] insufficient privilege: Not authorized at /sapmnt/ld7272/a/HDB/jenkins_prod/workspace/8uyiojyvla/s/ptime/query/checker/query_check.cc:4003 |
07.11.2018 16:44:50 | somewhere-in-cloud.od.sap.biz | Info | Authorization | VLAD | VLAD | indexserver | indexserver_somewhere-in-cloud.od.sap.biz.30003.633.trc | User _SYS_REPO is not allowed to grant privilege INSERT for TABLE MYAPP.myapp::TBL |
07.11.2018 16:44:50 | somewhere-in-cloud.od.sap.biz | Info | SQLSessionCmd | VLAD | VLAD | indexserver | indexserver_somewhere-in-cloud.od.sap.biz.30003.633.trc | INI configuration is changed by 361748, client ip=72.66.114.13, client port=13380, query=alter system alter configuration ('indexserver.ini','SYSTEM') SET ('trace','authorization')='info' with reconfigure |
07.11.2018 16:44:50 | somewhere-in-cloud.od.sap.biz | Error | REPOSITORY | VLAD | VLAD | indexserver | indexserver_somewhere-in-cloud.od.sap.biz.30003.633.trc | Activator::activateObjects: Activation 11874 completed with errors. Session error: Repository: Activation failed for at least one object;At least one error was encountered during activation. Please see the CheckResult information for detailed information about the root cause. No objects have been activated.(40136) Check results with severity "error": (ERROR, error code: 258, error message: insufficient privilege: Not authorized at /sapmnt/ld7272/a/HDB/jenkins_prod/workspace/8uyiojyvla/s/ptime/query/checker/query_check.cc:4003, object: {tenant: , package: myapp, name: myappodata, suffix: hdbrole}, location: , time stamp: 2018-11-07,16:43:50.233, unformatted error message: insufficient privilege: Not authorized at /sapmnt/ld7272/a/HDB/jenkins_prod/workspace/8uyiojyvla/s/ptime/query/checker/query_check.cc:4003) |
07.11.2018 16:44:50 | somewhere-in-cloud.od.sap.biz | Error | REPOSITORY | VLAD | VLAD | indexserver | indexserver_somewhere-in-cloud.od.sap.biz.30003.633.trc | activateObjectsInternalFast2: ActivationID 11874, activation phase: Runtime Role runtime reported an error. Session error: insufficient privilege: Not authorized at /sapmnt/ld7272/a/HDB/jenkins_prod/workspace/8uyiojyvla/s/ptime/query/checker/query_check.cc:4003(258) Check results with severity "error": (ERROR, error code: 258, error message: insufficient privilege: Not authorized at /sapmnt/ld7272/a/HDB/jenkins_prod/workspace/8uyiojyvla/s/ptime/query/checker/query_check.cc:4003, object: {tenant: , package: myapp, name: myappodata, suffix: hdbrole}, location: , time stamp: 2018-11-07,16:43:50.233, unformatted error message: insufficient privilege: Not authorized at /sapmnt/ld7272/a/HDB/jenkins_prod/workspace/8uyiojyvla/s/ptime/query/checker/query_check.cc:4003) |
07.11.2018 16:44:50 | somewhere-in-cloud.od.sap.biz | Info | TraceContext | VLAD | VLAD | indexserver | indexserver_somewhere-in-cloud.od.sap.biz.30003.633.trc | UserName=VLAD, ApplicationUserName=VLAD, ApplicationName=HDBStudio, ApplicationSource=csns.dwb.core.internal.connectionpool.jdbc.ConnectionHandle.createConnection(ConnectionHandle.java:111);csns.dwb.core.internal.connectionpool.jdbc.JdbcPooledConnection.doEnsureConnected(JdbcPooledConnection.java:58);csns.dwb.core.internal.connectionpool.PooledConnection.ensureConnected(PooledConnection.java:184);csns.dwb.core.internal.connectionpool.ConnectionPool.getConnection(ConnectionPool.java:117);csns.dwb.core.internal.connectionpool.ConnectionManager.getConnection(ConnectionManager.java:87);csns.dwb, StatementHash=ce0d9cedb9b4a0194dd551c7f06c22ad [23288]{361853}[137/162689831] 2018-11-07 16:43:50.233279 e RoleRuntime RoleRuntime.cpp(00130) : activationID 11874: Granting SQL privilege INSERT on "MYAPP"."myapp::TBL" failed {tenant: , package: myapp, name: myappodata, suffix: hdbrole}: [258] insufficient privilege: Not authorized at /sapmnt/ld7272/a/HDB/jenkins_prod/workspace/8uyiojyvla/s/ptime/query/check |
07.11.2018 16:39:28 | somewhere-in-cloud.od.sap.biz | Info | SQLSessionCmd | VLAD | VLAD | indexserver | indexserver_somewhere-in-cloud.od.sap.biz.30003.633.trc | INI configuration is changed by 361748, client ip=8.8.8.8, client port=13380, query=alter system alter configuration ('indexserver.ini','SYSTEM') UNSET ('trace','authorization') with reconfigure |
GRANT INSERT ON SCHEMA "MYAPP" TO _SYS_REPO WITH GRANT OPTION;
SELECT * FROM SCHEMAS ORDER BY SCHEMA_NAME;
SCHEMA_NAME | SCHEMA_OWNER | HAS_PRIVILEGES |
... | ... | ... |
MYAPP | VLAD | TRUE |
... | ... | ... |
SELECT * FROM "_SYS_BIC"."myapp/TEST";
[16:01:44] (Data Preview) Could not open '_SYS_BIC'.'myapp/TEST'.
Error: (dberror) 258 - SQL error, server error code: 258. insufficient privilege: [2950] user is not authorized :
[16:07:46] (SQL Editor) Could not execute 'SELECT * FROM "_SYS_BIC"."myapp/TEST"'
Error: (dberror) 258 - SQL error, server error code: 258. insufficient privilege: [2950] user is not authorized :
TIMESTAMP | HOST | TRACE_LEVEL | COMPONENT | USER_NAME | APPLICATION_USER_NAME | SERVICE_NAME | TRACE_FILE_NAME | TRACE_TEXT |
2018-11-21 15:08:55 | myserver.corp | Error | xsa:sap.hana.ide | VLAD | VLAD | xsengine | xsengine_myserver.corp.30007.489.trc | remote.xsjslib::_sqlSelect: Error executing Query: InternalError: dberror($.hdb.Connection.executeQuery): 258 - SQL error, server error code: 258. insufficient privilege: [2950] user is not authorized : at calculationEngine/ceController2.cpp:1199 |
2018-11-21 15:08:55 | myserver.corp | Error | SqlOpt_ceqo | VLAD | VLAD | indexserver | indexserver_myserver.30003.720.trc | Ptime Exception: insufficient privilege: [2950] user is not authorized : occurred while unfolding _SYS_BIC:myapp/TEST |
2018-11-21 15:08:55 | myserver.corp | Info | Authorization | VLAD | VLAD | indexserver | indexserver_myserver.30003.720.trc | Authorization error: User VLAD is missing analytic privileges in order to access _SYS_BIC:myapp/TEST; AP _SYS_BI_CP_ALL was not granted |
2018-11-21 15:08:55 | myserver.corp | Info | Authorization | VLAD | VLAD | indexserver | indexserver_myserver.30003.720.trc | AuthorizationCheckHandler::isAuthorizedToSelect (AP check): (Original) User VLAD is not authorized on HVC::_SYS_BIC:myapp/TEST (t -1) due to XmlAP check |
This role contains all the privileges required for using the information modeler in the SAP HANA studio.
It therefore provides a modeler with the database authorization required to create all kinds of views and analytic privileges.
The MODELING role contains the predefined analytic privilege _SYS_BI_CP_ALL.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
18 | |
11 | |
10 | |
9 | |
9 | |
7 | |
7 | |
5 | |
5 | |
5 |