
dsAceTable, derivations of that are created table
specific and represent a table. A table can be here a
physical table, a SQL query, a view or the result of a
stored procedure. There is no distinction between
creation or use.
o table opening
dbTable := OpenAceTable("Customer",
adsConnection/adsDD )
dbTable:gotop()
? dbTable:CUSTID // 4711
if dbTable:rlock()
dbTable:CUSTID := 4712
dbTable:unlock()
endif
? dbTable:alias // CUSTOMER_1
? dbTable:tablename() // CUSTOMER
do while !dbTable:eof()
….
dbTable:skip()
enddo
dbTable:cose()
o indexing
// NTX
dbTable:ordcreate("NAME",,;
"upper(lastname)+Upper(firstname)")
// CDX
dbTable:ordcreate(,"NAME",;
"upper(lastname)+Upper(firstname)")
// ADT,fieldtype CiCharacter,Rawkey Index
dbTable:ordcreate(,"NAME",;
"lastname;firstname")
// descend sort
dbTable:ordcreate(,"NAME",;
"lastname;firstname",,ADS_DESCENDING )
// or special collation
dbTable:ordcreate(,"NAME",;
"lastname;fisrtname",,,,;
"GERMAN_VFP_CI_AS_1252" )
Rawkey indexes are binary and can mix all data types
and are therefore extremely performant!
o and the respective search
// NTX, CDX
dbTable:ordsetfocus("NAME")
dbTable:seek(upper(padr("Müller",20))+;
upper(padr("Alfred",20)))
// ADT, Rawkey Index
dbTable:seek({"Müller","Alfred"})
? dbTable:found()
o filter and scope:
// is evaluated at client side
dbTable:setfilter({|db| myFilter(db)})
// is evaluated at server side
dbTable:setfilter(,"customer=‘Smith‘")
// is optimized by index
dbTable:setaof("customer=‘Smith‘")
// top and bottom scope
dbTable:Setscope(, "BERLIN")
SQL (customer can be a table or view)
dbTable := OpenSqlTable(,"select * from”+;
" customer where name like ‘Smith%’”,;
adsConnection )
SQL with parameters
sqlConn :=;
adsSqlTable():New(adsConnection)
sqlConn:Prepare(;
"SELECT * from customer where city=:P1")
sqlConn:SetParam("P1", "Berlin")
dbTable := sqlConn:Execute2Server()
sqlConn:SetParam("P1", "Hamburg")
dbTable := sqlConn:Execute2Server()
sqlConn:Close()
The table object of a SQL result can be indexed too!
SQL stored procedures
If a stored procedure returns a resultset, it is used like
every other table
sqlConn :=;
adsSqlServer():New(adsConnection)
dbTable := sqlConn:SQL2Table(;
"execute procedure sp_MyProc()")
dsAceMg, ADS management for display and
maintenance of ADS settings and parameters
o display of logged users
o display of opened tables
o display of locked records with the belonging users
o disconnecting of users
dsAdsListening, class for handling notifications
received from ADS Server. Notifications which are
announced previously, can be received and handled in
a thread.
// initialize in MAIN
AdsListening(dsAceDD)
// create dialog with browse
dlgWindow := xbpDialog():New(...)
...
//announce events, browse will be refreshed
// automatically, if a record was saved.
AdsListening():CreateEvent(dlgWindow,,;
"ARTICLE.UPDATE ",;
{|| dlgWindow:oBrowse:RefreshAll()})
More informations for ADS under:
www.sybase.com/products/databasemanagement
An trialversion with full functionality, documentation
and samples can be downlaoded from
www.ds-datasoft.de
Contact:
DS-Datasoft GmbH&Co.KG
An der Kirche 5
D-87654 Friesenried
Tel. (++49) 8347 981370
info@ds-datasoft.de