Hello Every I Make My First Lbrary And Called DataServer I want To share it
I hope my first library help Every one here
Note:this library is work only with b4a v7.00+
the library will be in next post with example
I hope my first library help Every one here
Note:this library is work only with b4a v7.00+
- LibraryName: DataServer
- Library Auther :Azzam
- How Data Server Work
Data Server Created with All best Subs that make Execute Run Fast Like HandleJobAsync sub and other subs Also Data Server Can Use with All Data Types (sql server, mysql,...) ALSO You Can Hanlde many query in same times And Take Short time Because this data server Is Create every thing To you (Command,Dbrequest,parameters,Handlejob) also I Make some subs To Generate view like spinner and I when I Update it next time I will Add More Funcitons To It.
- Initialize(Target as object,UrlLink as string,EventName as string)
This Library Is used DBRequestResumable Class You must Before Use it Call this sub To Initialize it So You Don't Need To Add DBRequestResumable Class because its with it
Target is the reference to the Activity Or Class who used this library
UrlLink Is The link you Use it in DBRequestResumable for example 'http://192.168.1.100:17178/rdc'
EventName Is the event name that will Used with All event for example 'Shop_TransactionComplete'
B4X:Sub Globals Dim LocalServer as DataServer end sub [*]Sub Activity_Create(FirstTime As Boolean) if FirstTime then localserver.Initialize(Me,"http://192.168.1.100:17178/rdc","Shop") end if end sub sub Shop_TransactionComplete end sub
- GenerateParameter(paramname As Object)
this sub Is For Generate Params you can Call it multi times Or Create Array
B4X:sub GetShopproducts(shopid as int) localserver.GenerateParameter(shopid) 'Or use Array Of Parameters 'localserver.GenerateParameter(array of object(shopid)) end sub
Note:You Must Call It Before Use Other sub Like GenrateTrasaction sub If you don't use it of pass Null as parameter the parameter will not Create If You Query Not have Any parameters you Ignore it Or pass Null To it
B4X:sub GetAllProducts as list localserver.GenerateParameter(Null) 'Or you can Ignore end sub
- Public Sub GenerateMultiparameter(paramsname() As Object)
This Sub Is For Generate multi array of Object And you must use it Only with sub that has 'Multi' keyword like GenerateMultiTransactions and ReturnMultiData
B4X:sub UpdateMultishopsAndProducts(shopid as int,prodid as int) Localserver.GenerateMultiparameter(array(shopid,prodid)) 'OR you Can Add multi array 'Localserver.GenerateMultiparameter(array(array(shopid),array(prodid))) 'Note :IF you use array with Generateparameter sub this will use it as single Parameter ,If you use it with this sub this will use every parameter as single For each Command
- Public Sub Runtransaction(commandname As String)
this sub will run query that not return value like update query and when it complete will fire the event 'TransactionComplete' But Notice that You must use Genrateparameter sub with it If the query has parameters
the library will be in next post with example
Last edited: