OZ User Data Store Manual
OZ User Data Store Manual,,,,, DataAction,, Http Request.. DLL DLL lib launch.cfg. // lib OZUDSSample_Csharp.dll, OZUDSSample_VBNET.dll lib. // config assembly.properties OZUDSSample_Csharp.dll, OZUDSSample_VBNET.dll. 2 FORCS Co., LTD
A Leader of Enterprise e-business Solution ### ### Assembly Properties for OZ local Server.NET. ### handler.filepath=%oz_home%/../assembly/ozdatabasehandler.dll uds_sample_csharp.filepath=%oz_home%/../lib/ozudssample_csharp.dll uds_sample_vbnet.filepath=%oz_home%/../lib/ozudssample_vbnet.dll ODBC AppExample.mdb ODBC. (:ASP.NET) UDS. bin OZUDSSample_Csharp.dll, OZUDSSample_VBNET.dll. bin DLL.NET Framework. ODBC conf db.properties ODBC. AppExample.vendor=odbc AppExample.dsn=AppExample AppExample.user= AppExample.password= AppExample.maxconns=5 AppExample.initconns=2 FORCS Co., LTD 3
OZ User Data Store Manual AppExample.timeout=5 Member.vendor=odbc Member.dsn=AppExample Member.user= Member.password= Member.maxconns=5 Member.initconns=2 Member.timeout=5 4 FORCS Co., LTD
A Leader of Enterprise e-business Solution UDS UDS DefaultUserDataStore OZUserDataStore RawDataSource Log. UDS DefaultUserDataStore. abstract class OZUserDataReaderStore abstract class OZUserDataTableStore oz.uds.ozuserdatareaderstore namespace oz.uds public abstract class OZUserDataReaderStore protected readonly oz.framework.log.ozlog log; abstract public void Init(); abstract public IDataReader GetDataReader(string command); abstract public void FreeDataReader(IDataReader reader); abstract public void Close(); Init Prototype Definition public void Init(). UDS. GetDataReader Prototype public IDataReader GetDataReader(string command) FORCS Co., LTD 5
OZ User Data Store Manual Definition IDataReader. Argument command FreeDataReader Prototype public void FreeDataReader(IDataReader reader) IDataReader. Definition GetDataReader() IDataReader FreeDataReader() IDataReader. Argument reader IDataReader Close Prototype Definition public void Close(). UDS. oz.uds.ozuserdatatablestore namespace oz.uds public abstract class OZUserDataTableStore protected readonly oz.framework.log.ozlog log; abstract public void Init(); abstract public System.Data.DataTable GetDataTable(string command); abstract public void FreeDataTable(DataTable table); abstract public void Close(); Init Prototype Definition public void Init(). UDS. 6 FORCS Co., LTD
A Leader of Enterprise e-business Solution GetDataReader Prototype Definition public System.Data.DataTable GetDataReader(string command) DataTable. Argument command DataTable FreeDataReader Prototype Definition public void FreeDataTable(DataTable table) DataTable. GetDataTable() DataTable FreeDataTable() DataTable. Argument table DataTable Close Prototype Definition public void Close(). UDS. UserDataReaderStoreSample.cs using System; using System.Web; using System.Data; using System.Collections; using oz.uds; using oz.uds.dr; namespace oz.uds.sample.csharp public class UserDataReaderStoreSample : OZUserDataReaderStore, IHttpContextRef, IParameterRef private HttpContext _ctx; private IDictionary _params; public HttpContext HttpContext set _ctx = value; FORCS Co., LTD 7
OZ User Data Store Manual public IDictionary Parameters set _params = value; public override void Init() public override IDataReader GetDataReader(string command) int fieldcount = oz.util.ozstring.parseint(convert.tostring(_params["field_count"]), 5); int rowcount = oz.util.ozstring.parseint(convert.tostring(_params["row_count"]), 5); string[] fieldnames = new string[fieldcount]; for(int i = 0; i < fieldcount; i++) fieldnames[i] = "field" + i; string[,] data = new string[rowcount, fieldcount]; colindex; for(int rowindex = 0; rowindex < rowcount; rowindex++) for(int colindex = 0; colindex < fieldcount; colindex++) data[rowindex, colindex] = "value " + rowindex + ", " + return new ArrayDataReader(fieldNames, data); public override void FreeDataReader(IDataReader reader) if(null!= reader) reader.close(); reader.dispose(); public override void Close() 8 FORCS Co., LTD
A Leader of Enterprise e-business Solution UserDataReaderStoreSample.vb Imports System.Web Imports System.Collections Imports oz.uds.dr Public Class UserDataReaderStoreSample Inherits OZUserDataReaderStore Implements IParameterRef Private _params As IDictionary Public WriteOnly Property Parameters() As IDictionary Implements IParameterRef.Parameters Set(ByVal value As IDictionary) Me._params = value End Set End Property Public Overrides Sub Init() End Sub Public Overrides Function GetDataReader(ByVal command As String) As IDataReader Dim fieldcount As Integer = oz.util.ozstring.parseint(convert.tostring(_params.item("field_count")), 5) Dim rowcount As Integer = oz.util.ozstring.parseint(convert.tostring(_params.item("row_count")), 5) Dim fieldnames(fieldcount - 1) As String Dim i As Integer For i = 0 To fieldcount - 1 fieldnames(i) = "field" & i Next Dim data(rowcount - 1, fieldcount - 1) As String Dim rowindex, colindex As Integer For rowindex = 0 To rowcount - 1 For colindex = 0 To fieldcount - 1 FORCS Co., LTD 9
OZ User Data Store Manual Next Next data(rowindex, colindex) = "value " & rowindex & ", " & colindex Return New ArrayDataReader(fieldNames, data) End Function Public Overrides Sub FreeDataReader(ByVal reader As IDataReader) If (Not reader Is Nothing) Then reader.close() reader.dispose() End If End Sub Public Overrides Sub Close() End Sub End Class UserDataTableStoreSample.cs using System; using System.Web; using System.Data; using System.Collections; using oz.uds; using oz.uds.dr; namespace oz.uds.sample.csharp public class UserDataTableStoreSample : OZUserDataTableStore, IParameterRef private IDictionary _params; public IDictionary Parameters set _params = value; public override void Init() public override DataTable GetDataTable(string command) int fieldcount = oz.util.ozstring.parseint(convert.tostring(_params["field_count"]), 5); 10 FORCS Co., LTD
A Leader of Enterprise e-business Solution int rowcount = oz.util.ozstring.parseint(convert.tostring(_params["row_count"]), 5); log.debug("start to create DataTable object. "); DataTable table = new DataTable(); for(int i = 0; i < fieldcount; i++) table.columns.add("field" + i); for(int rowindex = 0; rowindex < rowcount; rowindex++) DataRow row = table.newrow(); for(int colindex = 0; colindex < fieldcount; colindex++) row[colindex] = "value " + rowindex + ", " + colindex; table.rows.add(row); return table; public override void FreeDataTable(DataTable table) if(null!= table) table.dispose(); public override void Close() UserDataTableStoreSample.vb Imports System.Web Imports System.Collections Imports oz.uds.dr Public Class UserDataTableStoreSample Inherits OZUserDataTableStore Implements IParameterRef FORCS Co., LTD 11
OZ User Data Store Manual Private _params As IDictionary Public WriteOnly Property Parameters() As IDictionary Implements IParameterRef.Parameters Set(ByVal value As IDictionary) Me._params = value End Set End Property Public Overrides Function GetDataTable(ByVal command As String) As DataTable Dim fieldcount As Integer = oz.util.ozstring.parseint(convert.tostring(_params.item("field_count")), 5) Dim rowcount As Integer = oz.util.ozstring.parseint(convert.tostring(_params.item("row_count")), 5) log.debug("start to create DataTable object. ") Dim table As New DataTable Dim i As Integer For i = 0 To fieldcount table.columns.add("field" & i) Next Dim rowindex, colindex As Integer For rowindex = 0 To rowcount Dim row As DataRow = table.newrow() For colindex = 0 To fieldcount row.item(colindex) = "value " & rowindex & ", " & colindex Next table.rows.add(row) Next Return table End Function Public Overrides Sub FreeDataTable(ByVal table As DataTable) If (Not table Is Nothing) Then table.dispose() End If End Sub 12 FORCS Co., LTD
A Leader of Enterprise e-business Solution Public Overrides Sub Init() End Sub Public Overrides Sub Close() End Sub End Class UDS. ODI ( ).. FORCS Co., LTD 13
OZ User Data Store Manual (. ) ODI "stores.odi". "stores.odi". "ODI " "stores", " " "DataReaderSample" "DataTableSample". "DataReaderSample" "field1" &. 14 FORCS Co., LTD
A Leader of Enterprise e-business Solution. FORCS Co., LTD 15
OZ User Data Store Manual Connection UDS UDS DB Connection Pool Connection oz.uds.iconnectionref. oz.uds.iconnectionref public interface IConnectionRef string[] Aliasesget; IDictionary Connectionsset; Aliases Prototype string[] Aliasesget; Definition UDS DB Pool alias Connections Prototype Definition IDictionary Connectionsset; UDS Connection. Aliases, null(vb : Nothing). : Aliasesget; ( Connection DB Pool ) Connectionsset; ( Connection UDS ) Init () IConnectionRef Connection Pool Close(). IConnectionRef Init(), Close(). Init() Connection UDS IConnectionRef 16 FORCS Co., LTD
A Leader of Enterprise e-business Solution UDS Connection Connectionsset;. UDS Connectionsset; Init(). ConnectionReferenceSample.cs using System; using System.IO; using System.Web; using System.Data; using System.Collections; using oz.uds; using oz.uds.dr; using oz.framework.dac; namespace oz.uds.sample.csharp public class ConnectionReferenceSample : OZUserDataReaderStore, IConnectionRef private IDbConnection _connection; private IDbCommand _command; public override void Init() if(null == _connection) throw new OZUDSException("Cannot find proper connection from oz connection pool."); _command = _connection.createcommand(); public override IDataReader GetDataReader(string command) _command.commandtext = command; return _command.executereader(); public override void FreeDataReader(IDataReader reader) if(null!= reader) FORCS Co., LTD 17
OZ User Data Store Manual reader.close(); reader.dispose(); public override void Close() public System.Collections.IDictionary Connections set _connection = (IDbConnection)value["appexample"]; public string[] Aliases get return new string[] "appexample"; ConnectionReferenceSample.vb Imports System.IO Imports System.Web Imports System.Collections Imports oz.uds.dr Imports oz.framework.dac Public Class ConnectionReferenceSample Inherits OZUserDataReaderStore Implements IConnectionRef Private _connection As IDbConnection Private _command As IDbCommand Public Overrides Sub Init() If (_connection Is Nothing) Then Throw New OZUDSException("Cannot find proper connection from oz connection pool.") End If _command = _connection.createcommand() End Sub Public Overrides Function GetDataReader(ByVal command As String) As IDataReader 18 FORCS Co., LTD
A Leader of Enterprise e-business Solution _command.commandtext = command Return _command.executereader() End Function Public Overrides Sub FreeDataReader(ByVal reader As IDataReader) If (Not reader Is Nothing) Then reader.close() reader.dispose() End If End Sub Public Overrides Sub Close() End Sub Public ReadOnly Property Aliases() As String() Implements IConnectionRef.Aliases Get Return New String() "appexample" End Get End Property Public WriteOnly Property Connections() As System.Collections.IDictionary Implements IConnectionRef.Connections Set(ByVal Value As System.Collections.IDictionary) _connection = DirectCast(Value.Item("appexample"), IDbConnection) End Set End Property End Class Connection UDS. ODI ( ). FORCS Co., LTD 19
OZ User Data Store Manual. ( ). ODI "connectionreference.odi". 20 FORCS Co., LTD
A Leader of Enterprise e-business Solution "connectionreference.odi". "ODI " "connectionreference", "" "Product".. [] []. "connectionreference.ozr" ODI OZR. Sample.html. FORCS Co., LTD 21
OZ User Data Store Manual <HTML> <HEAD> <script src="oz_activex.js"></script> </HEAD> <BODY> <div id="ozembedcontrollocation"> <script id="ztransferx" src="ztransferx.js"></script> <script LANGUAGE="Javascript"> var tag = '<OBJECT id = "ozviewer" CLASSID="CLSID:0DEF32F8-170F-46f8-B1FF-4BF7443F5F25" width="100%" height="100%"></object>'; var paramtag = new Array(); paramtag[paramtag.length] = '<param name="connection.servlet" value="http://127.0.0.1:8080/oz/server">'; paramtag[paramtag.length] = '<param name="connection.reportname" value="/connectionreference.ozr">'; oz_activex_build(ozembedcontrollocation, tag, paramtag); </script> </div> </body> </HTML> Sample.html. 22 FORCS Co., LTD
A Leader of Enterprise e-business Solution DataAction UDS DataAction oz.uds.idataaction. insert/delete/update/commit String. oz.uds.idataaction namespace oz.uds public interface IDataAction /// <summary> /// insert a row. /// /// it can be implemented as following SQL like logic. /// /// INSERT INTO 'table' (source[0].fieldname, source[1].fieldname,...) /// VALUES(source[0].FieldData, source[1].fielddata,...) /// /// extra arugment can be used to convert spacial types (TO_DATE etc) or /// modify data. /// </summary> /// <param name="command">command string</param> /// <param name="source">source field data</param> /// <param name="extra"> extra argument if needs.</param> /// <param name="parameters">field names and values of parameter and master set</param> /// <returns>number of inserted rows. (always 1 if normal)</returns> string InsertRow(string command, OZDACData[] source, string extra, Hashtable parameters); /// <summary> /// delete row(s). /// /// it can be implemented as following SQL like logic. /// /// DELETE FROM 'table' WHERE condition[0].fieldname = condition[0].fielddata FORCS Co., LTD 23
OZ User Data Store Manual /// AND condition[1].fieldname = condition[1].fielddata /// AND... /// AND extra condition /// </summary> /// <param name="command">command string</param> /// <param name="condition">condition field data</param> /// <param name="extra">extra condition if needs.</param> /// <param name="parameters">field names and values of parameter and master set</param> /// <returns>number of deleted rows.</returns> string DeleteRow(string command, OZDACData[] condition, string extra, Hashtable parameters); /// <summary> /// it can be implemented as following SQL like logic. /// /// UPDATE 'table' SET source[0].fieldname = source[0].fielddata, /// source[1].fieldname = source[1].fielddata, ///... /// WHERE condition[0].fieldname = condition[0].fielddata /// AND condition[1].fieldname = condition[1].fielddata /// AND... /// AND ext /// extra arugment can be used to convert spacial types (TO_DATE etc) or /// modify data. /// </summary> /// <param name="command">command string</param> /// <param name="condition">target field data</param> /// <param name="source">source field data</param> /// <param name="extra">extra argument if needs.</param> /// <param name="parameters">field names and values of parameter and master set</param> /// <returns>number of updated rows.</returns> string UpdateRow(string command, OZDACData[] condition, OZDACData[] source, string extra, Hashtable parameters); /// <summary> /// commit all data actions /// called after all data action transactions are successfully completed. /// </summary> /// <returns>commit result message</returns> string Commit(); 24 FORCS Co., LTD
A Leader of Enterprise e-business Solution /// <summary> /// rollback all data actions /// called if exception occured while doing data actions. /// </summary> void Rollback(); InsertRow Prototype Definition string InsertRow(string command, OZDACData[] source, string extra, Hashtable parameters);. Argument command source extra parameters (<string datasetname, IDictionary parameters> ) DeleteRow Prototype Definition string DeleteRow(string command, OZDACData[] condition, string extra, Hashtable parameters);. Argument command condition extra parameters (<string datasetname, IDictionary parameters> ) UpdateRow Prototype Definition string UpdateRow(string command, OZDACData[] condition, OZDACData[] source, string extra, Hashtable parameters);. Argument command condition source FORCS Co., LTD 25
OZ User Data Store Manual extra parameters (<string datasetname, IDictionary parameters> ) Commit Prototype Definition string Commit();. Rollback Prototype Definition void Rollback();. : Init(). (IDbTransaction.Rollback() IDbTransaction.Commit()) IDbConnection.BeginTransaction() UDS DB,. DataActionSample.cs using System; using System.IO; using System.Web; using System.Data; using System.Collections; using oz.uds; using oz.uds.dr; using oz.framework.dac; namespace oz.uds.sample.csharp public class DataActionSample : OZUserDataReaderStore, IConnectionRef, IDataAction private IDbConnection _connection; private IDbCommand _command; 26 FORCS Co., LTD
A Leader of Enterprise e-business Solution public override void Init() if(null == _connection) throw new OZUDSException("Cannot find proper connection from oz connection pool."); _command = _connection.createcommand(); _command.transaction = _connection.begintransaction(); public override IDataReader GetDataReader(string command) _command.commandtext = command; return _command.executereader(); public override void FreeDataReader(IDataReader reader) if(null!= reader) reader.close(); reader.dispose(); public override void Close() if(null!= _command.transaction) _command.transaction.rollback(); _command.transaction = null; public System.Collections.IDictionary Connections set _connection = (IDbConnection)value["appexample"]; public string[] Aliases get return new string[] "appexample"; private void makestring(textwriter writer, IDictionary parameters) foreach(dictionaryentry entry in parameters) FORCS Co., LTD 27
OZ User Data Store Manual string mastersetname = (string) entry.key; IDictionary masterfields = (IDictionary)entry.Value; writer.writeline("master set; " + mastersetname); "]"); foreach(dictionaryentry masterfield in masterfields) writer.write("[" + masterfield.key + ":" + masterfield.value + public string InsertRow(string command, OZDACData[] source, string extraargument, Hashtable parameters) StringWriter writer = new StringWriter(); writer.writeline("testing data action - InsertRow ------------------- ---------------"); writer.writeline("command : " + command); foreach(ozdacdata field in source) writer.writeline("source field " + field.fieldname + " : " + field.fielddata); writer.writeline("extra argument : " + extraargument); makestring(writer, parameters); writer.writeline("--------------------------------------------------- --------"); log.debug(writer.tostring()); _command.commandtext = command; return "Insert : " + _command.executenonquery(); public string DeleteRow(string command, OZDACData[] destination, string extraargument, Hashtable parameters) StringWriter writer = new StringWriter(); writer.writeline("testing data action - DeleteRow ------------------- ---------------"); writer.writeline("command : " + command); foreach(ozdacdata field in destination) 28 FORCS Co., LTD
A Leader of Enterprise e-business Solution writer.writeline("destination field " + field.fieldname + " : " + field.fielddata); writer.writeline("extra argument : " + extraargument); makestring(writer, parameters); writer.writeline("--------------------------------------------------- --------"); log.debug(writer.tostring()); _command.commandtext = command; return "Delete : " + _command.executenonquery(); public string UpdateRow(string command, OZDACData[] destination, OZDACData[] source, string extraargument, Hashtable parameters) StringWriter writer = new StringWriter(); writer.writeline("testing data action - UpdateRow ------------------- ---------------"); writer.writeline("command : " + command); foreach(ozdacdata field in destination) writer.writeline("destination field " + field.fieldname + " : " + field.fielddata); foreach(ozdacdata field in source) writer.writeline("source field " + field.fieldname + " : " + field.fielddata); writer.writeline("extra argument : " + extraargument); makestring(writer, parameters); writer.writeline("--------------------------------------------------- --------"); log.debug(writer.tostring()); _command.commandtext = command; return "Update : " + _command.executenonquery(); public void Rollback() if(null!= _command.transaction) FORCS Co., LTD 29
OZ User Data Store Manual _command.transaction.rollback(); _command.transaction = null; public string Commit() if(null!= _command.transaction) _command.transaction.commit(); _command.transaction = null; return "Commit"; DataActionSample.vb Imports System.IO Imports System.Web Imports System.Collections Imports oz.uds.dr Imports oz.framework.dac Public Class DataActionSample Inherits OZUserDataReaderStore Implements IDataAction, IConnectionRef Private _connection As IDbConnection Private _command As IDbCommand Public Overrides Sub Init() If (_connection Is Nothing) Then Throw New OZUDSException("Cannot find proper connection from oz connection pool.") End If _command = _connection.createcommand() _command.transaction = _connection.begintransaction() End Sub 30 FORCS Co., LTD
A Leader of Enterprise e-business Solution Public Overrides Function GetDataReader(ByVal command As String) As IDataReader _command.commandtext = command Return _command.executereader() End Function Public Overrides Sub FreeDataReader(ByVal reader As IDataReader) If (Not reader Is Nothing) Then reader.close() reader.dispose() End If End Sub Public Overrides Sub Close() If (Not _command.transaction Is Nothing) Then _command.transaction.rollback() _command.transaction = Nothing End If End Sub Public ReadOnly Property Aliases() As String() Implements IConnectionRef.Aliases Get Return New String() "appexample" End Get End Property Public WriteOnly Property Connections() As System.Collections.IDictionary Implements IConnectionRef.Connections Set(ByVal Value As System.Collections.IDictionary) _connection = DirectCast(Value.Item("appexample"), IDbConnection) End Set End Property Private Sub makestring(byval writer As TextWriter, ByVal parameters As IDictionary) Dim entry As DictionaryEntry For Each entry In parameters Dim mastersetname As String = CStr(entry.Key) Dim masterfields As IDictionary = DirectCast(entry.Value, IDictionary) writer.writeline(("master set; " & mastersetname)) Dim masterfield As DictionaryEntry For Each masterfield In masterfields FORCS Co., LTD 31
OZ User Data Store Manual writer.write(string.concat(new Object() "[", masterfield.key, ":", masterfield.value, "]")) Next Next End Sub Public Function InsertRow(ByVal command As String, ByVal source() As OZDACData, ByVal extraargument As String, ByVal parameters As Hashtable) As String Implements IDataAction.InsertRow Dim writer As New StringWriter writer.writeline("testing data action - InsertRow ----------------------- -----------") writer.writeline(("command : " & command)) Dim field As OZDACData For Each field In source writer.writeline("source field " & field.fieldname, " : " & field.fielddata) Next writer.writeline(("extra argument : " & extraargument)) makestring(writer, parameters) writer.writeline("------------------------------------------------------- ----") log.debug(writer.tostring) _command.commandtext = command Return ("Insert : " & _command.executenonquery) End Function Public Function UpdateRow(ByVal command As String, ByVal destination() As OZDACData, ByVal source() As OZDACData, ByVal extraargument As String, ByVal parameters As Hashtable) As String Implements IDataAction.UpdateRow Dim writer As New StringWriter writer.writeline("testing data action - UpdateRow ----------------------- -----------") writer.writeline(("command : " & command)) Dim field As OZDACData For Each field In destination writer.writeline("destination field " & field.fieldname & " : " & field.fielddata) Next 32 FORCS Co., LTD
A Leader of Enterprise e-business Solution For Each field In source writer.writeline("source field " & field.fieldname & " : " & field.fielddata) Next writer.writeline(("extra argument : " & extraargument)) makestring(writer, parameters) writer.writeline("------------------------------------------------------- ----") log.debug(writer.tostring) _command.commandtext = command Return ("Update : " & _command.executenonquery) End Function Public Function DeleteRow(ByVal command As String, ByVal destination() As OZDACData, ByVal extraargument As String, ByVal parameters As Hashtable) As String Implements IDataAction.DeleteRow Dim writer As New StringWriter writer.writeline("testing data action - DeleteRow ----------------------- -----------") writer.writeline(("command : " & command)) Dim field As OZDACData For Each field In destination writer.writeline("destination field " & field.fieldname & " : " & field.fielddata) Next writer.writeline(("extra argument : " & extraargument)) makestring(writer, parameters) writer.writeline("------------------------------------------------------- ----") log.debug(writer.tostring) _command.commandtext = command Return ("Delete : " & _command.executenonquery) End Function Public Sub Rollback() Implements IDataAction.Rollback If (Not _command.transaction Is Nothing) Then _command.transaction.rollback() _command.transaction = Nothing FORCS Co., LTD 33
OZ User Data Store Manual End If End Sub Public Function Commit() As String Implements IDataAction.Commit If (Not _command.transaction Is Nothing) Then _command.transaction.commit() _command.transaction = Nothing End If Return "Commit" End Function End Class,,. ODI ( ).. 34 FORCS Co., LTD
A Leader of Enterprise e-business Solution ( )... (. ) FORCS Co., LTD 35
OZ User Data Store Manual []. MASTER DETAIL - DETAIL "" "MASTER". 36 FORCS Co., LTD
A Leader of Enterprise e-business Solution,,. INSERT INTO ECustomer ( #@ARG_SF1#, #@ARG_SF2#, #@ARG_SF3#, #@ARG_SF4#, #@ARG_SF5#, #@ARG_SF6#, #@ARG_SF7#, country ) VALUES ( #@ARG_SV1#, '#@ARG_SV2#', '#@ARG_SV3#', '#@ARG_SV4#', '#@ARG_SV5#', '#@ARG_SV6#', '#@ARG_SV7#', '#MASTER.country#' ) DELETE FROM ECustomer WHERE #@ARG_DF1# = #@ARG_DV1# and country = '#MASTER.country#' UPDATE ECustomer SET #@ARG_SF2# = '#@ARG_SV2#', #@ARG_SF3# = '#@ARG_SV3#', #@ARG_SF4# = '#@ARG_SV4#', #@ARG_SF5# = '#@ARG_SV5#', #@ARG_SF6# = '#@ARG_SV6#', #@ARG_SF7# = '#@ARG_SV7#' WHERE #@ARG_DF1# = #@ARG_DV1# and country = '#MASTER.country#' ODI. "dataaction.odi". "dataaction.odi". FORCS Co., LTD 37
OZ User Data Store Manual Board "ODIKey" "dataaction", "DataSet" "MASTER", "Field" "country", "FireRowCursorChange" "True". Board "AllowInsert", "AllowDelete", "AllowUpdate" "True", "CellSelectionMode" "Single", "ODIKey" " dataaction ", "DataSet" "DETAIL". "#OZDeleteFlag#" "ColumnEditable" "True". Board OnClick DataAction. var Result = Table1.CommitQueuedActions(); _MessageBox(Result); 38 FORCS Co., LTD
A Leader of Enterprise e-business Solution Table1.GetDataSet().RefreshDataSet();,,. DataAction [] [] (. ) FORCS Co., LTD 39
OZ User Data Store Manual. Delete,. [Commit DataAction] DataAction DataAction. 40 FORCS Co., LTD
A Leader of Enterprise e-business Solution UDS. oz.uds.iparameterref. oz.uds.iparameterref Parametersset;, System.Collection.IDictionary. oz.uds.iparameterref using System.Collection; namespace oz.uds public interface IParameterRef IDictionary Parametersset; Parametersset; Prototype Definition System.Collection.IDictionary Parametersset; Value value ParameterReferenceSample.cs using System; using System.Web; using System.Data; using System.Collections; using oz.uds; using oz.uds.dr; namespace oz.uds.sample.csharp public class ParameterReferenceSample : OZUserDataReaderStore, IHttpContextRef, IParameterRef FORCS Co., LTD 41
OZ User Data Store Manual private HttpContext _ctx; private IDictionary _params; public HttpContext HttpContext set _ctx = value; public IDictionary Parameters set _params = value; public override void Init() public override IDataReader GetDataReader(string command) ArrayList fieldnames = new ArrayList(); ArrayList fieldvalues = new ArrayList(); fieldnames.add("key"); fieldnames.add("value"); foreach(dictionaryentry entry in _params) fieldvalues.add(arraylist.adapter(new entry.value)); object[]entry.key, fieldvalues.add(arraylist.adapter(new object[]"command", command)); return new ArrayListDataReader(fieldNames, fieldvalues); public override void FreeDataReader(IDataReader idr) public override void Close() ParameterReferenceSample.vb Imports System.Web 42 FORCS Co., LTD
A Leader of Enterprise e-business Solution Imports System.Collections Imports oz.uds.dr Public Class ParameterReferenceSample Inherits OZUserDataReaderStore Implements IHttpContextRef, IParameterRef Private _ctx As System.Web.HttpContext Private _params As IDictionary Public WriteOnly Property HttpContext() As HttpContext Implements IHttpContextRef.HttpContext Set(ByVal value As HttpContext) Me._ctx = value End Set End Property Public WriteOnly Property Parameters() As IDictionary Implements IParameterRef.Parameters Set(ByVal value As IDictionary) Me._params = value End Set End Property Public Overrides Sub FreeDataReader(ByVal idr As IDataReader) End Sub Public Overrides Function GetDataReader(ByVal command As String) As IDataReader Dim fieldnames As New ArrayList Dim fieldvalues As New ArrayList fieldnames.add("key") fieldnames.add("value") Dim entry As DictionaryEntry For Each entry In _params fieldvalues.add(arraylist.adapter(new Object() entry.key, entry.value)) Next fieldvalues.add(arraylist.adapter(new Object() "command", command)) FORCS Co., LTD 43
OZ User Data Store Manual Return New ArrayListDataReader(fieldNames, fieldvalues) End Function Public Overrides Sub Init() End Sub Public Overrides Sub Close() End Sub End Class ParameterReference. ODI [ ]. "Parameter_City" "Parameter_Gender", "Canada" "F". 44 FORCS Co., LTD
A Leader of Enterprise e-business Solution ( ).. FORCS Co., LTD 45
OZ User Data Store Manual select * from ECustomer where city = "#OZParam.City#" and gender = "#OZParam.Gender#" (. ), ODI. "class3_1.odi". "class3_1.odi". "ODI " "class3_1", "" "SET_1". "SET_1" "KEY" "VALUE" &. 46 FORCS Co., LTD
A Leader of Enterprise e-business Solution, (command). FORCS Co., LTD 47
OZ User Data Store Manual IIS HttpContext UDS HttpContext oz.uds.ihttpcontextref. oz.uds.ihttpcontextref oz.uds.iuserdatastore Init() setservlet() sethttprequest(). oz.uds.ihttpcontextref namespace oz.uds public interface IHttpContextRef HttpContext HttpContextset; HttpContext Prototype Definition HttpContext HttpContextset; UDS HttpContext Argument value Http HttpContextReferenceSample.cs using System; using System.Web; using System.Data; using System.Collections; using System.Collections.Specialized; using oz.uds; using oz.uds.dr; namespace oz.uds.sample.csharp public class HttpContextReferenceSample : OZUserDataReaderStore, IHttpContextRef, IParameterRef 48 FORCS Co., LTD
A Leader of Enterprise e-business Solution private HttpContext _ctx; private IDictionary _params; public HttpContext HttpContext set _ctx = value; public IDictionary Parameters set _params = value; public override void Init() public override IDataReader GetDataReader(string command) ArrayList fieldnames = new ArrayList(); ArrayList fieldvalues = new ArrayList(); fieldnames.add("key"); fieldnames.add("value"); if(null!= _ctx) NameValueCollection @params = _ctx.request.params; foreach(string key in @params.allkeys) log.debug(key); fieldvalues.add(arraylist.adapter(new @params[key])); object[]key, if(0 == fieldnames.count) return new NullDataReader(); else return new ArrayListDataReader(fieldNames, fieldvalues); public override void FreeDataReader(IDataReader idr) public override void Close() FORCS Co., LTD 49
OZ User Data Store Manual HttpContextReferenceSample.vb Imports System.Web Imports System.Collections Imports oz.uds.dr Public Class HttpContextReferenceSample Inherits OZUserDataReaderStore Implements IHttpContextRef, IParameterRef Private _ctx As System.Web.HttpContext Private _params As IDictionary Public WriteOnly Property HttpContext() As HttpContext Implements IHttpContextRef.HttpContext Set(ByVal value As HttpContext) Me._ctx = value End Set End Property Public WriteOnly Property Parameters() As IDictionary Implements IParameterRef.Parameters Set(ByVal value As IDictionary) Me._params = value End Set End Property Public Overrides Sub FreeDataReader(ByVal idr As IDataReader) End Sub Public Overrides Function GetDataReader(ByVal command As String) As IDataReader Dim fieldnames As New ArrayList Dim fieldvalues As New ArrayList fieldnames.add("key") fieldnames.add("value") If (Not _ctx Is Nothing) Then Dim params As System.Collections.Specialized.NameValueCollection = _ctx.request.params Dim key As String For Each key In params.allkeys log.debug(key) 50 FORCS Co., LTD
A Leader of Enterprise e-business Solution fieldvalues.add(arraylist.adapter(new Object() key, params.item(key))) Next End If If (fieldnames.count = 0) Then Return New NullDataReader Else Return New ArrayListDataReader(fieldNames, fieldvalues) End If End Function Public Overrides Sub Init() End Sub Public Overrides Sub Close() End Sub End Class Connection UDS. ODI UDS ( ). FORCS Co., LTD 51
OZ User Data Store Manual.. (. ) ODI "class4_1.odi". "class4_1.odi" 52 FORCS Co., LTD
A Leader of Enterprise e-business Solution. "ODI " "class4_1", "" "SET_1". "SET_1" "KEY" "VALUE" &.. ODI OZR. asp.net. HTTP Request Key Value "connection.servlet" "?key1=value1&key2=value2&...". asp.net... <param name="connection.servlet" value="http://127.0.0.1:8088/ozaspnet/server.aspx?k1=a1&k2=a2&k3=a3">.... FORCS Co., LTD 53
OZ User Data Store Manual 54 FORCS Co., LTD
A Leader of Enterprise e-business Solution UDS DataReader. oz.uds.dr.defaultdatareader. DefaultDataReader. abstract public bool Read() abstract public DataTable GetSchemaTable() abstract public object this[string name]get; abstract public object this[int zerobasedindex]get; oz.uds.dr.arraydatareader. Constructor Summary public ArrayDataReader(string[] fieldnames, string[][] data) public ArrayDataReader(string[] fieldnames, string[,] data) public ArrayDataReader(string[] fieldnames, Type [] types, string[][] data) public ArrayDataReader(string[] fieldnames, Type[] types, string[,] data) Constructor Detail Prototype // public ArrayDataReader(string[] fieldnames, string[][]data) public ArrayDataReader(string[] fieldnames, string[,]data) // FORCS Co., LTD 55
OZ User Data Store Manual public ArrayDataReader(string[] fieldnames, Type[] types, string[][] data) public ArrayDataReader(string[] fieldnames, Type[] types, string[,] data) fieldnames Argument types data 2 ( ) ArrayDataReaderSample.cs using System; using System.Web; using System.Data; using System.Collections; using oz.uds; using oz.uds.dr; namespace oz.uds.sample.csharp public class ArrayDataReaderSample : OZUserDataReaderStore, IHttpContextRef, IParameterRef private HttpContext _ctx; private IDictionary _params; public HttpContext HttpContext set _ctx = value; public IDictionary Parameters set _params = value; public override void Init() public override IDataReader GetDataReader(string command) int fieldcount = oz.util.ozstring.parseint(convert.tostring(_params["field_count"]), 5); int rowcount = oz.util.ozstring.parseint(convert.tostring(_params["row_count"]), 5); bool usejaggedarray = oz.util.ozstring.parsebool(convert.tostring(_params["use_jagged_array"]), 56 FORCS Co., LTD
A Leader of Enterprise e-business Solution false); string[] fieldnames = new string[fieldcount]; string[][] jagged = null; string[,] rectangular = null; if(usejaggedarray) jagged = new string[rowcount][]; else rectangular = new string[rowcount, fieldcount]; for(int col = 0; col < fieldcount; col++) fieldnames[col] = "Field" + col; for(int row = 0; row < rowcount; row++) if(usejaggedarray) jagged[row] = new string[fieldcount]; for(int col = 0; col < fieldcount; col++) string value = "Value - " + row + "," + col; if(usejaggedarray) jagged[row][col] = value; else rectangular[row,col] = value; if(usejaggedarray) return new ArrayDataReader(fieldNames, jagged); else return new ArrayDataReader(fieldNames, rectangular); public override void FreeDataReader(IDataReader reader) public override void Close() FORCS Co., LTD 57
OZ User Data Store Manual ArrayDataReaderSample.vb Imports System.Web Imports System.Collections Imports oz.uds.dr Public Class ArrayDataReaderSample Inherits OZUserDataReaderStore Implements IHttpContextRef, IParameterRef Private _ctx As System.Web.HttpContext Private _params As IDictionary Public WriteOnly Property HttpContext() As HttpContext Implements IHttpContextRef.HttpContext Set(ByVal value As HttpContext) Me._ctx = value End Set End Property Public WriteOnly Property Parameters() As IDictionary Implements IParameterRef.Parameters Set(ByVal value As IDictionary) Me._params = value End Set End Property Public Overrides Sub FreeDataReader(ByVal reader As IDataReader) End Sub Public Overrides Function GetDataReader(ByVal command As String) As IDataReader Dim fieldcount As Integer = oz.util.ozstring.parseint(convert.tostring(_params.item("field_count")), 5) Dim rowcount As Integer = oz.util.ozstring.parseint(convert.tostring(_params.item("row_count")), 5) Dim usejaggedarray As Boolean = oz.util.ozstring.parsebool(convert.tostring(_params.item("use_jagged_array")), False) log.debug("field count : " & fieldcount) Dim fieldnames(fieldcount - 1) As String 58 FORCS Co., LTD
A Leader of Enterprise e-business Solution Dim jagged()() As String Dim rectangular(,) As String If (usejaggedarray) Then jagged = New String(rowCount - 1)() Else rectangular = New String(rowCount - 1, fieldcount - 1) End If Dim col As Integer For col = 0 To fieldcount - 1 fieldnames(col) = "Field" & col Next col Dim row As Integer For row = 0 To rowcount - 1 If (usejaggedarray) Then End If jagged(row) = New String(fieldCount - 1) For col = 0 To fieldcount - 1 Dim value = "Value - " & row & "," & col If (usejaggedarray) Then jagged(row)(col) = value Else rectangular(row, col) = value End If Next col Next row If (usejaggedarray) Then Return New ArrayDataReader(fieldNames, jagged) Else Return New ArrayDataReader(fieldNames, rectangular) End If End Function Public Overrides Sub Init() End Sub Public Overrides Sub Close() End Sub FORCS Co., LTD 59
OZ User Data Store Manual End Class oz.uds.dr.dynamicdatareader. Constructor Summary public DynamicDataReader(IDataReader reader) Constructor Detail Prototype public DynamicDataReader(IDataReader reader) Argument reader ResultSet DynamicDataReaderSample.cs using System; using System.Web; using System.Data; using System.Collections; using oz.uds; using oz.uds.dr; namespace oz.uds.sample.csharp public class DynamicDataReaderSample : OZUserDataReaderStore, IHttpContextRef, IParameterRef private HttpContext _ctx; private IDictionary _params; public HttpContext HttpContext set _ctx = value; public IDictionary Parameters set _params = value; public override void Init() 60 FORCS Co., LTD
A Leader of Enterprise e-business Solution public override IDataReader GetDataReader(string command) int fieldcount = oz.util.ozstring.parseint(convert.tostring(_params["field_count"]), 5); int rowcount = oz.util.ozstring.parseint(convert.tostring(_params["row_count"]), 5); field count. "); if(fieldcount > 100) throw new ArgumentOutOfRangeException("field_count", "Too big ArrayList fieldnames = new ArrayList(); ArrayList data = new ArrayList(); for(int col = 0; col < fieldcount; col++) fieldnames.add("field" + col); for(int row = 0; row < rowcount; row++) ArrayList rowvalues = new ArrayList(); for(int col = 0; col < fieldcount; col++) rowvalues.add("value - " + row + "," + col); data.add(rowvalues); data)); return new DynamicDataReader(new ArrayListDataReader(fieldNames, public override void FreeDataReader(IDataReader reader) public override void Close() FORCS Co., LTD 61
OZ User Data Store Manual DynamicDataReaderSample.vb Imports System.Web Imports System.Collections Public Class DynamicDataReaderSample Inherits OZUserDataReaderStore Implements IHttpContextRef, IParameterRef Private _ctx As System.Web.HttpContext Private _params As IDictionary Public WriteOnly Property HttpContext() As HttpContext Implements IHttpContextRef.HttpContext Set(ByVal value As HttpContext) Me._ctx = value End Set End Property Public WriteOnly Property Parameters() As IDictionary Implements IParameterRef.Parameters Set(ByVal value As IDictionary) Me._params = value End Set End Property Public Overrides Sub FreeDataReader(ByVal reader As IDataReader) End Sub Public Overrides Function GetDataReader(ByVal command As String) As IDataReader Dim fieldcount As Integer = oz.util.ozstring.parseint(convert.tostring(_params.item("field_count")), 5) Dim rowcount As Integer = oz.util.ozstring.parseint(convert.tostring(_params.item("row_count")), 5) If (fieldcount > 100) Then Throw New ArgumentOutOfRangeException("field_count", "Too big field count. ") End If Dim fieldnames As New ArrayList 62 FORCS Co., LTD
A Leader of Enterprise e-business Solution Dim data As New ArrayList Dim col As Integer For col = 0 To fieldcount - 1 fieldnames.add(("field" & col)) Next col Dim row As Integer For row = 0 To rowcount - 1 Dim rowvalues As New ArrayList For col = 0 To fieldcount - 1 rowvalues.add("value - " & row & "," & col) Next col data.add(rowvalues) Next row Return New oz.uds.dr.dynamicdatareader(new oz.uds.dr.arraylistdatareader(fieldnames, data)) End Function Public Overrides Sub Init() End Sub Public Overrides Sub Close() End Sub End Class oz.uds.dr.arraylistdatareader ArrayList. Constructor Summary public ArrayListDataReader(ArrayList fieldnames, ArrayList data) public ArrayListDataReader(ArrayList fieldnames, ArrayList[] data) public ArrayListDataReader(ArrayList fieldnames, ArrayList datatypes, ArrayList data) FORCS Co., LTD 63
OZ User Data Store Manual public ArrayListDataReader(ArrayList fieldnames, ArrayList datatypes, ArrayList[] data) Constructor Detail Prototype Definition // VARCHAR public ArrayListDataReader(ArrayList fieldnames, ArrayList data) public ArrayListDataReader(ArrayList fieldnames, ArrayList[] data) // VARCHAR public ArrayListDataReader(ArrayList fieldnames, ArrayList datatypes, ArrayList data) public ArrayListDataReader(ArrayList fieldnames, ArrayList datatypes, ArrayList[] data) ArrayList. fieldnames Argument fieldtypes ( System.Type ) data ArrayList ArrayList[] ArrayListDataReaderSample.cs using System; using System.Web; using System.Data; using System.Collections; using oz.uds; using oz.uds.dr; namespace oz.uds.sample.csharp public class ArrayListDataReaderSample : OZUserDataReaderStore, IHttpContextRef, IParameterRef private HttpContext _ctx; private IDictionary _params; public HttpContext HttpContext set _ctx = value; public IDictionary Parameters set _params = value; 64 FORCS Co., LTD
A Leader of Enterprise e-business Solution public ArrayListDataReaderSample() public override void Init() public override IDataReader GetDataReader(string command) ArrayList fieldnames = new ArrayList(); fieldnames.add("field1"); fieldnames.add("field2"); ArrayList fieldtypes = new ArrayList(); fieldtypes.add(typeof(string)); fieldtypes.add(typeof(int)); int rowcount = oz.util.ozstring.parseint(convert.tostring(_params["row_count"]), 5); if("arraylist".equals(_params["return_type"])) ArrayList data = new ArrayList(); for(int i = 0; i < rowcount; i++) ArrayList row = new ArrayList(); row.add("value" + i); row.add(i); data.add(row); data); return new oz.uds.dr.arraylistdatareader(fieldnames, fieldtypes, else if("arraylist[]".equals(_params["return_type"])) ArrayList[] data = new ArrayList[rowCount]; for(int i = 0; i < rowcount; i++) data[i] = new ArrayList(); data[i].add("value" + i); data[i].add(i); FORCS Co., LTD 65
OZ User Data Store Manual data); return new oz.uds.dr.arraylistdatareader(fieldnames, fieldtypes, else log.error("unknown return type. "); return new oz.uds.dr.nulldatareader(); public override void FreeDataReader(IDataReader reader) public override void Close() ArrayListDataReaderSample.vb Imports System.Web Imports System.Collections Imports oz.uds.dr Public Class ArrayListDataReaderSample Inherits OZUserDataReaderStore Implements IHttpContextRef, IParameterRef Private _ctx As System.Web.HttpContext Private _params As IDictionary Public WriteOnly Property HttpContext() As HttpContext Implements IHttpContextRef.HttpContext Set(ByVal value As HttpContext) Me._ctx = value End Set End Property Public WriteOnly Property Parameters() As IDictionary Implements IParameterRef.Parameters 66 FORCS Co., LTD
A Leader of Enterprise e-business Solution Set(ByVal value As IDictionary) Me._params = value End Set End Property Public Overrides Sub FreeDataReader(ByVal reader As IDataReader) End Sub Public Overrides Function GetDataReader(ByVal command As String) As IDataReader Dim fieldnames As New ArrayList fieldnames.add("field1") fieldnames.add("field2") Dim fieldtypes As New ArrayList fieldtypes.add(gettype(string)) fieldtypes.add(gettype(int32)) Dim rowcount As Int32 = oz.util.ozstring.parseint(convert.tostring(_params.item("row_count")), 5) If ("ArrayList".Equals(_params.Item("return_type"))) Then Dim data As New ArrayList Dim i As Integer For i = 0 To rowcount - 1 Dim row As New ArrayList row.add(("value" & i)) row.add(i) data.add(row) Next i Return New ArrayListDataReader(fieldNames, fieldtypes, data) ElseIf ("ArrayList[]".Equals(_params.Item("return_type"))) Then Dim data(rowcount) As ArrayList Dim i As Integer For i = 0 To rowcount - 1 data(i) = New ArrayList data(i).add(("value" & i)) data(i).add(i) Next FORCS Co., LTD 67
OZ User Data Store Manual Return New ArrayListDataReader(fieldNames, fieldtypes, data) Else log.error("unknown return type. ") Return New oz.uds.dr.nulldatareader End If End Function Public Overrides Sub Init() End Sub Public Overrides Sub Close() End Sub End Class oz.uds.dr.nulldatareader null. NullDataReaderSample.cs using System; using System.Web; using System.Data; using System.Collections; using oz.uds; using oz.uds.dr; namespace oz.uds.sample.csharp public class NullDataReaderSample : OZUserDataReaderStore, IHttpContextRef, IParameterRef private HttpContext _ctx; private IDictionary _params; public HttpContext HttpContext set _ctx = value; public IDictionary Parameters set _params = value; 68 FORCS Co., LTD
A Leader of Enterprise e-business Solution public override void Init() public override IDataReader GetDataReader(string command) return new NullDataReader(); public override void FreeDataReader(IDataReader reader) public override void Close() NullDataReaderSample.vb Imports System.Web Imports System.Collections Imports oz.uds.dr Public Class NullDataReaderSample Inherits OZUserDataReaderStore Implements IHttpContextRef, IParameterRef Private _ctx As System.Web.HttpContext Private _params As IDictionary Public WriteOnly Property HttpContext() As HttpContext Implements IHttpContextRef.HttpContext Set(ByVal value As HttpContext) Me._ctx = value End Set End Property Public WriteOnly Property Parameters() As IDictionary Implements IParameterRef.Parameters Set(ByVal value As IDictionary) Me._params = value FORCS Co., LTD 69
OZ User Data Store Manual End Set End Property Public Overrides Sub FreeDataReader(ByVal reader As IDataReader) End Sub Public Overrides Function GetDataReader(ByVal command As String) As IDataReader Return New NullDataReader End Function Public Overrides Sub Init() End Sub Public Overrides Sub Close() End Sub End Class 70 FORCS Co., LTD