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