From: <mrj...@us...> - 2010-04-25 21:14:17
|
Revision: 3517 http://tora.svn.sourceforge.net/tora/?rev=3517&view=rev Author: mrjohnson0 Date: 2010-04-25 21:14:11 +0000 (Sun, 25 Apr 2010) Log Message: ----------- small change to support table name completion Modified Paths: -------------- branches/teradata/tora/src/tohighlightedtext.cpp Modified: branches/teradata/tora/src/tohighlightedtext.cpp =================================================================== --- branches/teradata/tora/src/tohighlightedtext.cpp 2010-04-24 19:05:34 UTC (rev 3516) +++ branches/teradata/tora/src/tohighlightedtext.cpp 2010-04-25 21:14:11 UTC (rev 3517) @@ -1000,20 +1000,34 @@ try { toConnection &conn = toCurrentConnection(this); - toQDescList &desc = conn.columns(conn.realName(name, false)); - for (toQDescList::iterator i = desc.begin(); i != desc.end(); i++) + toConnection::objectName object = conn.realName(name, false); + if(object.Type == "DATABASE") { - QString t; - int ind = (*i).Name.indexOf("("); - if (ind < 0) - ind = (*i).Name.indexOf("RETURNING") - 1; //it could be a function or procedure without parameters. -1 to remove the space - if (ind >= 0) - t = conn.quote((*i).Name.mid(0, ind)) + (*i).Name.mid(ind); - else - t = conn.quote((*i).Name); - if (t.indexOf(*partial) == 0) - toReturn.append(t); + std::list<toConnection::objectName> list = conn.tables(object); + Q_FOREACH(toConnection::objectName table, list) + { + QString t = conn.quote(table.Name); + if(t.indexOf(*partial) == 0) + toReturn.append(t); + } } + else + { + toQDescList &desc = conn.columns(object); + for (toQDescList::iterator i = desc.begin(); i != desc.end(); i++) + { + QString t; + int ind = (*i).Name.indexOf("("); + if (ind < 0) + ind = (*i).Name.indexOf("RETURNING") - 1; //it could be a function or procedure without parameters. -1 to remove the space + if (ind >= 0) + t = conn.quote((*i).Name.mid(0, ind)) + (*i).Name.mid(ind); + else + t = conn.quote((*i).Name); + if (t.indexOf(*partial) == 0) + toReturn.append(t); + } + } } catch (QString e) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |