mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-08-25 14:22:54 -06:00
SqlCtrl: developing SqlConsole
git-svn-id: svn://ultimatepp.org/upp/trunk@8133 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
0fb04b603a
commit
ff6193a4fa
2 changed files with 103 additions and 44 deletions
|
|
@ -278,11 +278,12 @@ void SqlConsole::Execute(int type) {
|
|||
list.Add(row);
|
||||
if(pi.StepCanceled()) break;
|
||||
}
|
||||
if(cursor.GetColumns() && cursor.WasError()) {
|
||||
if(cw.GetCount() && cursor.WasError()) {
|
||||
list.Reset();
|
||||
goto error;
|
||||
}
|
||||
visible.SetCount(cursor.GetColumns(), true);
|
||||
DDUMP(cursor.GetColumns());
|
||||
visible.SetCount(cw.GetCount(), true);
|
||||
ColSize();
|
||||
if(list.GetCount() > 0)
|
||||
list.SetCursor(0);
|
||||
|
|
@ -304,6 +305,8 @@ void SqlConsole::Execute(int type) {
|
|||
void SqlConsole::ColSize() {
|
||||
int maxw = 18 * StdFont().Info().GetAveWidth();
|
||||
int wx = 0;
|
||||
DUMP(visible);
|
||||
DUMP(cw);
|
||||
for(int i = 0; i < cursor.GetColumns(); i++)
|
||||
if(visible[i]) {
|
||||
int w = min(maxw, cw[i]);
|
||||
|
|
@ -363,15 +366,15 @@ void SqlConsole::Serialize(Stream& s) {
|
|||
|
||||
void SqlConsole::Perform() {
|
||||
const char cfg[] = "SqlConsole.cfg";
|
||||
LoadFromFile(*this, cfg);
|
||||
// LoadFromFile(*this, cfg);
|
||||
Title(t_("SQL Commander"));
|
||||
Icon(SqlConsoleImg::SqlConsoleIconSmall(), SqlConsoleImg::SqlConsoleIconLarge());
|
||||
Icon(SqlConsoleImg::database_edit(), SqlConsoleImg::SqlConsoleIconLarge());
|
||||
Sizeable();
|
||||
Zoomable();
|
||||
ActiveFocus(command);
|
||||
Run();
|
||||
cursor.ClearError();
|
||||
StoreToFile(*this, cfg);
|
||||
// StoreToFile(*this, cfg);
|
||||
}
|
||||
|
||||
void SqlConsole::TraceToCommand() {
|
||||
|
|
@ -550,6 +553,9 @@ SqlConsole::SqlConsole(SqlSession& session)
|
|||
errortext.Hide();
|
||||
vsplit.Vert(lires, trace);
|
||||
vsplit.Add(command_pane);
|
||||
vsplit.SetPos(6500);
|
||||
vsplit.SetPos(8500, 1);
|
||||
lires.SetPos(7000);
|
||||
record.AddColumn(t_("Column"), 5);
|
||||
record.AddColumn(t_("Value"), 10);
|
||||
record.WhenLeftDouble = THISBACK(ViewRecord);
|
||||
|
|
@ -565,16 +571,17 @@ SqlConsole::SqlConsole(SqlSession& session)
|
|||
list.HeaderObject().Absolute();
|
||||
Add(vsplit.SizePos());
|
||||
command.SetFont(Courier(GetStdFontCy()));
|
||||
command_pane.Add(command.VSizePos().HSizePos(0, HorzLayoutZoom(90)));
|
||||
command_pane.Add(command.VSizePos().HSizePos(0, HorzLayoutZoom(100)));
|
||||
ecy = max(24, ecy);
|
||||
command_pane.Add(execute.TopPos(0, ecy).RightPos(4, HorzLayoutZoom(80)));
|
||||
command_pane.Add(schema.TopPos(ecy + 4, ecy).RightPos(4, HorzLayoutZoom(80)));
|
||||
command_pane.Add(execute.TopPos(0, ecy).RightPos(4, HorzLayoutZoom(90)));
|
||||
command_pane.Add(schema.TopPos(ecy + 4, ecy).RightPos(4, HorzLayoutZoom(90)));
|
||||
command.Highlight("sql");
|
||||
schema.SetLabel(t_("&Schema"));
|
||||
schema <<= THISBACK(ObjectTree);
|
||||
schema.SetImage(SqlConsoleImg::bricks());
|
||||
execute <<= THISBACK1(Execute, NORMAL);
|
||||
execute.SetImage(SqlConsoleImg::Go());
|
||||
execute.SetLabel(t_("Execute"));
|
||||
execute.SetImage(SqlConsoleImg::lightning());
|
||||
execute.SetLabel(t_("Execute (F5)"));
|
||||
ActiveFocus(command);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue