📄 descriptionibo.txt
字号:
{**********************************************************************}
{ }
{ "The contents of this file are subject to the Mozilla Public }
{ License Version 1.1 (the "License"); you may not use this }
{ file except in compliance with the License. You may obtain }
{ a copy of the License at }
{ }
{ http://www.mozilla.org/MPL/ }
{ }
{ Software distributed under the License is distributed on an }
{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express }
{ or implied. See the License for the specific language }
{ governing rights and limitations under the License. }
{ }
{ The Original Code is DelphiWebScriptII source code, released }
{ January 1, 2001 }
{ }
{ http://www.dwscript.com }
{ }
{ The Initial Developers of the Original Code are Matthias }
{ Ackermann and hannes hernler. }
{ Portions created by Matthias Ackermann are Copyright (C) 2001 }
{ Matthias Ackermann, Switzerland. All Rights Reserved. }
{ Portions created by hannes hernler are Copyright (C) 2001 }
{ hannes hernler, Austria. All Rights Reserved. }
{ }
{ Contributor(s): ______________________________________. }
{ }
{**********************************************************************}
IBO (IBObjects) is the most sophisticated Interbase access tool for Delphi
made by Jason Wharton. You will find more on http://www.ibobjects.com
The DWS2-IBO-Library brings you 3 components for databas access in DWS2.
dws2IBOlib - introduces some classes to create and work with database
objects in the script. dws2IBOlib is linked to 1
TIB_Connection and 1 TIB_Transaction.
There are some extra IBO properties to use Jasons extras.
dws2IBODataSrc - component to add a predefined TIB_Query, TIB_Cursor,
or TIB_Statement as script object that can be used
in the script without creation or prepare.
dws2IBODataBase- component to add more TIB_Connections if you use more
than one database. DWS Queries and Statments can be
created with database as parameter.
dws2IBOlib Classes // ************************************************
please see the help files of Delphi, interbase and IBO about the meaning
of these classes and methods. But there are some things you will not find
there - specials of DWS2 database access!
LookUpField : special for web apps - define a master-detail table relation,
you can lookup details belonging to one master dataline (like
with name=value in stringlists) when "name" filed is string.
DataSetGrp : DataSetGroup, special for reports - if you iterate through
a dataset you can use DataSetGrp to watch changing of single
field values, calculate group sums and total sums (like
all incomes listed per person and totals per person....).
TDatabase
.create(Database,user, pwd: String): String;
.connect;
.disconnect;
properties
.dialect: integer;
.charset: String;
TDBField
properties
.Value: Variant;
.AsString: String;
TLUField = class(TDBField)
properties
.Value: Variant;
.AsString: String;
TStatement
.Create;
.CreateFromDB(Database: TDatabase);
.free;
.execute;
.FieldName(FieldName: String): TDBField;
.Field(FieldName: String): Variant; //simple version
.FieldIsNull(FieldName: String): boolean;
.ParamByName(ParamName: String): TDBField;
.SetParam(ParamName: String; Value: variant);
properties
.SQL: String; // after create assign SQL with the SQL statement
TDataset = class(TStatement)
.Open;
.First: boolean;
.Next: boolean;
.Eof: boolean;
.xxx: String;
.edit;
.insert;
.post;
.cancel;
.delete;
.close;
TQuery = class(TDataset)
.Prior: String;
.SetLookUpFields(KeyFieldName,LUfieldName: String): String;
.LookUp(KeyFieldValue: String): String;
properties
.Filter: String;
.Filtered: boolean;
.SortOrder: integer;
TDataSetGrp
.create(DataSet: TDataset; GroupFieldName: String);
DataSet is allready prepared;
.Free;
.Changed: boolean;
will be false while the content of the GroupField stays the same
while iterating through this dataset
.AddSumField(FieldName: String);
after create, before start iterating, add all fieldnames of fields
which should be added in the group or total
.SumOfField(FieldName: String): float;
returns actual value of added field values. is set to 0 with "reset"
.Count: integer;
returns the number of datarecords in this group.
.AddRow;
adds values of all fields
.Restart;
reset values for a new group, DOES NOT RESET FIELD SUMS
.Reset;
reset values AND FIELD SUMS for a new group
example:
{
dws2IBO : TDataSetGrp Demo
}
var qAmounts: TDataset;
var grpEmployee : TDataSetGrp;
qAmounts := TDataset.Create;
qAmounts.SQL := 'select * from empl_amounts'; // wages of employees
qAmounts.open;
grpEmployee := TDataSetGrp.create(qAmounts,'name');
grpEmployee.AddSumField('amount');
while not qAmounts.Eof do
begin
Print('name: ');
PrintLn(qAmounts.Field('name'));
while not grpEmployee.changed do
begin
Print(qAmounts.Fieldbyname('bill_date').value);
Print(', ');
PrintLn(qAmounts.Field('amount'));
grpEmployee.addrow;
qAmounts.Next;
i := i+1;
end;
Print(grpEmployee.count);
Print('-----------, sum: ');
PrintLn(grpEmployee.SumOfField('amount'));
Println('');
grpEmployee.reset;
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -