Working with ADS in the ISAM interface with ADSDBE

This forum is for eXpress++ general support.
Post Reply
Message
Author
User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Working with ADS in the ISAM interface with ADSDBE

#1 Post by Eugene Lutsenko »

Could someone give examples of programs that provide job (basic functions for working with databases) with ADS in the ISAM interface with ADSDBE:
1. Creation of a database on the basis of the structure in a predetermined array.
2. Adding and deleting records.
3. Adjustments to the record field.
4. Create the index array.
5. Search in the database using a key index array.

All this is a great interest to me even at the local use of ADS, which is the local computer. Interestingly, of course, and try the local network, and especially when you place the database on a Web server on the Internet.

Of particular interest to me is the ability to create very large databases much larger in size than 2 GB, with a very large number of fields, to 16,000, and preferably up to 30,000.

I still did not work. An example of the curriculum below.

Code: Select all

// Обучение ADS

#include "ads.ch"
#include "adsdbe.ch"
#include "dcdialog.ch"
#include "dccursor.ch"
#include "Gra.ch     "
#include "xbp.ch     "
#pragma library( "XBTBASE1.LIB" )
#pragma library( "XBTBASE2.LIB" )
#pragma library( "dclipx.lib  " )

PROCEDURE AppSys
// Рабочий стол остается окном приложения
RETURN

   // Загрузить ADSDBE как стандартный механизм базы данных
   PROCEDURE DbeSys
      IF !DbeLoad( "ADSDBE" )
         Alert( "ADSDBE could not be loaded!" ) // ADSDBE не был загружен
      ENDIF
      DbeSetDefault( "ADSDBE" )
  RETURN

  PROCEDURE Main

     // ############################################################

// Соединиться с сервером базы данных

LOCAL cConnect := "DBE=ADSDBE;SERVER=C:\1\"

LOCAL oSession := DacSession():new( cConnect )
LOCAL nErrorCode := oSession:getLastError() 
LOCAL cErrorMsg  := oSession:getLastMessage()

MsgBOX( nErrorCode )
MsgBOX( cErrorMsg )

IF !oSession:isConnected()
   MsgBOX( "Соединение с ADS (сервером) не может быть установлено !!!" )
   QUIT
ELSE
   MsgBOX( "Соединение с ADS (сервером) установлено успешно !!!" )
ENDIF

   DIRCHANGE("C:\1\")   // Перейти в папку с базами данных на сервере

   ****** Если БД ADS1.dbf нет, то создать ее

   cFileName  := "ADS1"
   ********** Rsp_it#.dbf уровень сходства объекта с классом: k-корреляция, i-сумма информации
   aStructure := { { "Kod"  , "N", 15, 0},;   // 1
                   { "Name" , "C",130, 0},;   // 2
                   { "Dost" , "N", 21, 7} }   // 7  (Max_Value-Min_Value)/2

*  FOR j=1 TO 16384  // <=========================================================
   FOR j=1 TO 1500   // <=========================================================
       FieldName = "C"+ALLTRIM(STR(j,21))
       AADD(aStructure, { FieldName  , "N", 21, 7 })
   NEXT
   DbCreate( cFileName, aStructure )

   CLOSE ALL
   USE ADS1 EXCLUSIVE NEW

   * Открыть транзакцию  ###############################################
*   oSession:beginTransaction()

   DO WHILE RECCOUNT() < 70000
      APPEND BLANK
      REPLACE Kod WITH RECNO()
      REPLACE Name WITH "Привет "+STR(RECNO())
   ENDDO

   * Закрыть транзакцию  ###############################################
*   oSession:commitTransaction()

   MsgBox(STR(RECCOUNT()))

   // ############################################################
   // Закрыть базы данных и отсоединиться от сервера.
   DbCloseAll()
   oSession:disconnect()

   RETURN
[/size]

User avatar
unixkd
Posts: 579
Joined: Thu Feb 11, 2010 1:39 pm

Re: Working with ADS in the ISAM interface with ADSDBE

#2 Post by unixkd »

I have used ADSDBE Client/server for more than 15 years, initially with DBF tables which I later converted to ADT tables. From Xbase++ perspective the only requirements is to establish connection to the ADS server. If you are using Xbase++ version 1.9 then several connection methods are available. I prefer connecting to the ADS dictionary. If you use express, Roger has done a great work that will enable you to explore further capabilities of ADS using even ADS API directly. With Express++ you have a Function Called dc_adssession() for connection to ADS server ( Remote/Local)

You will equally find ADS Architect tool very useful. I use it to create my data Dictionary and Tables. However you can also use codes to perform these tasks. Note once you establish connection to ADS and open your tables, all Xbase++ database (table ) functions such as dbAppend(), dbDelete(), dbSkip(), eof(), bof(), FieldPut(), FieldGet() etc will work normally.

Joe.

User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Working with ADS in the ISAM interface with ADSDBE

#3 Post by rdonnay »

I recommend reading the following document:

http://www.sybase.com/files/White_Paper ... ide_wp.pdf
The eXpress train is coming - and it has more cars.

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Working with ADS in the ISAM interface with ADSDBE

#4 Post by Eugene Lutsenko »

unixkd wrote:I have used ADSDBE Client/server for more than 15 years, initially with DBF tables which I later converted to ADT tables. From Xbase++ perspective the only requirements is to establish connection to the ADS server. If you are using Xbase++ version 1.9 then several connection methods are available. I prefer connecting to the ADS dictionary. If you use express, Roger has done a great work that will enable you to explore further capabilities of ADS using even ADS API directly. With Express++ you have a Function Called dc_adssession() for connection to ADS server ( Remote/Local)

You will equally find ADS Architect tool very useful. I use it to create my data Dictionary and Tables. However you can also use codes to perform these tasks. Note once you establish connection to ADS and open your tables, all Xbase++ database (table ) functions such as dbAppend(), dbDelete(), dbSkip(), eof(), bof(), FieldPut(), FieldGet() etc will work normally.

Joe.
Thank you very much!
Perhaps there some simple way to modify the above are debugging a program that it has created no DBF, and ADT database, opened them, modified, closed and disconnected from the ADS? Including using functions that Roger did. I know that what he does is always significantly increases the convenience for developers.

Sure, I'll deal with all of this, but when I get there. I understand that this is necessary and I have "itching", because DBF is too restrictive.

Actually DBF me often enough, but in some cases greater need ADT. With the help of DBF, in principle, can get out, but because of their limitations, it looks artificial, and ADT in these cases is exactly what is needed. This raises the question of the possibility of simultaneous use of DBF (usually) and ADT (sometimes in cases of necessity). For me it is important to be able to create database type ADT is not using the Architect and the software on the structure given in the form of an array or a database, as These structures can be dynamic (depending on the problem) and are too large to describe manually.
Last edited by Eugene Lutsenko on Thu Jun 27, 2013 8:43 am, edited 4 times in total.

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Working with ADS in the ISAM interface with ADSDBE

#5 Post by Eugene Lutsenko »

rdonnay wrote:I recommend reading the following document:

http://www.sybase.com/files/White_Paper ... ide_wp.pdf
Thank you very much!
I'll deal with all of this, but when I get there. I understand that this is necessary and I have "itching", because DBF is too restrictive.

Post Reply