How to utilize Oracle query hint on QSqlQuery?

There is a ascending default index on column “wimindex”. I want to retrieve just recent one using oracle hint like below. But it seems that Oracle query hint doesn’t work. Of course this query is working well on Oracle sql/plus. Just QT QSqlQuery doesn’t work. Would you help me ? or any hint?

Below is my code. thanks…

QString lastWimIdxQuery = “SELECT **/*+ index_rs_desc(VIOLATE, VIOLATE) */**  WIMINDEX FROMVIOLATE WHERE wimindex > 0 and rownum =1”;
int fieldNo = query.record().indexOf(“WIMINDEX”); 
if( { 
this->m_lastWimIdx = query.value(fieldNo).toInt();
 qDebug()<<this->m_thread_name << “ : “ << this->m_lastWimIdx; 
}else { return; } 


Seems that QT is perhaps eating the comment/hint and not passing it to the database? Create a view in the database using your query and select from that to confirm this hypothesis:

SELECT **/*+ index_rs_desc(VIOLATE, VIOLATE) */**  WIMINDEX 
 WHERE wimindex > 0 and rownum =1;

Then use that view in your code:

QString lastWimIdxQuery = "SELECT wmindex FROM LastWMIdxView";

Alternatively, you could run your query as is and check the v$sql view to see what was parsed:

SELECT sql_text
  FROm v$sql

If it turns out that the comments are being eaten, unless there's a way to control that in QT I think you'll probably have to use the view as outlined above.

Need Your Help

Deobfuscating some PHP code

php deobfuscation

I'm trying to deobfuscate this PHP code:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.