Skip to Main Content

SQL Developer

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Arbori Code : trying to identify TO_CHAR() with single parameter

Mike KutzMay 28 2019 — edited May 29 2019

I'm trying to develop some arbori code in order to highlight "bad usage of TO_DATE()"

For my first case (of "bad usage"), I'm trying to highlight all calls to TO_DATE() that have only a single parameter.  My test is currently narrowed down to a string_literal.

The first problem I ran into was "how do you identify all instances of TO_DATE?".

I can pick out one call to TO_DATE but I can't pick out all of them.  What is the correct node classification I should be using?

The second problem was trying to identify the TO_DATE as having a single parameter.  (i've simplified my Use Case to search for string_literals only)

Some how I keep screwing this one up.

Where is my logic going wrong?

Many thanks

MK

In the Arbori Editor, I've tried variations of the following:  (yes, the "->" line is missing for "highlighting code" but I'm trying to get this correct)

PlSqlCustom3:

  ?name = 'to_date'

& op^^ = node

& name^ = node

& [op) '('

& [node) function_call

--& ( [pel) paren_expr_list

--& pel^ = node

--& name+1 = pel

--& [op) '('

--& op^ = pel

--& op^^ = node )

--& op^^ = node

--& [sl) string_literal

--& [cp) ')'

--& op+1 = sl

--& sl+1 = cp

;

My test PL/SQL code:

declare

  d date;

begin

  -- identifies as a function_call

  d := to_date( '5-may-19' );

  -- identifies as a datetime_literal

  -- should not highlight (unless Arbori can identify the usage of RR)

  -- I don't think Arbori can identify string literals that contain a specific text string, but highly desired

  d := to_date( '5-may-19', 'dd-mon-rr' );

  -- identifies as user_defined_function

  select to_date( '5-may-19') into d

  from dual;

end;

This post has been answered by Vadim Tropashko-Oracle on May 29 2019
Jump to Answer

Comments

mkeith
Hi Francis,

It appears that my first reply was lost, so will re-post.

When using JMS the reconnect policy should reconnect to the topic, but only if the should-remove-connection-on-error setting in sessions.xml is false. Alternatively you can set it directly on the CacheSynchronizationManager by invoking setShouldRemoveConnectionOnError(false).

Note that for RMIJNDI cache sync the RMI Registry is not used. It may be that whatever type of object you are using does not support transparent failover so you may need to reacquire a stub (e.g. for vanilla RMI objects).

HTH,
-Mike
413051
I am already setting should-remove-connection-on-error to false. Should this make cache synchronization continue to work after the OC4J instance running the JMS server has been restarted? Here is the relevant section of my sessions.xml (for JMS):
<cache-synchronization-manager>
<clustering-service>oracle.toplink.remote.jms.JMSClusteringService</clustering-service>
<should-remove-connection-on-error>false</should-remove-connection-on-error>
<jms-topic-connection-factory-name>jms/TopicConnectionFactory</jms-topic-connection-factory-name>
<jms-topic-name>jms/TopLinkCacheSyncTopic</jms-topic-name>
</cache-synchronization-manager>

I don't really understand your last paragraph... What do I have to do to make my objects support transparent failover? All of the objects that I am using TopLink to persist are simple Serializable JavaBeans.

Francis
mkeith
Hi Francis,

It appears as if by default the reconnection policy does not reconnect, so you will have to subclass the JMSDistributedSessionReconnectPolicy clas and set it on the clustering service (e.g. clusteringService.setReconnectPolicy(new MyReconnectPolicy())). You will want to override the reconnect(RemoteConnection) method to call clusteringService.createRemoteConnection(). Note that you wil have to set the clustering service on your policy instance when you set the policy so that you can access the service from within the reconnect callback. I would also recommend setting the logging to log-debug so that you can see what is happening.

For the RMI, it looks like from your stack trace an RMI object is broken. If you are using JavaBeans then it is is not a TopLink-managed one but it won't be affected or fixed by cache sync.

-Mike
1 - 3

Post Details

Added on May 28 2019
1 comment
386 views