how to do a a dql, that fetch r_object_id and lifecycle statye of document - documentum

I need a dql, that fetch r_object_id and lifecycle statye of document
something like below :
select d.r_object_id, p.state_name from dm+document d, dm_policy p where object_name ='text.docx' and ....
I am unable articulste exact where clause. Experts please help
Thanks

This is DQL for something you would like:
SELECT r_policy_id, r_current_state, r_resume_state
FROM dm_document
WHERE object_name like 'LoanApp_%'
from https://www.oreilly.com/library/view/documentum-65-content/9781849680226/ch13s08.html
Of course, adjust WHERE clause to your needs.

Related

PostgreSQL 10 Rowtype Bug in Function?

I declare inside a function the following:
SEL_USER APP.USER % ROWTYPE;
Then i made the select
Working perfectly:
SELECT *
INTO SEL_USER
FROM APP.USER
WHERE ...
But this isn't working and i don't know the reason.
Maybe a postgresql bug?
SELECT USER_ID, OFFICE_FK, LOCKER, EMAIL, FULL_NAME, SURNAME1
SURNAME2, SOCIAL_CARD, BIRTHDATE, PREFERENCES
INTO SEL_USER
FROM APP.USER
WHERE ...
To clarify:
Where statement are the same and it works.
There is no error of fields because if I do the select without the into it works.
what happened?
It's changing the fields, example:
locker_id is assigned the value of social_card (I verify that the values ​​are where they should go)
some fields are null (which is not possible because they are declared as not null)
Is it a postgresql 10 bug or am I doing something wrong?
In case I'm doing something bad I would appreciate it if you would help me.
(forgive my english)
Sincerely I do not know why it only gave me problems in that function,
maybe it was some context problem, because in others it did not matter the order or if any column was missing.
Fix it by putting in order and using 'as'
SELECT U.USER_ID, U.OFFICE_FK, U.LOCKER, U.SOCIAL_CARD, U.EMAIL,
U.FULL_NAME, U.SURNAME1, U.SURNAME2, U.BIRTHDATE, U.PREFERENCES
INTO SEL_USER
FROM APP.USER AS U
WHERE ...;
Thanks for your time :)

MongoDB equivalent for select "of" select?

I would like to know what is the best way to translate a SQL query like:
select * from table where id in(
Select id from table where field1="titi" )
For the moment I get a two steps query:
CALLMATCH = db.appels.find({"EVENTDATA": /.*442251434*./} , {CALLID: 1});
db.appels.find({"CALLID": {$in: CALLMATCH} } );
Is there a better way to perform this kind of query?
And a second question is how to display the result in a file? (since it is not very pratical to check the result through the cmd console...)
In advance thank you for your feedback!
Regards,
Fabien.
Mongo does not support joins so you have to do two queries.
In order to save the result set to a file you can simply redirect the output to a file such as this:
mongo [script] > output_file.txt
where script is a file with your queries ending with .js

Doctrine, escape variable field name in DQL

I have a DQL query like:
$em->createQuery("
SELECT r
FROM WeAdminBundle:FamilyRelation r
WHERE r.col like :query
")
Now I want to change "col" depending on various parameters. How can i achieve this with DQL since the normal setParameter doesn't work here.
You can use setParameter with DQL, as many examples are provided but for LIKE clauses, make sure the variable is wrapped in %.
$em->createQuery("
SELECT r
FROM WeAdminBundle:FamilyRelation r
WHERE r.col like :query
")->setParameters(array(
'query' => '%'.$foo.'%'
))
In short: you can't the way you want it.
To do it you'd need something like $dql->setColumn(array('variable_column' => 'some_column_name')) just as the bindColumn method from PDO, but there's no equivalent method (bindColum or setcolumn) in Doctrine.
For use of different parameter instead of col please see below example:
$var = "r.col";
Here you can change based on condition.
$em->createQuery("
SELECT r
FROM WeAdminBundle:FamilyRelation r
WHERE ".$var." like :query
")
please have a look it.

Solr, select where in select

I'm trying to do a query with a select in another.
I would like to do something like:
select?q=*:* AND id_user=5&fl=id_other
select?q=test AND -id(the result of the other select)&fl=id
So:
select?q=test AND -id(select?q=* AND id_user=5&fl=id_other)&fl=id
Is it possible? Or I have to do two separates selects?
$ids = select?q=*:* AND id_user=5&fl=id_other
$result = select?q=test AND -id(implode(' AND ', $ids))&fl=id
Thanks!
There is a nested query support in Solr. You can _query_ parameter to embed query into another. Check this tutorial for more information.

How to put this Query into Linq (C#)?

I'm able to do:
var codeStation = from Code in ent.Role
where Code.Code.StartsWith("S_")
select Code;
(ent: being my Entity for my Database)
That gives me :
S_ANC
S_ATL
S_BNA
S_BOS
S_BRU
S_CLT
.....
S_YXE
S_YXY
S_YYC
S_YYG
S_YYT
S_YYZ
How can I accomplish the equivalent of the following SQL query?
SELECT Substring(Codes,3,6)
FROM Role
WHERE Codes LIKE 'S%'
Thanks!
var codeStation = from Code in ent.Role
where Code.Code.StartsWith("S_")
select RoleName.Substring(3,6);
Your LINQ query can select any legal C# expression you want, including method calls on the field names. So, you can do something like this:
var codeStation = from Code in ent.Role
where Code.Code.StartsWith("S_")
select Code.RoleName.SubString(3,6);