Changeset 34
- Timestamp:
- Nov 24, 2011, 2:06:10 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/Clients/UChronisClientMySQL.pas
r33 r34 61 61 Filter := ''; 62 62 for I := 0 to AList.ColumnsFilter.Count - 1 do 63 Filter := Filter + AList.ColumnsFilter[I] + ',';64 Delete(Filter, Length(Filter) , 1);63 Filter := Filter + '`' + AList.ColumnsFilter[I] + '`, '; 64 Delete(Filter, Length(Filter) - 1, 2); 65 65 end else Filter := '*'; 66 66 if AList.ConditionUse then Condition := '`' + AList.ConditionColumn + '` = "' + 67 67 AList.ConditionValue + '"' 68 68 else Condition := '1'; 69 Database.Select(DbRows, AList.ObjectName, Filter, Condition); 69 Database.Query(DbRows, 'SELECT ' + Filter + ' FROM `' + AList.SchemaName + '`.`' + 70 AList.ObjectName + '` WHERE ' + Condition); 70 71 AList.Objects.Clear; 71 for I := 0 to DbRows.Count - 1 do 72 for I := 0 to DbRows.Count - 1 do begin 72 73 NewObject := TObjectProxy.Create; 73 74 NewObject.Client := AList.Client; 74 75 NewObject.Properties.Assign(TDictionaryStringString(DbRows[I])); 75 76 AList.Objects.Add(NewObject); 77 end; 76 78 finally 77 79 DbRows.Free; -
trunk/Application/UChronisClient.pas
r33 r34 43 43 ConditionUse: Boolean; 44 44 ObjectName: string; 45 SchemaName: string; 45 46 Objects: TListObject; // TListObject<TObjectProxy> 47 procedure SetCondition(ColumnName: string; Value: string); 46 48 procedure Clear; 47 49 constructor Create; … … 105 107 { TListProxy } 106 108 109 procedure TListProxy.SetCondition(ColumnName: string; Value: string); 110 begin 111 ConditionColumn := ColumnName; 112 ConditionValue := Value; 113 ConditionUse := True; 114 end; 115 107 116 procedure TListProxy.Clear; 108 117 begin -
trunk/USystem.pas
r33 r34 187 187 procedure TReport.Load(Obj: TChronisObject; Filter: string = ''); 188 188 var 189 Properties: T DbRows;190 Values: T DbRows;189 Properties: TListProxy; 190 Values: TListProxy; 191 191 I: Integer; 192 192 C: Integer; … … 195 195 ColumnsQuery: string; 196 196 DataType: TDataType; 197 ProxyObj: TObjectProxy; 197 198 begin 198 199 Clear; … … 200 201 // Load column names 201 202 try 202 Properties := TDbRows.Create; 203 Base.Database.Query(Properties, 'SELECT * FROM `' + PropertyTable + 204 '` WHERE `Object`=' + IntToStr(Obj.Id)); 203 Properties := TListProxy.Create; 204 Properties.Client := Base.Client; 205 Properties.ObjectName := PropertyTable; 206 Properties.SchemaName := Base.Database.Database; 207 Properties.SetCondition('Object', IntToStr(Obj.Id)); 208 Properties.Load; 205 209 Columns.Clear; 206 210 207 for I := 0 to Properties.Count - 1 do begin 208 DataType := GetDataType(StrToInt(Properties[I].Values['CustomType'])); 211 for I := 0 to Properties.Objects.Count - 1 do begin 212 ProxyObj := TObjectProxy(Properties.Objects[I]); 213 DataType := GetDataType(StrToInt(ProxyObj.Properties.Values['CustomType'])); 209 214 NewColumn := TReportColumn.Create; 210 215 Columns.Add(NewColumn); 211 NewColumn.Caption := Pro perties[I].Values['Name'];212 NewColumn.ColumnName := Pro perties[I].Values['ColumnName'];216 NewColumn.Caption := ProxyObj.Properties.Values['Name']; 217 NewColumn.ColumnName := ProxyObj.Properties.Values['ColumnName']; 213 218 NewColumn.CustomType := DataType; 214 219 if (DataType is TDataTypeRelationMany) then NewColumn.VirtualItem := True; … … 216 221 217 222 // Load items 218 Values := T DbRows.Create;219 ColumnsQuery := '';223 Values := TListProxy.Create; 224 Values.Client := Base.Client; 220 225 for I := 0 to Columns.Count - 1 do 221 226 if not TReportColumn(Columns[I]).VirtualItem then 222 ColumnsQuery := ColumnsQuery + ', `' + TReportColumn(Columns[I]).ColumnName + '`'; 223 System.Delete(ColumnsQuery, 1, 2); 224 if Filter <> '' then Filter := ' WHERE ' + Filter; 225 Base.Database.Query(Values, 'SELECT ' + ColumnsQuery + ', `' + Obj.PrimaryKey + '` AS `SYS_PRIMARY_KEY` FROM `' + Obj.Schema + '`.`' + 226 Obj.Table + '`' + Filter); 227 for I := 0 to Values.Count - 1 do begin 227 Values.ColumnsFilter.Add(TReportColumn(Columns[I]).ColumnName); 228 Values.ColumnsFilter.Add(Obj.PrimaryKey); 229 Values.ColummsFilterUse := True; 230 Values.ObjectName := Obj.Table; 231 Values.SchemaName := Obj.Schema; 232 Values.Load; 233 234 //Base.Database.Query(Values, 'SELECT ' + ColumnsQuery + ', `' + Obj.PrimaryKey + '` AS `SYS_PRIMARY_KEY` FROM `' + Obj.Schema + '`.`' + 235 // Obj.Table + '`' + Filter); 236 for I := 0 to Values.Objects.Count - 1 do begin 237 ProxyObj := TObjectProxy(Values.Objects[I]); 228 238 NewItem := TReportLine.Create; 229 239 //NewItem.Items.Add(Values[I].Values[Obj.PrimaryKey]); 230 NewItem.Id := StrToInt( Values[I].Values['SYS_PRIMARY_KEY']);240 NewItem.Id := StrToInt(ProxyObj.Properties.Values[Obj.PrimaryKey]); 231 241 for C := 0 to Columns.Count - 1 do 232 242 if not TReportColumn(Columns[C]).VirtualItem then begin 233 NewItem.Items.Add( Values[I].Values[TReportColumn(Columns[C]).ColumnName]);243 NewItem.Items.Add(ProxyObj.Properties.Values[TReportColumn(Columns[C]).ColumnName]); 234 244 end else NewItem.Items.Add(''); 235 245 Add(NewItem); -
trunk/chronis.lpi
r33 r34 105 105 </Item6> 106 106 </RequiredPackages> 107 <Units Count=" 59">107 <Units Count="60"> 108 108 <Unit0> 109 109 <Filename Value="chronis.lpr"/> … … 266 266 <IsPartOfProject Value="True"/> 267 267 <UnitName Value="USystem"/> 268 <IsVisibleTab Value="True"/>269 268 <EditorIndex Value="8"/> 270 269 <WindowIndex Value="0"/> 271 <TopLine Value=" 190"/>272 <CursorPos X="1" Y="2 03"/>270 <TopLine Value="213"/> 271 <CursorPos X="1" Y="232"/> 273 272 <UsageCount Value="200"/> 274 273 <Loaded Value="True"/> … … 332 331 <IsPartOfProject Value="True"/> 333 332 <UnitName Value="UDataTypes"/> 334 <EditorIndex Value="9"/> 335 <WindowIndex Value="0"/> 336 <TopLine Value="5"/> 337 <CursorPos X="23" Y="20"/> 333 <WindowIndex Value="0"/> 334 <TopLine Value="126"/> 335 <CursorPos X="12" Y="139"/> 338 336 <UsageCount Value="204"/> 339 <Loaded Value="True"/>340 337 <DefaultSyntaxHighlighter Value="Delphi"/> 341 338 </Unit19> … … 364 361 <TopLine Value="149"/> 365 362 <CursorPos X="44" Y="164"/> 366 <UsageCount Value="15 8"/>363 <UsageCount Value="159"/> 367 364 <DefaultSyntaxHighlighter Value="Delphi"/> 368 365 </Unit22> … … 430 427 <TopLine Value="40"/> 431 428 <CursorPos X="29" Y="54"/> 432 <UsageCount Value="10 7"/>429 <UsageCount Value="108"/> 433 430 <DefaultSyntaxHighlighter Value="Delphi"/> 434 431 </Unit30> … … 469 466 <EditorIndex Value="1"/> 470 467 <WindowIndex Value="0"/> 471 <TopLine Value=" 9"/>472 <CursorPos X=" 18" Y="30"/>468 <TopLine Value="235"/> 469 <CursorPos X="8" Y="238"/> 473 470 <UsageCount Value="23"/> 474 471 <Loaded Value="True"/> … … 483 480 <TopLine Value="175"/> 484 481 <CursorPos X="3" Y="183"/> 485 <UsageCount Value="5 7"/>482 <UsageCount Value="58"/> 486 483 <DefaultSyntaxHighlighter Value="Delphi"/> 487 484 </Unit36> … … 525 522 <TopLine Value="4"/> 526 523 <CursorPos X="33" Y="19"/> 527 <UsageCount Value="5 1"/>524 <UsageCount Value="52"/> 528 525 <DefaultSyntaxHighlighter Value="Delphi"/> 529 526 </Unit41> … … 564 561 <EditorIndex Value="6"/> 565 562 <WindowIndex Value="0"/> 566 <TopLine Value=" 20"/>567 <CursorPos X="1 3" Y="31"/>568 <UsageCount Value="4 7"/>563 <TopLine Value="130"/> 564 <CursorPos X="1" Y="140"/> 565 <UsageCount Value="48"/> 569 566 <Loaded Value="True"/> 570 567 <DefaultSyntaxHighlighter Value="Delphi"/> … … 577 574 <TopLine Value="1"/> 578 575 <CursorPos X="1" Y="14"/> 579 <UsageCount Value="4 7"/>576 <UsageCount Value="48"/> 580 577 <DefaultSyntaxHighlighter Value="Delphi"/> 581 578 </Unit47> … … 587 584 <TopLine Value="8"/> 588 585 <CursorPos X="35" Y="14"/> 589 <UsageCount Value="4 6"/>586 <UsageCount Value="47"/> 590 587 <DefaultSyntaxHighlighter Value="Delphi"/> 591 588 </Unit48> … … 594 591 <IsPartOfProject Value="True"/> 595 592 <UnitName Value="UChronisModule"/> 596 <EditorIndex Value=" 10"/>593 <EditorIndex Value="9"/> 597 594 <WindowIndex Value="0"/> 598 595 <TopLine Value="1"/> 599 596 <CursorPos X="5" Y="15"/> 600 <UsageCount Value="3 7"/>597 <UsageCount Value="38"/> 601 598 <Loaded Value="True"/> 602 599 <DefaultSyntaxHighlighter Value="Delphi"/> … … 606 603 <IsPartOfProject Value="True"/> 607 604 <UnitName Value="UModuleSystem"/> 608 <EditorIndex Value="1 1"/>605 <EditorIndex Value="10"/> 609 606 <WindowIndex Value="0"/> 610 607 <TopLine Value="54"/> 611 608 <CursorPos X="42" Y="66"/> 612 <UsageCount Value="3 7"/>609 <UsageCount Value="38"/> 613 610 <Loaded Value="True"/> 614 611 <DefaultSyntaxHighlighter Value="Delphi"/> … … 645 642 <WindowIndex Value="0"/> 646 643 <TopLine Value="27"/> 647 <CursorPos X=" 20" Y="73"/>648 <UsageCount Value="3 0"/>644 <CursorPos X="15" Y="40"/> 645 <UsageCount Value="31"/> 649 646 <Loaded Value="True"/> 650 647 <LoadedDesigner Value="True"/> … … 655 652 <UnitName Value="Forms"/> 656 653 <WindowIndex Value="0"/> 657 <TopLine Value=" 735"/>658 <CursorPos X=" 17" Y="748"/>659 <UsageCount Value=" 9"/>654 <TopLine Value="1749"/> 655 <CursorPos X="29" Y="1760"/> 656 <UsageCount Value="10"/> 660 657 </Unit55> 661 658 <Unit56> … … 673 670 <IsPartOfProject Value="True"/> 674 671 <UnitName Value="UChronisClientMySQL"/> 675 <WindowIndex Value="0"/> 676 <TopLine Value="1"/> 677 <CursorPos X="31" Y="3"/> 672 <IsVisibleTab Value="True"/> 673 <EditorIndex Value="11"/> 674 <WindowIndex Value="0"/> 675 <TopLine Value="52"/> 676 <CursorPos X="40" Y="64"/> 678 677 <UsageCount Value="27"/> 678 <Loaded Value="True"/> 679 679 <DefaultSyntaxHighlighter Value="Delphi"/> 680 680 </Unit57> … … 686 686 <TopLine Value="63"/> 687 687 <CursorPos X="3" Y="74"/> 688 <UsageCount Value="2 3"/>688 <UsageCount Value="24"/> 689 689 <DefaultSyntaxHighlighter Value="Delphi"/> 690 690 </Unit58> 691 <Unit59> 692 <Filename Value="../../../Lazarus/0.9.31_2.5.1/fpc/2.5.1/source/rtl/objpas/sysutils/sysstrh.inc"/> 693 <WindowIndex Value="0"/> 694 <TopLine Value="106"/> 695 <CursorPos X="10" Y="119"/> 696 <UsageCount Value="10"/> 697 </Unit59> 691 698 </Units> 692 <JumpHistory Count=" 13" HistoryIndex="11">699 <JumpHistory Count="30" HistoryIndex="28"> 693 700 <Position1> 694 <Filename Value=" USystem.pas"/>695 <Caret Line=" 91" Column="9" TopLine="70"/>701 <Filename Value="Application/Clients/UChronisClientMySQL.pas"/> 702 <Caret Line="76" Column="1" TopLine="55"/> 696 703 </Position1> 697 704 <Position2> 698 <Filename Value=" USystem.pas"/>699 <Caret Line=" 40" Column="3" TopLine="29"/>705 <Filename Value="Application/Clients/UChronisClientMySQL.pas"/> 706 <Caret Line="73" Column="1" TopLine="55"/> 700 707 </Position2> 701 708 <Position3> 702 <Filename Value="Application/ UChronisClient.pas"/>703 <Caret Line=" 47" Column="21" TopLine="23"/>709 <Filename Value="Application/Clients/UChronisClientMySQL.pas"/> 710 <Caret Line="74" Column="1" TopLine="55"/> 704 711 </Position3> 705 712 <Position4> 706 <Filename Value="Application/ UChronisClient.pas"/>707 <Caret Line=" 24" Column="18" TopLine="15"/>713 <Filename Value="Application/Clients/UChronisClientMySQL.pas"/> 714 <Caret Line="75" Column="1" TopLine="55"/> 708 715 </Position4> 709 716 <Position5> 710 <Filename Value="Application/ UChronisClient.pas"/>711 <Caret Line=" 49" Column="28" TopLine="38"/>717 <Filename Value="Application/Clients/UChronisClientMySQL.pas"/> 718 <Caret Line="76" Column="1" TopLine="55"/> 712 719 </Position5> 713 720 <Position6> 714 <Filename Value="Application/ UChronisClient.pas"/>715 <Caret Line=" 59" Column="44" TopLine="39"/>721 <Filename Value="Application/Clients/UChronisClientMySQL.pas"/> 722 <Caret Line="73" Column="1" TopLine="55"/> 716 723 </Position6> 717 724 <Position7> 718 <Filename Value="Application/ UChronisClient.pas"/>719 <Caret Line=" 55" Column="43" TopLine="39"/>725 <Filename Value="Application/Clients/UChronisClientMySQL.pas"/> 726 <Caret Line="74" Column="1" TopLine="55"/> 720 727 </Position7> 721 728 <Position8> 722 <Filename Value="Application/ UChronisClient.pas"/>723 <Caret Line=" 22" Column="17" TopLine="4"/>729 <Filename Value="Application/Clients/UChronisClientMySQL.pas"/> 730 <Caret Line="75" Column="1" TopLine="55"/> 724 731 </Position8> 725 732 <Position9> 726 <Filename Value="Application/ UChronisClient.pas"/>727 <Caret Line="7 5" Column="18" TopLine="73"/>733 <Filename Value="Application/Clients/UChronisClientMySQL.pas"/> 734 <Caret Line="76" Column="1" TopLine="55"/> 728 735 </Position9> 729 736 <Position10> 730 <Filename Value="Application/ UChronisClient.pas"/>731 <Caret Line=" 44" Column="5" TopLine="23"/>737 <Filename Value="Application/Clients/UChronisClientMySQL.pas"/> 738 <Caret Line="73" Column="1" TopLine="55"/> 732 739 </Position10> 733 740 <Position11> 734 <Filename Value="Application/ UChronisClient.pas"/>735 <Caret Line=" 131" Column="15" TopLine="121"/>741 <Filename Value="Application/Clients/UChronisClientMySQL.pas"/> 742 <Caret Line="74" Column="1" TopLine="55"/> 736 743 </Position11> 737 744 <Position12> 738 <Filename Value=" UCore.pas"/>739 <Caret Line=" 58" Column="39" TopLine="42"/>745 <Filename Value="Application/Clients/UChronisClientMySQL.pas"/> 746 <Caret Line="75" Column="1" TopLine="55"/> 740 747 </Position12> 741 748 <Position13> 742 <Filename Value=" UCore.pas"/>743 <Caret Line=" 107" Column="1" TopLine="82"/>749 <Filename Value="Application/Clients/UChronisClientMySQL.pas"/> 750 <Caret Line="76" Column="1" TopLine="55"/> 744 751 </Position13> 752 <Position14> 753 <Filename Value="Application/Clients/UChronisClientMySQL.pas"/> 754 <Caret Line="73" Column="1" TopLine="55"/> 755 </Position14> 756 <Position15> 757 <Filename Value="Application/Clients/UChronisClientMySQL.pas"/> 758 <Caret Line="74" Column="1" TopLine="55"/> 759 </Position15> 760 <Position16> 761 <Filename Value="Application/Clients/UChronisClientMySQL.pas"/> 762 <Caret Line="75" Column="1" TopLine="55"/> 763 </Position16> 764 <Position17> 765 <Filename Value="Application/Clients/UChronisClientMySQL.pas"/> 766 <Caret Line="76" Column="1" TopLine="55"/> 767 </Position17> 768 <Position18> 769 <Filename Value="Application/Clients/UChronisClientMySQL.pas"/> 770 <Caret Line="73" Column="1" TopLine="55"/> 771 </Position18> 772 <Position19> 773 <Filename Value="Application/Clients/UChronisClientMySQL.pas"/> 774 <Caret Line="74" Column="1" TopLine="55"/> 775 </Position19> 776 <Position20> 777 <Filename Value="Application/Clients/UChronisClientMySQL.pas"/> 778 <Caret Line="75" Column="1" TopLine="55"/> 779 </Position20> 780 <Position21> 781 <Filename Value="Application/Clients/UChronisClientMySQL.pas"/> 782 <Caret Line="76" Column="1" TopLine="55"/> 783 </Position21> 784 <Position22> 785 <Filename Value="Application/Clients/UChronisClientMySQL.pas"/> 786 <Caret Line="73" Column="1" TopLine="55"/> 787 </Position22> 788 <Position23> 789 <Filename Value="USystem.pas"/> 790 <Caret Line="232" Column="1" TopLine="219"/> 791 </Position23> 792 <Position24> 793 <Filename Value="../../PascalClassLibrary/Network/CoolWeb/Persistence/USqlDatabase.pas"/> 794 <Caret Line="246" Column="1" TopLine="235"/> 795 </Position24> 796 <Position25> 797 <Filename Value="USystem.pas"/> 798 <Caret Line="208" Column="1" TopLine="213"/> 799 </Position25> 800 <Position26> 801 <Filename Value="USystem.pas"/> 802 <Caret Line="232" Column="1" TopLine="213"/> 803 </Position26> 804 <Position27> 805 <Filename Value="Application/UChronisClient.pas"/> 806 <Caret Line="140" Column="1" TopLine="130"/> 807 </Position27> 808 <Position28> 809 <Filename Value="Application/Clients/UChronisClientMySQL.pas"/> 810 <Caret Line="69" Column="3" TopLine="52"/> 811 </Position28> 812 <Position29> 813 <Filename Value="Application/Clients/UChronisClientMySQL.pas"/> 814 <Caret Line="70" Column="1" TopLine="52"/> 815 </Position29> 816 <Position30> 817 <Filename Value="../../PascalClassLibrary/Network/CoolWeb/Persistence/USqlDatabase.pas"/> 818 <Caret Line="238" Column="8" TopLine="235"/> 819 </Position30> 745 820 </JumpHistory> 746 821 </ProjectOptions> … … 793 868 </CompilerOptions> 794 869 <Debugging> 870 <BreakPoints Count="2"> 871 <Item1> 872 <Kind Value="bpkSource"/> 873 <WatchScope Value="wpsLocal"/> 874 <WatchKind Value="wpkWrite"/> 875 <Source Value="USystem.pas"/> 876 <Line Value="208"/> 877 </Item1> 878 <Item2> 879 <Kind Value="bpkSource"/> 880 <WatchScope Value="wpsLocal"/> 881 <WatchKind Value="wpkWrite"/> 882 <Source Value="USystem.pas"/> 883 <Line Value="232"/> 884 </Item2> 885 </BreakPoints> 795 886 <Watches Count="1"> 796 887 <Item1>
Note:
See TracChangeset
for help on using the changeset viewer.