Documentation
¶
Overview ¶
Package adabas contains Adabas specific Adabas buffer conversion and call functions. The Adabas file metadata will be read and requested field content is returned. The package provides three type of access to the database.
1. The local access using the Adabas client native library. This uses the classic inter process communication method and might use the Entire Network client method accessing databases using the Entire Network server node infrastructure.
2. The new Adabas TCP/IP communication for a direct point-to-point access to the database. This is support since Adabas version v6.7.
Database reference ¶
The Adabas database is referenced using a Adabas database URL. Local databases can be referenced using the database id, the Adabas map or a remote reference with port 0. It is possible to reference remote databases with the host and port directly.
A local database reference: "24", "24","24(adatcp://host:0)".
A remote database reference: "24(adatcp://host:123)"
To use local IPC or Entire Net-Work client related Adabas access, please compile Adabas GO API with ADALNK library references. See documentation here: https://github.com/SoftwareAG/adabas-go-api
Example ¶
Here a short example showing a database read accces using Adabas maps
connection, cerr := NewConnection("acj;map;config=[24,4]") if cerr != nil { return cerr } defer connection.Close() request, rerr := connection.CreateMapReadRequest("EMPLOYEES-NAT-DDM") if rerr != nil { fmt.Println("Error create request", rerr) return rerr } err := request.QueryFields("NAME,FIRST-NAME,PERSONNEL-ID") if !assert.NoError(b, err) { return err } request.Limit = 0 result, rErr := request.ReadLogicalBy("NAME") result.DumpValues()
Read logic ¶
You may read using search values and descriptor sorted searches. The received records can be analyzed using traversation logic. See documentation here: https://github.com/SoftwareAG/adabas-go-api/blob/master/doc/QUERY.md
Adabas maps ¶
For long name and database name usage, a new Adabas map concept is introduced. The Adabas maps are stored inside the database. See documentation here: https://github.com/SoftwareAG/adabas-go-api/blob/master/doc/AdabasMap.md
Stream ¶
It is possible to work with the records just-in-time they received in a stream. A callback function will be called to process the current received record.
Example using stream:
func dumpStream(record *Record, x interface{}) error { i := x.(*uint32) a, _ := record.SearchValue("AE") fmt.Printf("Read %d -> %s = %d\n", record.Isn, a, record.Quantity) (*i)++ return nil } result, err := request.ReadLogicalWithStream("AE='SMITH'", dumpStream, &i)
Struct usage ¶
Example for a structure:
type FullName struct { FirstName string LastName string } type EmployeeMap struct { ID string `adabas:"Id:key"` Name *FullName Department []byte }
For a Adabas Map called EmployeeMap you can use the structure to read and write Adabas data into the database.
Example to read Adabas data using the structure:
request, rerr := connection.CreateMapReadRequest((*EmployeeMap)(nil)) err := request.QueryFields("FullName") result, err = request.ReadLogicalBy("LastName")
The result list of structure entries will be in the result. You can reference the list using the result.Data list. If using the stream callback method, then the stream will get an EmployeesMap instance instead of a Record instance.
Partial large objects ¶
You can read a large objects using the
ReadStream()
method to subdivide a big large object into slices reading parts of the large objects instead of read one big record of the large object. The blocksize read in one stream call is defined in the
ReadRequest.Blocksize
In addition the field definition does have partial lob API to read a part of the partial lob only. A partial lob can be defined using the offset and length in brackets. This query fields will read field RA (Large alpha object) beginning from first entry. It will read a block of size 1000.
err = request.QueryFields("RA(1,1000)")
To define the range in a read or store call procedure, the value instance of the field can set the partial lob range using
partialValue := value.(adatypes.PartialValue) partialValue.SetPartial(offset, uint32(len(data)))
Index ¶
- Constants
- Variables
- func AddGlobalMapRepository(i interface{}, fnr Fnr)
- func AddGlobalMapRepositoryReference(reference string) error
- func AllGlobalMapNames(adabas *Adabas) (maps []string, err error)
- func CleanGlobalMapRepository()
- func DelGlobalMapRepository(i interface{}, fnr Fnr)
- func DelGlobalMapRepositoryReference(reference string) error
- func DumpGlobalMapRepositories()
- func EndAsynchronousMapCache()
- func Endian() binary.ByteOrder
- func PeriodGroup(v adatypes.IAdaValue) adatypes.IAdaValue
- func RegisterExternalDriver(driver ExternalDriver)
- func SearchMapRepository(adabasID *ID, mapName string) (adabasMap *Map, repository *Repository, err error)
- func StartAsynchronousMapCache(interval int)
- func TimeTrack(start time.Time, name string, adabas *Adabas)
- type AID
- type Abd
- type Acbx
- type AdaTCP
- func (connection *AdaTCP) Connect(adabas *Adabas) (err error)
- func (connection *AdaTCP) Disconnect() (err error)
- func (connection *AdaTCP) ReceiveData(buffer *bytes.Buffer, expected TransferDataType) (nrAbdBuffers uint32, err error)
- func (connection *AdaTCP) Send(adabas *Adabas) (err error)
- func (connection *AdaTCP) SendData(buffer bytes.Buffer, nrAbdBuffers uint32) (err error)
- type AdaTCPConnectPayload
- type AdaTCPDataHeader
- type AdaTCPHeader
- type Adabas
- func (adabas *Adabas) ACBX() *Acbx
- func (adabas *Adabas) BackoutTransaction() (err error)
- func (adabas *Adabas) CallAdabas() (err error)
- func (adabas *Adabas) Close()
- func (adabas *Adabas) DeleteIsn(fileNr Fnr, isn adatypes.Isn) (err error)
- func (adabas *Adabas) DumpStatistics()
- func (adabas *Adabas) EndTransaction() (err error)
- func (adabas *Adabas) Histogram(fileNr Fnr, adabasRequest *adatypes.Request, x interface{}) (err error)
- func (adabas *Adabas) Open() (err error)
- func (adabas *Adabas) OpenUser(user string) (err error)
- func (adabas *Adabas) ReadBuffer(buffer *bytes.Buffer, order binary.ByteOrder, nCalBuf uint32, serverMode bool) (err error)
- func (adabas *Adabas) ReadFileDefinition(fileNr Fnr) (definition *adatypes.Definition, err error)
- func (adabas *Adabas) ReadISNOrder(fileNr Fnr, adabasRequest *adatypes.Request, x interface{}) (err error)
- func (adabas *Adabas) ReadLogicalWith(fileNr Fnr, adabasRequest *adatypes.Request, x interface{}) (err error)
- func (adabas *Adabas) ReadPhysical(fileNr Fnr, adabasRequest *adatypes.Request, x interface{}) (err error)
- func (adabas *Adabas) ReadStream(adabasRequest *adatypes.Request, offset uint64, x interface{}) (err error)
- func (adabas *Adabas) ReleaseCmdID() (err error)
- func (adabas *Adabas) ReleaseHold(fileNr Fnr) (err error)
- func (adabas *Adabas) SearchLogicalWith(fileNr Fnr, adabasRequest *adatypes.Request, x interface{}) (err error)
- func (adabas *Adabas) SendSecondCall(adabasRequest *adatypes.Request, x interface{}) (err error)
- func (adabas *Adabas) SetAbd(abd []*Buffer)
- func (adabas *Adabas) SetDbid(dbid Dbid)
- func (adabas *Adabas) SetURL(URL *URL)
- func (adabas *Adabas) Store(fileNr Fnr, adabasRequest *adatypes.Request) (err error)
- func (adabas *Adabas) String() string
- func (adabas *Adabas) Update(fileNr Fnr, adabasRequest *adatypes.Request) (err error)
- func (adabas *Adabas) WriteBuffer(buffer *bytes.Buffer, order binary.ByteOrder, serverMode bool) (err error)
- type Buffer
- func (adabasBuffer *Buffer) Allocate(size uint32)
- func (adabasBuffer *Buffer) Bytes() []byte
- func (adabasBuffer *Buffer) Clear()
- func (adabasBuffer *Buffer) ID() rune
- func (adabasBuffer *Buffer) Received() uint64
- func (adabasBuffer *Buffer) Size() uint64
- func (adabasBuffer *Buffer) String() string
- func (adabasBuffer *Buffer) WriteBinary(content []byte)
- func (adabasBuffer *Buffer) WriteString(content string)
- type BufferType
- type CallStatistic
- type Connection
- func (connection *Connection) AddCredential(user string, pwd string)
- func (connection *Connection) BackoutTransaction() error
- func (connection *Connection) Close()
- func (connection *Connection) CreateDeleteRequest(fnr Fnr) (*DeleteRequest, error)
- func (connection *Connection) CreateFileReadRequest(fnr Fnr) (*ReadRequest, error)
- func (connection *Connection) CreateMapDeleteRequest(param ...interface{}) (request *DeleteRequest, err error)
- func (connection *Connection) CreateMapReadRequest(param ...interface{}) (request *ReadRequest, err error)
- func (connection *Connection) CreateMapStoreRequest(param ...interface{}) (request *StoreRequest, err error)
- func (connection *Connection) CreateMapWithInterface(mapName string, fieldList string) (request *ReadRequest, err error)
- func (connection *Connection) CreateReadRequest() (request *ReadRequest, err error)
- func (connection *Connection) CreateStoreRequest(fnr Fnr) (*StoreRequest, error)
- func (connection *Connection) EndTransaction() error
- func (connection *Connection) GetClusterNodes() []*URL
- func (connection *Connection) IsCluster() bool
- func (connection *Connection) Open() error
- func (connection *Connection) ReadRequest(p ...interface{}) (request *ReadRequest, err error)
- func (connection *Connection) ReflectSearch(mapName string, t reflect.Type, search string) ([]interface{}, error)
- func (connection *Connection) ReflectStore(entries interface{}, mapName string) error
- func (connection *Connection) Release() error
- func (connection *Connection) ReleaseCID() error
- func (connection *Connection) String() string
- type Cursoring
- type DatabaseURL
- type Dbid
- type DeleteRequest
- func NewDeleteRequestAdabas(adabas *Adabas, fnr Fnr) *DeleteRequest
- func NewDeleteRequestDeprecated(url string, fnr Fnr) (*DeleteRequest, error)
- func NewMapDeleteRequest(adabas *Adabas, adabasMap *Map) (request *DeleteRequest, err error)
- func NewMapNameDeleteRequest(adabas *Adabas, mapName string) (request *DeleteRequest, err error)
- func NewMapNameDeleteRequestRepo(mapName string, adabas *Adabas, mapRepository *Repository) (request *DeleteRequest, err error)
- func (request *DeleteRequest) BackoutTransaction() error
- func (request *DeleteRequest) Close()
- func (deleteRequest *DeleteRequest) Delete(isn adatypes.Isn) (err error)
- func (deleteRequest *DeleteRequest) DeleteList(isnList []adatypes.Isn) (err error)
- func (request *DeleteRequest) EndTransaction() error
- func (request *DeleteRequest) IsOpen() bool
- func (deleteRequest *DeleteRequest) Open() (opened bool, err error)
- func (request *DeleteRequest) TraverseFields(t adatypes.TraverserMethods, p interface{}) error
- type Driver
- type Error
- type ExternalDriver
- type Fnr
- type ID
- type InterfaceFunction
- type Map
- type MapField
- type MapFile
- type ReadRequest
- func (request *ReadRequest) BackoutTransaction() error
- func (request *ReadRequest) Close()
- func (request *ReadRequest) EndTransaction() error
- func (request *ReadRequest) HistogramBy(descriptor string) (result *Response, err error)
- func (request *ReadRequest) HistogramByCursoring(descriptor string) (cursor *Cursoring, err error)
- func (request *ReadRequest) HistogramWith(search string) (result *Response, err error)
- func (request *ReadRequest) HistogramWithCursoring(search string) (cursor *Cursoring, err error)
- func (request *ReadRequest) HistogramWithStream(search string, streamFunction StreamFunction, x interface{}) (result *Response, err error)
- func (request *ReadRequest) IsOpen() bool
- func (request *ReadRequest) Open() (opened bool, err error)
- func (request *ReadRequest) QueryFields(fieldq string) (err error)
- func (request *ReadRequest) ReadByISN() (result *Response, err error)
- func (request *ReadRequest) ReadISN(isn adatypes.Isn) (result *Response, err error)
- func (request *ReadRequest) ReadISNWithParser(isn adatypes.Isn, resultParser adatypes.RequestParser, x interface{}) (err error)
- func (request *ReadRequest) ReadLOBRecord(isn adatypes.Isn, field string, blocksize uint64) (result *Response, err error)
- func (request *ReadRequest) ReadLOBSegment(isn adatypes.Isn, field string, blocksize uint64) (segment []byte, err error)
- func (request *ReadRequest) ReadLobStream(search, field string) (cursor *Cursoring, err error)
- func (request *ReadRequest) ReadLogicalBy(descriptors string) (result *Response, err error)
- func (request *ReadRequest) ReadLogicalByCursoring(descriptor string) (cursor *Cursoring, err error)
- func (request *ReadRequest) ReadLogicalByStream(descriptor string, streamFunction StreamFunction, x interface{}) (result *Response, err error)
- func (request *ReadRequest) ReadLogicalByWithParser(descriptors string, resultParser adatypes.RequestParser, x interface{}) (err error)
- func (request *ReadRequest) ReadLogicalWith(search string) (result *Response, err error)
- func (request *ReadRequest) ReadLogicalWithCursoring(search string) (cursor *Cursoring, err error)
- func (request *ReadRequest) ReadLogicalWithInterface(search string, interfaceFunction InterfaceFunction, x interface{}) (result *Response, err error)
- func (request *ReadRequest) ReadLogicalWithStream(search string, streamFunction StreamFunction, x interface{}) (result *Response, err error)
- func (request *ReadRequest) ReadLogicalWithWithParser(search string, resultParser adatypes.RequestParser, x interface{}) (err error)
- func (request *ReadRequest) ReadPhysicalInterface(interfaceFunction InterfaceFunction, x interface{}) (result *Response, err error)
- func (request *ReadRequest) ReadPhysicalSequence() (result *Response, err error)
- func (request *ReadRequest) ReadPhysicalSequenceStream(streamFunction StreamFunction, x interface{}) (result *Response, err error)
- func (request *ReadRequest) ReadPhysicalSequenceWithParser(resultParser adatypes.RequestParser, x interface{}) (err error)
- func (request *ReadRequest) ReadPhysicalWithCursoring() (cursor *Cursoring, err error)
- func (request *ReadRequest) Scan(dest ...interface{}) error
- func (request *ReadRequest) SearchAndOrder(search, descriptors string) (result *Response, err error)
- func (request *ReadRequest) SearchAndOrderWithCursoring(search, descriptors string) (cursor *Cursoring, err error)
- func (request *ReadRequest) SearchAndOrderWithParser(search, descriptors string, resultParser adatypes.RequestParser, x interface{}) (err error)
- func (request *ReadRequest) SetHoldRecords(hold adatypes.HoldType)
- func (request *ReadRequest) TraverseFields(t adatypes.TraverserMethods, p interface{}) error
- type Record
- func (record *Record) Bytes(parameter ...interface{}) []byte
- func (record *Record) DumpValues()
- func (record *Record) MarshalJSON() ([]byte, error)
- func (record *Record) MarshalXML(e *xml.Encoder, start xml.StartElement) error
- func (record *Record) Scan(dest ...interface{}) (err error)
- func (record *Record) SearchValue(parameter ...interface{}) (adatypes.IAdaValue, error)
- func (record *Record) SearchValueIndex(name string, index []uint32) (adatypes.IAdaValue, error)
- func (record *Record) SetPartialValue(name string, offset uint32, data []byte) (err error)
- func (record *Record) SetValue(field string, value interface{}) (err error)
- func (record *Record) SetValueWithIndex(name string, index []uint32, x interface{}) error
- func (record *Record) String() string
- func (record *Record) Traverse(t adatypes.TraverserValuesMethods, x interface{}) (ret adatypes.TraverseResult, err error)
- func (record *Record) TrimString(parameter ...interface{}) string
- func (record *Record) ValueQuantity(param ...interface{}) int32
- type Repository
- func (repository *Repository) AddMapToCache(name string, adabasMap *Map)
- func (repository *Repository) ClearCache(maxTime time.Time)
- func (repository *Repository) DeleteMap(adabas *Adabas, mapName string) (err error)
- func (repository *Repository) ExportMapRepository(ada *Adabas, filter string, fileName string) (err error)
- func (repository *Repository) GetMapFromCache(name string) (*Map, bool)
- func (repository *Repository) ImportMapRepository(adabas *Adabas, filter string, fileName string, mapURL *DatabaseURL) (maps []*Map, err error)
- func (repository *Repository) LoadAllMaps(adabas *Adabas) (adabasMaps []*Map, err error)
- func (repository *Repository) LoadMapRepository(adabas *Adabas) (err error)
- func (repository *Repository) RemoveMap(mapName string) (err error)
- func (repository *Repository) SearchMap(adabas *Adabas, mapName string) (adabasMap *Map, err error)
- func (repository *Repository) SearchMapInRepository(adabas *Adabas, mapName string) (adabasMap *Map, err error)
- type Response
- func (Response *Response) DumpData() (err error)
- func (Response *Response) DumpValues() (err error)
- func (Response *Response) Isn(isn adatypes.Isn) *Record
- func (Response *Response) MarshalJSON() ([]byte, error)
- func (Response *Response) MarshalXML(e *xml.Encoder, start xml.StartElement) error
- func (Response *Response) NrRecords() int
- func (Response *Response) String() string
- func (Response *Response) TraverseValues(t adatypes.TraverserValuesMethods, x interface{}) (ret adatypes.TraverseResult, err error)
- type Statistics
- type Status
- type StoreRequest
- func (request *StoreRequest) BackoutTransaction() error
- func (request *StoreRequest) Close()
- func (request *StoreRequest) CreateRecord() (record *Record, err error)
- func (request *StoreRequest) EndTransaction() error
- func (request *StoreRequest) Exchange(storeRecord *Record) error
- func (request *StoreRequest) IsOpen() bool
- func (request *StoreRequest) Open() (err error)
- func (request *StoreRequest) Store(storeRecord *Record) error
- func (request *StoreRequest) StoreData(data ...interface{}) error
- func (request *StoreRequest) StoreFields(param ...interface{}) (err error)
- func (request *StoreRequest) TraverseFields(t adatypes.TraverserMethods, p interface{}) error
- func (request *StoreRequest) Update(storeRecord *Record) error
- func (request *StoreRequest) UpdateData(data ...interface{}) error
- type StreamFunction
- type TransferDataType
- type URL
Examples ¶
- Adabas (ReadFileDefinition9)
- Adabas (ReadFileDefinition9RestrictF0)
- Adabas (ReadFileDefinition9Restricted)
- Adabas (ReadFileDefinitionFile11)
- Adabas (ResetAcbx)
- Connection (EndTransaction)
- Connection (Map)
- Connection (MapReadDisjunctSearch)
- Connection (MapReadUnicode)
- Connection (MapReadUnicodeNew)
- Connection (MapStore)
- Connection (MarhsalJSON)
- Connection (MarhsalJSONComplete)
- Connection (MultiplefieldIndex)
- Connection (PeriodGroup)
- Connection (PeriodGroup2)
- Connection (PeriodGroupLastEntry)
- Connection (PeriodGroupPart)
- Connection (ReadFileDefinitionMapGroup)
- Connection (ReadIsn)
- Connection (ReadLogicalWith)
- Connection (ReadLongMapIsn)
- Connection (ReadLongMapRange)
- Connection (ReadShortMap)
- Connection (ReadWithMap)
- Connection (ReadWithMapFormatted)
- Connection (SingleIndex)
- Connection (Store)
- Connection (WideCharacter)
- ParseJSONFileForFields
- ReadRequest (HistogramWith)
- ReadRequest (HistogramWithStream)
- ReadRequest (ReadAllFields)
- ReadRequest (ReadGroup)
- ReadRequest (ReadISN)
- ReadRequest (ReadLogicalWithCursoringLimit)
- ReadRequest (ReadPhysical)
- ReadRequest.ReadLogicalBy
- ReadRequest.ReadLogicalWithCursoring
- Record (DumpZeroValues)
- Record (SetValue)
- Record (SetValueWithIndex)
- Response (JsonMarshal)
- Response (XmlMarshal)
Constants ¶
const ( // AdaNormal Normal successful completion (Adabas response code 0) AdaNormal = 0 // AdaISNNotSorted ISN list not sorted (Adabas response code 1) AdaISNNotSorted = 1 // AdaFuncMP Function not completely executed (Adabas response code 2) AdaFuncMP = 2 // AdaEOF Adabas End of File reached (Adabas response code 3) AdaEOF = 3 // AdaSExpandedFiles S2/S9 is not allowed for expanded files AdaSExpandedFiles = 4 // AdaVCompression Error in system view compression AdaVCompression = 5 // AdaSXInterrupted SX command interrupted because of timeout AdaSXInterrupted = 7 // AdaTransactionAborted Transaction aborted (Adabas response code 9) AdaTransactionAborted = 9 // AdaTooManyOccurrencesPeriod Too many occurrences for a periodic group AdaTooManyOccurrencesPeriod = 10 // AdaDDLCommandFailed DDL command has failed (Adabas response code 15) AdaDDLCommandFailed = 15 // AdaSubCommandFailed A subcommand of the MC call has failed (Adabas response code 16) AdaSubCommandFailed = 16 // AdaInvalidFileNumber Invalid or unauthorized file number (Adabas response code 17) AdaInvalidFileNumber = 17 // AdaFileChanged File number changed during command sequence (Adabas response code 18) AdaFileChanged = 18 // AddACCCNotAllowed Command not allowed for ACC user (Adabas response code 19) AddACCCNotAllowed = 19 // AdaInvalidCID Invalid command identification (CID) value (Adabas response code 20) AdaInvalidCID = 20 // AdaInconsistentCmd Inconsistent usage of a command (Adabas response code 21) AdaInconsistentCmd = 21 // AdaCmdInvalid Invalid command code (Adabas response code 22) AdaCmdInvalid = 22 // AdaInvalidStartISN Invalid ISN starting value for L2/L5 (Adabas response code 23) AdaInvalidStartISN = 23 // AdaInvalidIsnBuf Invalid ISN found in ISN-buffer (Adabas response code 24) AdaInvalidIsnBuf = 24 // AdaISNLL ISN specified in ISN-LL for subsequent S1/S2 not found (Adabas response // code 25) AdaISNLL = 25 // AdaInvalidISNBufferLength Invalid ISN-buffer length or invalid ISN-Quantity (Adabas response code // 26) AdaInvalidISNBufferLength = 26 // AdaLPWSmall LWP parameter too small (for given SBL/VBL) (Adabas response code 28) AdaLPWSmall = 27 // AdaInvalidADD1 Invalid ADDITION-1 contents for L3/L6/S9 (Adabas response code 28) AdaInvalidADD1 = 28 // AdaMissingVOPT Missing V option during forced value start during L3/L6 (Adabas response // code 29) AdaMissingVOPT = 29 // AdaInvalidCOP An invalid command option has been detected. AdaInvalidCOP = 34 // AdaSyntax Syntax error in format buffer (Adabas response code 40) AdaSyntax = 40 // AdaErrorFB Error in format buffer (Adabas response code 41) AdaErrorFB = 41 // AdaIFBSmall Internal format buffer too small to store format (Adabas response code 42) AdaIFBSmall = 42 // AdaIncosistentDE Inconsistent Descriptor definition for L9 (Adabas response code 43) AdaIncosistentDE = 43 // AdaFBNotUsableUpdate Format buffer cannot be used for update (Adabas response code 44) AdaFBNotUsableUpdate = 44 // AdaFieldCountOverflow Field count for PE or MU overflowed when using N-option for update // (Adabas response code 45) AdaFieldCountOverflow = 45 // AdaMismatchFB Mismatch of format buffer usage for supplied command ID (Adabas response // code 46) AdaMismatchFB = 46 // AdaHoldIsnOverflow Maximum number of ISNs held by a single user are reached (Adabas response // code 48) AdaHoldIsnOverflow = 47 // AdaFUNotAvaiable File(s) / user ID not available at open time (Adabas response code 48) AdaFUNotAvaiable = 48 // AdaCompressTooLong Compressed record too long (Adabas response code 49) AdaCompressTooLong = 49 // AdaSYRBO Syntax error in record buffer for open (Adabas response code 50) AdaSYRBO = 50 // AdaInvalidRBOpen Invalid record buffer Contents During Open (Adabas response code 51) AdaInvalidRBOpen = 51 // AdaInvalidRBVB Invalid data in record buffer or value buffer (Adabas response code 52) AdaInvalidRBVB = 52 // AdaRbts Record buffer too short (Adabas response code 53) AdaRbts = 53 // AdaRbtl Record buffer too long for C3,C5,ET (Adabas response code 54) AdaRbtl = 54 // AdaIncompFCTE Incompatible format conversion or truncation error (Adabas response code 55) AdaIncompFCTE = 55 // AdaDescrLong Descriptor value too long (Adabas response code 56) AdaDescrLong = 56 // AdaDSpec Unknown Descriptor specification in search buffer for L9 (Adabas response // code 57) AdaDSpec = 57 // AdaFNFCR Format not found according to selection criterion (Adabas response code // 58) AdaFNFCR = 58 // AdaFCONVSUB Format conversion for subfield not possible (Adabas response code 59) AdaFCONVSUB = 59 // AdaSYSBU Syntax error in search buffer (Adabas response code 60) AdaSYSBU = 60 // AdaERSBU Error in search buffer (Adabas response code 61) AdaERSBU = 61 // AdaLSPEC Inconsistent length specification in search and value buffer (Adabas // response code 62) AdaLSPEC = 62 // AdaUCIDS Unknown command identification (CID) in search buffer (Adabas response // code 63) AdaUCIDS = 63 // AdaUAOS Error in communication with Adabas utilities or Adabas Online System // (AOS) (Adabas response code 64) AdaUAOS = 64 // AdaSCALERR Space calculation error (Adabas response code 65) AdaSCALERR = 65 // AdaICNF Invalid client number specification (Adabas response code 66) AdaICNF = 66 // AdaIEDEC Internal error during decompressing of superfields (Adabas response code // 67) AdaIEDEC = 67 // AdaNDSOFF Nondescriptor search issued though facility is off (Adabas response code // 78) AdaNDSOFF = 68 // AdaNSSC No space in table of sequential commands (Adabas response code 70) AdaNSSC = 70 // AdaNSSR No space in table of search results (Adabas response code 71) AdaNSSR = 71 // AdaNSUQU No space available for user in user queue (Adabas response code 72) AdaNSUQU = 72 // AdaNSWRK No space available for search result in WORK (Adabas response code 73) AdaNSWRK = 73 // AdaNTWRK No temporary space on WORK for search command (Adabas response code 74) AdaNTWRK = 74 // AdaEXOVFCB Extent overflow in File Control Block (FCB) (Adabas response code 75) AdaEXOVFCB = 75 // AdaOVIDX An overflow occured in an inverted list index (Adabas response code 76) AdaOVIDX = 76 // AdaNSAAD No Space available for ASSO/DATA (Adabas response code 77) AdaNSAAD = 77 // AdaOVFST Free Space Table (FST) overflow (Adabas response code 78) AdaOVFST = 78 // AdaHYXNA Hyperdescriptor not available (Adabas response code 79) AdaHYXNA = 79 // AdaHYISNMF MF: Invalid ISN from hyperexit (Adabas response code 83) AdaHYISNMF = 82 // AdaHYISN OS: Invalid ISN from hyperexit, MF: A hypertable overflow occurred. // (Adabas response code 83) AdaHYISN = 83 // AdaWOSUB Workpool overflow during sub/super update (Adabas response code 84) AdaWOSUB = 84 // AdaOVDVT DVT overflow during update command (Adabas response code 85) AdaOVDVT = 85 // AdaHYPERR Hyperdescriptor error (Adabas response code 86) AdaHYPERR = 86 // AdaBPLOCK Hyperdescriptor error (Adabas response code 87) AdaBPLOCK = 87 // AdaINMEM Insufficient memory (Adabas response code 88) AdaINMEM = 88 // AdaUNIQD Unique descriptor already present (Adabas response code 98) AdaUNIQD = 98 // AdaIOERR I/O error (Adabas response code 99) AdaIOERR = 99 // AdaINVIS Invalid ISN for HI,N2 or L1/L4 (Adabas response code 113) AdaINVIS = 113 // AdaINVRF Refresh file not permitted (Adabas response code 114) AdaINVRF = 114 // AdaLOBERR Internal error during LOB file processing (Adabas response code 132) AdaLOBERR = 132 // AdaNLOCK ISN to be updated not held by user (Adabas response code 144) AdaNLOCK = 144 // AdaALOCK ISN already held by some other user (Adabas response code 145) AdaALOCK = 145 // AdaBSPEC Invalid buffer length specification (Adabas response code 146) AdaBSPEC = 146 // AdaUBNAC User buffer not accessible (Adabas response code 147) AdaUBNAC = 147 // AdaAnact Adabas is not active or accessible (Adabas response code 148) AdaAnact = 148 // AdaSysCe System communication error (Adabas response code 149) AdaSysCe = 149 // AdaNUCLI Too many nuclei used in parallel (Adabas response code 150) AdaNUCLI = 150 // AdaNSACQ No space available in command queue (Adabas response code 151) AdaNSACQ = 151 // AdaIUBSZ User buffer greater than IUB size (Adabas response code 152) AdaIUBSZ = 152 // AdaPending Adabas call already pending (Adabas response code 153) AdaPending = 153 // AdaCancel Adabas call canceled (Adabas response code 154) AdaCancel = 154 // AdaBPMFU All buffer pool space is used (Adabas response code 162) AdaBPMFU = 162 // AdaNODESC Error in inverted list - descriptor not found (Adabas response code 165) AdaNODESC = 165 // AdaNODV Error in inverted list - DV not found (Adabas response code 166) AdaNODV = 166 // AdaUQDV Error in inverted list - DV already present (Adabas response code 167) AdaUQDV = 167 // AdaINRAB Invalid RABN (Adabas response code 170) AdaINRAB = 170 // AdaISNVAL ISN value invalid (ISN=0 or ISN>MAXISN) (Adabas response code 172) AdaISNVAL = 172 // AdaDARAB Invalid DATA RABN (Adabas response code 173) AdaDARAB = 173 // AdaINVLIST Error in inverted list (Adabas response code 176) AdaINVLIST = 176 // AdaMISAC Record cannot be located in DATA storage block as indicated by AC (Adabas // response code 177) AdaMISAC = 177 // AdaETDAT Necessary ET-data was not found in appropriate WORK block (Adabas // response code 182) AdaETDAT = 182 // AdaSECUR Security violation (Adabas response code 200) AdaSECUR = 200 // AdaINVPWD Invalid password (Adabas response code 201) AdaINVPWD = 201 // AdaNFPWD Invalid password for used file (Adabas response code 202) AdaNFPWD = 202 // AdaPWDINU Password already in use (Adabas response code 204) AdaPWDINU = 204 // AdaSAF SAF security login required (Adabas response code 208) AdaSAF = 208 // AdaINVUSR SAF security invalid user (Adabas response code 208) AdaINVUSR = 209 // AdaBLOST receive buffer lost (Adabas response code 210) AdaBLOST = 210 // AdaRMUTI Only local utility usage allowed (Adabas response code 211) AdaRMUTI = 211 // AdaNOTYET Functionality not yet implemented (Adabas response code 212) AdaNOTYET = 212 // AdaLNKERR This response is issued by an Adabas link routine (Adabas response code // 228) AdaLNKERR = 228 // AdaTIMEOUT Connection timeout (Adabas response code 224) AdaTIMEOUT = 224 // AdaXAProtocol Mismatch in the calling protocol (Adabas response code 230) AdaXAProtocol = 230 // AdaLODUEX User exit / SPT load error (Adabas response code 241) AdaLODUEX = 241 // AdaALLOC Double allocation error. (Adabas response code 242) AdaALLOC = 242 // AdaGCBEX Invalid GCB / FCB extent detected (Adabas response code 243) AdaGCBEX = 243 // AdaUTUCB Pending utility entries in UCB (Adabas response code 245) AdaUTUCB = 245 // AdaOVUCB Utility communicaton block (UCB) overflow (Adabas response code 246) AdaOVUCB = 246 // AdaIDUCB Correct Ident not found in UCB (Adabas response code 247) AdaIDUCB = 247 // AdaFCTNY Function not yet implemented (Adabas response code 250) AdaFCTNY = 250 // AdaIUCAL Invalid utility call (Adabas response code 251) AdaIUCAL = 251 // AdaCALLINV Invalid function call - coding error (Adabas response code 252) AdaCALLINV = 252 // AdaSYLOD System file not loaded or inconsistent (Adabas response code 253) AdaSYLOD = 253 // AdaBPOLL Insufficient space in attached buffer (Adabas response code 255) AdaBPOLL = 255 )
const ( AbdAQFb = ('F') /* F-Format Buffer */ AbdAQRb = ('R') /* R-Record Buffer */ AbdAQSb = ('S') /* S-Search Buffer */ AbdAQVb = ('V') /* V-Value Buffer */ AbdAQIb = ('I') /* I-ISN Buffer */ AbdAQPb = ('P') /* Performance Buffer */ AbdAQMb = ('M') /* Multifetch Buffer */ AbdAQUi = ('U') /* U-User Info */ AbdAQOb = ('O') /* I/O Buffer (internal) */ AbdAQXb = ('X') /* CLEX Info Buffer (internal) */ AbdAQZb = ('Z') /* Security Buffer (internal) */ AbdEQFb = 0xc6 /* EBCDIC F-Format Buffer */ AbdEQRb = 0xd9 /* EBCDIC R-Record Buffer */ AbdEQSb = 0xe2 /* EBCDIC S-Search Buffer */ AbdEQVb = 0xe5 /* EBCDIC V-Value Buffer */ AbdEQIb = 0xc9 /* EBCDIC I-ISN Buffer */ AbdEQPb = 0xd7 /* EBCDIC Performance Buffer */ AbdEQMb = 0xd4 /* EBCDIC Multifetch Buffer */ AbdEQUi = 0xe4 /* EBCDIC User Info */ AbdEQOb = 0xd6 /* EBCDIC I/O Buffer (internal) */ ABdEQXb = 0xe7 /* EBCDIC CLEX Info Buffer */ AbdEQZb = 0xe9 /* EBCDIC Security Buffer */ )
const E_ABD_EYECATCHER = 0xc7 /* EBCDIC G - EYECATCHER */ const E_ABD_VERSION = 0xf2 /* EBCDIC 2 - VERSION */
const ( // ConnectRequest connect ConnectRequest = BufferType(1) // ConnectReply reply after first connect ConnectReply = BufferType(2) // ConnectError connection errror ConnectError = BufferType(3) // DisconnectRequest disconnect request DisconnectRequest = BufferType(4) // DisconnetReply disconnect reply DisconnetReply = BufferType(5) // DisconnectError disconnect error DisconnectError = BufferType(6) // DataRequest data request DataRequest = BufferType(7) // DataReply data reply DataReply = BufferType(8) // DataError data error DataError = BufferType(9) )
const AdaTCPConnectPayloadLength = 72
AdaTCPConnectPayloadLength ADATCP connect payload
const AdaTCPDataHeaderLength = 24
AdaTCPDataHeaderLength length of AdaTCPDataHeader structure
const AdaTCPHeaderLength = 40
AdaTCPHeaderLength length of AdaTCPHeader structure
const MaxDatabasesID = 65536
MaxDatabasesID maximum valid database id
Variables ¶
var BuildDate string
BuildDate build date
var BuildVersion string
BuildVersion build version
Functions ¶
func AddGlobalMapRepository ¶ added in v1.1.1
func AddGlobalMapRepository(i interface{}, fnr Fnr)
AddGlobalMapRepository this method adds a Adabas Map repository used to search for a used Adabas Map. This repository is defined global.
func AddGlobalMapRepositoryReference ¶ added in v1.2.1
AddGlobalMapRepositoryReference this method adds a Adabas Map repository used to search for a used Adabas Map. This repository is defined global.
func AllGlobalMapNames ¶ added in v1.2.1
AllGlobalMapNames provides all Adabas Map names defined in the in global defined repositories
func CleanGlobalMapRepository ¶ added in v1.3.5
func CleanGlobalMapRepository()
CleanGlobalMapRepository this methods removes all global defined repositories in the Adabas Map repository.
func DelGlobalMapRepository ¶ added in v1.1.1
func DelGlobalMapRepository(i interface{}, fnr Fnr)
DelGlobalMapRepository this method removes a global map repository entry.
func DelGlobalMapRepositoryReference ¶ added in v1.2.1
DelGlobalMapRepositoryReference this method removes a global map repository entry.
func DumpGlobalMapRepositories ¶ added in v1.1.1
func DumpGlobalMapRepositories()
DumpGlobalMapRepositories dump global map repositories
func EndAsynchronousMapCache ¶ added in v1.2.8
func EndAsynchronousMapCache()
EndAsynchronousMapCache the Map cache update thread is initiated to end asynchronous cache update.
func PeriodGroup ¶ added in v1.2.8
PeriodGroup return if it is part of an period group return the period group field of level 1. If no period group field, returns nil
func RegisterExternalDriver ¶ added in v1.5.10
func RegisterExternalDriver(driver ExternalDriver)
RegisterExternalDriver register external drivers
func SearchMapRepository ¶
func SearchMapRepository(adabasID *ID, mapName string) (adabasMap *Map, repository *Repository, err error)
SearchMapRepository searchs in global-defined Adabas Map repositories for a specific map name
func StartAsynchronousMapCache ¶ added in v1.2.8
func StartAsynchronousMapCache(interval int)
StartAsynchronousMapCache this method starts a thread which update the map cache periodically. The asynchronous Map cache is a repository Adabas Map cache which is asked for Adabas Maps defined. The given interval is the interval the cache is updated.
Types ¶
type AID ¶
type AID struct { Node [8]byte User [8]byte Pid uint32 Timestamp uint64 // contains filtered or unexported fields }
AID Adabas id
type Abd ¶
type Abd struct { Abdlen uint16 /* +00 ABD Length */ Abdver [2]byte /* +02 Version: */ Abdid byte /* +04 Buffer ID: */ Abdrsv1 byte /* +05 Reserved - must be 0x00 */ Abdloc byte /* +06 Buffer location flag: */ Abdrsv2 [9]byte /* +07 Reserved - must be 0x00 */ Abdsize uint64 /* +10 Buffer Size */ Abdsend uint64 /* +18 Len to send to database */ Abdrecv uint64 /* +20 Len received from database */ Abdaddr uint64 /* +28 8 byte aligned 64bit Ptr */ }
Abd Adabas Buffer definition. Representation of ABD structure in the GO environment.
type Acbx ¶
type Acbx struct { Acbxtyp byte /* +00 ADALNK function code */ Acbxrsv1 byte /* +01 Reserved - must be 0x00 */ Acbxver [2]byte /* +02 Version: */ Acbxlen uint16 /* +04 ACBX Length */ Acbxcmd [2]byte /* +06 Command Code */ Acbxrsv2 uint16 /* +08 Reserved - must be 0x00 */ Acbxrsp uint16 /* +0A Response code */ Acbxcid [4]byte /* +0C Command ID */ Acbxdbid Dbid /* +10 Database ID */ Acbxfnr Fnr /* +14 File number */ Acbxisn adatypes.Isn /* +18 ISN */ Acbxisl uint64 /* +20 ISN Lower Limit */ Acbxisq uint64 /* +28 ISN Quantity */ Acbxcop [8]byte /* +30 Command option 1-8 */ Acbxadd1 [8]byte /* +38 Additions 1 */ Acbxadd2 [4]byte /* +40 Additions 2 */ Acbxadd3 [8]byte /* +44 Additions 3 */ Acbxadd4 [8]byte /* +4C Additions 4 */ Acbxadd5 [8]byte /* +54 Additions 5 - (0x00) */ Acbxadd6 [8]byte /* +5C Additions 6 */ Acbxrsv3 [4]byte /* +64 Reserved - must be 0x00 */ Acbxerra uint64 /* +68 Error offset in buffer (64 bit)*/ Acbxerrb [2]byte /* +70 Error char field (FN) */ Acbxerrc uint16 /* +72 Error subcode */ Acbxerrd byte /* +74 Error buffer ID */ Acbxerre byte /* +75 Reserved for future use */ Acbxerrf uint16 /* +76 Error buffer seq num (per ID)*/ Acbxsubr uint16 /* +78 Subcomp response code */ Acbxsubs uint16 /* +7A Subcomp response subcode */ Acbxsubt [4]byte /* +7C Subcomp error text */ Acbxlcmp uint64 /* +80 Compressed record length */ /* (negative of length if not */ /* all of record read) */ Acbxldec uint64 /* +88 Decompressed length of all */ /* returned data */ Acbxcmdt uint64 /* +90 Command time */ Acbxuser [16]byte /* +98 User field */ Acbxsesstime uint64 /* +A8 Time, part of Adabas Session ID*/ Acbxrsv4 [16]byte /* +B0 Reserved - must be 0x00 */ }
Acbx Adabas Control block extended version
type AdaTCP ¶ added in v1.3.2
type AdaTCP struct { URL *URL // contains filtered or unexported fields }
AdaTCP TCP connection handle (for internal use only)
func NewAdaTCP ¶ added in v1.3.2
func NewAdaTCP(URL *URL, order binary.ByteOrder, user [8]byte, node [8]byte, pid uint32, timestamp uint64) *AdaTCP
NewAdaTCP create new ADATCP connection to remote TCP/IP Adabas nucleus
func (*AdaTCP) Disconnect ¶ added in v1.3.2
Disconnect disconnect remote TCP/IP Adabas nucleus
func (*AdaTCP) ReceiveData ¶ added in v1.3.2
func (connection *AdaTCP) ReceiveData(buffer *bytes.Buffer, expected TransferDataType) (nrAbdBuffers uint32, err error)
ReceiveData receive data from remote TCP/IP Adabas nucleus
type AdaTCPConnectPayload ¶
type AdaTCPConnectPayload struct { DatabaseVersion [16]byte DatabaseName [16]byte Userid [8]byte Nodeid [8]byte ProcessID uint32 DatabaseID uint32 TimeStamp uint64 Endianness byte Charset byte Floatingpoint byte Filler [5]byte }
AdaTCPConnectPayload Adabas TCP connect payload
type AdaTCPDataHeader ¶
type AdaTCPDataHeader struct { Eyecatcher [4]byte Version [4]byte Length uint32 DataType TransferDataType NumberOfBuffers uint32 ErrorCode uint32 }
AdaTCPDataHeader Adabas TCP header
type AdaTCPHeader ¶
type AdaTCPHeader struct { Eyecatcher [6]byte Version [2]byte Length uint32 BufferType BufferType Identification adaUUID ErrorCode uint32 DatabaseType byte Reserved [3]byte }
AdaTCPHeader Adabas TCP Header ADATCP
func NewAdatcpHeader ¶
func NewAdatcpHeader(bufferType BufferType) AdaTCPHeader
NewAdatcpHeader new Adabas TCP header
func (AdaTCPHeader) Valid ¶ added in v1.5.4
func (header AdaTCPHeader) Valid() bool
Valid check AdaTcp Header valid eyecatcher
type Adabas ¶
type Adabas struct { URL *URL ID *ID Acbx *Acbx AdabasBuffers []*Buffer // contains filtered or unexported fields }
Adabas is an main Adabas structure containing all call specific parameters
Example (ReadFileDefinition9) ¶
err := initLogWithFile("adabas.log") if err != nil { fmt.Println(err) return } adabas, _ := NewAdabas(adabasModDBID) adabas.ID.SetUser("fdt") fmt.Println("Open database") err = adabas.Open() if err != nil || adabas.Acbx.Acbxrsp != 0 { fmt.Println("Error: ", err, " ", adabas.Acbx.Acbxrsp) } defer adabas.Close() fmt.Println("Read file definition") var definition *adatypes.Definition definition, err = adabas.ReadFileDefinition(9) if adabas.Acbx.Acbxrsp != 0 { fmt.Println("Resonse code : ", adabas.Acbx.Acbxrsp) return } if err != nil { fmt.Println("Error: ", err) return } definition.DumpTypes(false, false)
Output: Open database Read file definition Dump all file field types: 1, A0 ; A0 2, AA, 8, A ,UQ,DE,NC,NN ; AA 2, AB ; AB 3, AC, 4, F ,DE ; AC 3, AD, 8, B ,NU,HF ; AD 3, AE, 0, A ,NU,NV,NB,LA ; AE 1, B0 ; B0 2, BA, 40, W ,NU ; BA 2, BB, 40, W ,NU ; BB 2, BC, 50, W ,NU,DE ; BC 1, CA, 1, A ,FI ; CA 1, DA, 1, A ,FI ; DA 1, EA, 4, P ,DE,NC ; EA 1, F0 ,PE ; F0 2, FA, 60, W ,NU,MU; FA 3, FA, 60, W ,NU,MU ; FA 2, FB, 40, W ,NU,DE ; FB 2, FC, 10, A ,NU ; FC 2, FD, 3, A ,NU ; FD 2, F1 ; F1 3, FE, 6, A ,NU ; FE 3, FF, 15, A ,NU ; FF 3, FG, 15, A ,NU ; FG 3, FH, 15, A ,NU ; FH 3, FI, 80, A ,NU,DE,MU; FI 4, FI, 80, A ,NU,DE,MU ; FI 1, I0 ,PE ; I0 2, IA, 40, W ,NU,MU; IA 3, IA, 40, W ,NU,MU ; IA 2, IB, 40, W ,NU,DE ; IB 2, IC, 10, A ,NU ; IC 2, ID, 3, A ,NU ; ID 2, IE, 5, A ,NU ; IE 2, I1 ; I1 3, IF, 6, A ,NU ; IF 3, IG, 15, A ,NU ; IG 3, IH, 15, A ,NU ; IH 3, II, 15, A ,NU ; II 3, IJ, 80, A ,NU,DE,MU; IJ 4, IJ, 80, A ,NU,DE,MU ; IJ 1, JA, 6, A ,DE ; JA 1, KA, 66, W ,NU,DE ; KA 1, L0 ,PE ; L0 2, LA, 3, A ,NU ; LA 2, LB, 6, P ,NU ; LB 2, LC, 6, P ,NU,DE,MU; LC 3, LC, 6, P ,NU,DE,MU ; LC 1, MA, 4, G ,NU ; MA 1, N0 ; N0 2, NA, 2, U ; NA 2, NB, 3, U ,NU ; NB 1, O0 ,PE ; O0 2, OA, 8, U ,NU,DT=E(DATE) ; OA 2, OB, 8, U ,NU,DT=E(DATE) ; OB 1, PA, 3, A ,NU,DE,MU; PA 2, PA, 3, A ,NU,DE,MU ; PA 1, QA, 7, P ; QA 1, RA, 0, A ,NU,NV,NB,LB ; RA 1, S0 ,PE ; S0 2, SA, 80, W ,NU ; SA 2, SB, 3, A ,NU ; SB 2, SC, 0, A ,NU,NV,NB,MU; SC 3, SC, 0, A ,NU,NV,NB,MU,LB ; SC 1, TC, 20, U ,SY=TIME,DT=E(TIMESTAMP) ; TC 1, TU, 20, U ,MU,SY=TIME,DT=E(TIMESTAMP); TU 2, TU, 20, U ,MU,SY=TIME,DT=E(TIMESTAMP) ; TU CN,HE=COLLATING(BC,'de@collation=phonebook',PRIMAR) ; CN H1=NA(1,2),NB(1,3) ; H1 S1=JA(1,2) ; S1 S2=JA(1,6),BC(1,40) ; S2 S3=LA(1,3),LB(1,6) ; S3 HO=REFINT(A,12,A/DC) ; HO
Example (ReadFileDefinition9RestrictF0) ¶
err := initLogWithFile("adabas.log") if err != nil { fmt.Println(err) return } adabas, _ := NewAdabas(adabasModDBID) adabas.ID.SetUser("fdt") fmt.Println("Open database") err = adabas.Open() if err != nil || adabas.Acbx.Acbxrsp != 0 { fmt.Println("Error: ", err, " ", adabas.Acbx.Acbxrsp) } defer adabas.Close() fmt.Println("Read file definition") var definition *adatypes.Definition definition, err = adabas.ReadFileDefinition(9) if adabas.Acbx.Acbxrsp != 0 { fmt.Println("Resonse code : ", adabas.Acbx.Acbxrsp) return } if err != nil { fmt.Println("Error: ", err) return } err = definition.ShouldRestrictToFields("AA,F0") if err != nil { fmt.Println("Error: ", err) return } definition.DumpTypes(false, true)
Output: Open database Read file definition Dump all active field types: 1, A0 ; A0 2, AA, 8, A ,UQ,DE,NC,NN ; AA 1, F0 ,PE ; F0 2, FA, 60, W ,NU,MU; FA 3, FA, 60, W ,NU,MU ; FA 2, FB, 40, W ,NU,DE ; FB 2, FC, 10, A ,NU ; FC 2, FD, 3, A ,NU ; FD 2, F1 ; F1 3, FE, 6, A ,NU ; FE 3, FF, 15, A ,NU ; FF 3, FG, 15, A ,NU ; FG 3, FH, 15, A ,NU ; FH 3, FI, 80, A ,NU,DE,MU; FI 4, FI, 80, A ,NU,DE,MU ; FI
Example (ReadFileDefinition9Restricted) ¶
err := initLogWithFile("adabas.log") if err != nil { fmt.Println(err) return } adabas, _ := NewAdabas(adabasModDBID) adabas.ID.SetUser("fdt") fmt.Println("Open database") err = adabas.Open() if err != nil || adabas.Acbx.Acbxrsp != 0 { fmt.Println("Error: ", err, " ", adabas.Acbx.Acbxrsp) } defer adabas.Close() fmt.Println("Read file definition") var definition *adatypes.Definition definition, err = adabas.ReadFileDefinition(9) if adabas.Acbx.Acbxrsp != 0 { fmt.Println("Resonse code : ", adabas.Acbx.Acbxrsp) return } if err != nil { fmt.Println("Error: ", err) return } err = definition.ShouldRestrictToFields("A0,DA,L0") if err != nil { fmt.Println("Error: ", err) return } definition.DumpTypes(false, true)
Output: Open database Read file definition Dump all active field types: 1, A0 ; A0 2, AA, 8, A ,UQ,DE,NC,NN ; AA 2, AB ; AB 3, AC, 4, F ,DE ; AC 3, AD, 8, B ,NU,HF ; AD 3, AE, 0, A ,NU,NV,NB,LA ; AE 1, DA, 1, A ,FI ; DA 1, L0 ,PE ; L0 2, LA, 3, A ,NU ; LA 2, LB, 6, P ,NU ; LB 2, LC, 6, P ,NU,DE,MU; LC 3, LC, 6, P ,NU,DE,MU ; LC
Example (ReadFileDefinitionFile11) ¶
err := initLogWithFile("adabas.log") if err != nil { fmt.Println(err) return } adabas, _ := NewAdabas(adabasModDBID) adabas.ID.SetUser("fdt") fmt.Println("Open database") err = adabas.Open() if err != nil || adabas.Acbx.Acbxrsp != 0 { fmt.Println("Error: ", err, " ", adabas.Acbx.Acbxrsp) } defer adabas.Close() fmt.Println("Read file definition") var definition *adatypes.Definition definition, err = adabas.ReadFileDefinition(11) if adabas.Acbx.Acbxrsp != 0 { fmt.Println("Resonse code : ", adabas.Acbx.Acbxrsp) return } if err != nil { fmt.Println("Error: ", err) return } if definition.FileTime == nil { fmt.Println("File time missing") return } ft, _ := definition.FileTime.Int64() msec := ft % 1000000 timeFt := time.Unix(ft/1000000, msec) fmt.Println("File creation:", timeFt.UTC()) definition.DumpTypes(false, false)
Output: Open database Read file definition File creation: 2014-07-15 15:46:10.000993 +0000 UTC Dump all file field types: 1, AA, 8, A ,UQ,DE ; AA 1, AB ; AB 2, AC, 20, A ,NU ; AC 2, AE, 20, A ,DE ; AE 2, AD, 20, A ,NU ; AD 1, AF, 1, A ,FI ; AF 1, AG, 1, A ,FI ; AG 1, AH, 4, P ,DE,NC ; AH 1, A1 ; A1 2, AI, 20, A ,NU,MU; AI 3, AI, 20, A ,NU,MU ; AI 2, AJ, 20, A ,NU,DE ; AJ 2, AK, 10, A ,NU ; AK 2, AL, 3, A ,NU ; AL 1, A2 ; A2 2, AN, 6, A ,NU ; AN 2, AM, 15, A ,NU ; AM 1, AO, 6, A ,DE ; AO 1, AP, 25, A ,NU,DE ; AP 1, AQ ,PE ; AQ 2, AR, 3, A ,NU ; AR 2, AS, 5, P ,NU ; AS 2, AT, 5, P ,NU,MU; AT 3, AT, 5, P ,NU,MU ; AT 1, A3 ; A3 2, AU, 2, U ; AU 2, AV, 2, U ,NU ; AV 1, AW ,PE ; AW 2, AX, 8, U ,NU ; AX 2, AY, 8, U ,NU ; AY 1, AZ, 3, A ,NU,DE,MU; AZ 2, AZ, 3, A ,NU,DE,MU ; AZ PH=PHON(AE) ; PH H1=AU(1,2),AV(1,2) ; H1 S1=AO(1,4) ; S1 S2=AO(1,6),AE(1,20) ; S2 S3=AR(1,3),AS(1,9) ; S3
Example (ResetAcbx) ¶
var acbx Acbx acbx.resetAcbx() acbx.Acbxcmd = et.code() fmt.Println(acbx.String())
Output: ACBX: CmdCode: ET CmdId: 00000000 Dbid: 0 Filenr: 0 Responsecode: 148 Subcode: 0 Isn: 0 ISN Lower Limit: 0 ISN Quantity: 0 CmdOption: 20 20 20 20 20 20 20 20 [ ] [........] Add1: 20 20 20 20 20 20 20 20 [ ] [........] Add2: 20 20 20 20 [ ] [....] Add3: 00 00 00 00 00 00 00 00 [........] [........] Add4: 00 00 00 00 00 00 00 00 [........] [........] Add5: 00 00 00 00 00 00 00 00 [........] [........] Add6: 00 00 00 00 00 00 00 00 [........] [........] User Area: 00000000000000000000000000000000 [................] [................]
func NewClonedAdabas ¶
NewClonedAdabas create a cloned Adabas struct instance
func (*Adabas) BackoutTransaction ¶
BackoutTransaction backout transaction initiated
func (*Adabas) CallAdabas ¶
CallAdabas this method sends the call to the Adabas database. It uses only remote Adabas calls with ADATCP because this part is not used with native AdabasClient library support
func (*Adabas) DumpStatistics ¶ added in v1.5.0
func (adabas *Adabas) DumpStatistics()
DumpStatistics dump statistics of service
func (*Adabas) EndTransaction ¶
EndTransaction end of transaction initiated
func (*Adabas) Histogram ¶
func (adabas *Adabas) Histogram(fileNr Fnr, adabasRequest *adatypes.Request, x interface{}) (err error)
Histogram histogram of a specific descriptor
func (*Adabas) OpenUser ¶ added in v1.4.5
OpenUser opens a session to the database using a user session. A USERID must be provided if the user intends to store and/or read user data, and the user wants this data to be available during a subsequent user– or Adabas session.
The user intends to store and/or read user data, and the user wants this data to be available during a subsequent user- or Adabas session; The user is to be assigned a special processing priority;
The value provided for the USERID must be unique for this user (not used by any other user), and must begin with a digit or an uppercase letter.
Users for whom none of the above conditions are true should set this field to blanks.
func (*Adabas) ReadBuffer ¶
func (adabas *Adabas) ReadBuffer(buffer *bytes.Buffer, order binary.ByteOrder, nCalBuf uint32, serverMode bool) (err error)
ReadBuffer read buffer and parse call
func (*Adabas) ReadFileDefinition ¶
func (adabas *Adabas) ReadFileDefinition(fileNr Fnr) (definition *adatypes.Definition, err error)
ReadFileDefinition Read file definition out of Adabas file
func (*Adabas) ReadISNOrder ¶ added in v1.2.1
func (adabas *Adabas) ReadISNOrder(fileNr Fnr, adabasRequest *adatypes.Request, x interface{}) (err error)
ReadISNOrder Read logical using a descriptor
func (*Adabas) ReadLogicalWith ¶
func (adabas *Adabas) ReadLogicalWith(fileNr Fnr, adabasRequest *adatypes.Request, x interface{}) (err error)
ReadLogicalWith Read logical using a descriptor
func (*Adabas) ReadPhysical ¶
func (adabas *Adabas) ReadPhysical(fileNr Fnr, adabasRequest *adatypes.Request, x interface{}) (err error)
ReadPhysical read data in physical order
func (*Adabas) ReadStream ¶ added in v1.4.0
func (adabas *Adabas) ReadStream(adabasRequest *adatypes.Request, offset uint64, x interface{}) (err error)
ReadStream Read partial lob stream
func (*Adabas) ReleaseCmdID ¶ added in v1.3.0
ReleaseCmdID Release any command id resource in the database of the session are released
func (*Adabas) ReleaseHold ¶ added in v1.3.0
ReleaseHold Any hold record resource in the database of the session are released
func (*Adabas) SearchLogicalWith ¶
func (adabas *Adabas) SearchLogicalWith(fileNr Fnr, adabasRequest *adatypes.Request, x interface{}) (err error)
SearchLogicalWith Search logical using a descriptor
func (*Adabas) SendSecondCall ¶ added in v1.4.0
SendSecondCall do second call reading lob data or multiple fields of the period group
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
Buffer Adabas Buffer overlay to combine the buffer itself with the Adabas buffer definition. It includes the current offset of the buffer.
func NewBufferWithSize ¶ added in v1.1.1
NewBufferWithSize Create a new buffer with given id and predefined size
func SearchAdabasBuffer ¶ added in v1.1.1
func SearchAdabasBuffer(tree *adatypes.SearchTree) *Buffer
SearchAdabasBuffer returns search buffer of the search tree
func ValueAdabasBuffer ¶ added in v1.1.1
func ValueAdabasBuffer(tree *adatypes.SearchTree) *Buffer
ValueAdabasBuffer returns value buffer of the search tree
func (*Buffer) WriteBinary ¶
WriteBinary write a binary slice into the buffer
func (*Buffer) WriteString ¶
WriteString write a string into the buffer
type CallStatistic ¶ added in v1.5.0
type CallStatistic struct {
// contains filtered or unexported fields
}
CallStatistic statistic of one Adabas call
type Connection ¶
type Connection struct { ID *ID // contains filtered or unexported fields }
Connection Adabas connection context
Example (EndTransaction) ¶
lerr := initLogWithFile("connection.log") if lerr != nil { return } fmt.Println("Example for EndTransaction()") connection, err := NewConnection("acj;target=" + adabasModDBIDs) if err != nil { fmt.Println("Error creating connection", err) return } defer connection.Close() connection.Open() storeRequest, rErr := connection.CreateStoreRequest(16) if rErr != nil { return } // Define fields to be included in the request sferr := storeRequest.StoreFields("AA,AB") if sferr != nil { fmt.Println("Error setting fields", sferr) return } record, err := storeRequest.CreateRecord() if err != nil { fmt.Println("Error creating record", err) return } err = record.SetValueWithIndex("AA", nil, "777777_0") if err != nil { fmt.Println("Error set value", err) return } err = record.SetValueWithIndex("AC", nil, "WABER") if err != nil { fmt.Println("Error set value", err) return } err = record.SetValueWithIndex("AD", nil, "EMIL") if err != nil { fmt.Println("Error set value", err) return } err = record.SetValueWithIndex("AE", nil, "MERK") if err != nil { fmt.Println("Error set value", err) return } // Store the record in the database err = storeRequest.Store(record) if err != nil { fmt.Println("Store record error", err) return } // ET end of transaction final commit the transaction err = storeRequest.EndTransaction() if err != nil { fmt.Println("End transaction error", err) return } fmt.Println("Record stored, check content ...") readRequest, rrerr := connection.CreateFileReadRequest(16) if rrerr != nil { fmt.Println("Read request error", rrerr) return } err = readRequest.QueryFields("AA,AB") if err != nil { fmt.Println("Query fields error", err) return } result, rerr := readRequest.ReadLogicalWith("AA=[777777_:777777_Z]") if rerr != nil { fmt.Println("Read record error", rerr) return } if len(result.Values) != 1 { fmt.Println("Records received not correct", len(result.Values)) return } // To adapt output for example result.Values[0].Isn = 0 _ = result.DumpValues()
Output: Example for EndTransaction() Record stored, check content ... Dump all result values AA = > 777777_0 < AB = [ 1 ] AC = > WABER < AE = > MERK < AD = > EMIL <
Example (Map) ¶
initLogWithFile("connection.log") connection, cerr := NewConnection("acj;map;config=[24,4]") if cerr != nil { return } defer connection.Close() request, err := connection.CreateMapReadRequest("EMPLOYEES-NAT-DDM") if err != nil { fmt.Println("Error read map : ", err) return } fmt.Println("Connection :", connection) request.QueryFields("NAME,PERSONNEL-ID") request.Limit = 2 fmt.Println("Read logical data, two records:") result, rerr := request.ReadLogicalWith("PERSONNEL-ID=[11100301:11100303]") if rerr != nil { return } fmt.Println("Result data:") _ = result.DumpValues()
Output: Connection : Map=EMPLOYEES-NAT-DDM Adabas url=24 fnr=0 connection file=11 Read logical data, two records: Result data: Dump all result values Record Isn: 0251 PERSONNEL-ID = > 11100301 < FULL-NAME = [ 1 ] NAME = > BERGMANN < Record Isn: 0383 PERSONNEL-ID = > 11100302 < FULL-NAME = [ 1 ] NAME = > HAIBACH <
Example (MapReadDisjunctSearch) ¶
err := initLogWithFile("connection_map.log") if err != nil { fmt.Println(err) return } adatypes.Central.Log.Infof("TEST: ExampleConnection_mapReadDisjunctSearch") connection, cerr := NewConnection("acj;map;config=[" + adabasStatDBIDs + ",4]") if cerr != nil { return } defer connection.Close() request, rerr := connection.CreateMapReadRequest("EMPLOYEES") if rerr != nil { fmt.Println("Error create request", rerr) return } err = request.QueryFields("personnel-id") if err != nil { return } request.Limit = 0 var result *Response fmt.Println("Read using ISN order:") result, err = request.ReadLogicalWith("name=SMITH") if err != nil { fmt.Println("Error reading ISN order", err) return } _ = result.DumpValues()
Output: Read using ISN order: Dump all result values Record Isn: 0579 personnel-data = [ 1 ] personnel-id = > 20009300 < Record Isn: 0634 personnel-data = [ 1 ] personnel-id = > 20015400 < Record Isn: 0670 personnel-data = [ 1 ] personnel-id = > 20018800 < Record Isn: 0727 personnel-data = [ 1 ] personnel-id = > 20025200 < Record Isn: 0787 personnel-data = [ 1 ] personnel-id = > 20000400 <
Example (MapReadUnicode) ¶
err := initLogWithFile("connection_map.log") if err != nil { fmt.Println(err) return } adatypes.Central.Log.Infof("TEST: ExampleConnection_mapReadUnicode") connection, cerr := NewConnection("acj;map;config=[" + adabasStatDBIDs + ",4]") if cerr != nil { return } defer connection.Close() request, rerr := connection.CreateMapReadRequest("EMPLOYEES-NAT-DDM") if rerr != nil { fmt.Println("Error create request", rerr) return } err = request.QueryFields("PERSONNEL-ID,FULL-NAME") if err != nil { return } request.Start = 1025 request.Limit = 3 var result *Response fmt.Println("Read using ISN order:") result, err = request.ReadByISN() if err != nil { fmt.Println("Error reading ISN order", err) return } _ = result.DumpValues()
Output: Read using ISN order: Dump all result values Record Isn: 1025 PERSONNEL-ID = > 30021215 < FULL-NAME = [ 1 ] FIRST-NAME = > SYLVIA < NAME = > BURTON < MIDDLE-I = > J < Record Isn: 1026 PERSONNEL-ID = > 30021311 < FULL-NAME = [ 1 ] FIRST-NAME = > GERARD < NAME = > JOHNSTONE < MIDDLE-I = > E < Record Isn: 1027 PERSONNEL-ID = > 30021312 < FULL-NAME = [ 1 ] FIRST-NAME = > NORMA < NAME = > FRANCIS < MIDDLE-I = > <
Example (MapReadUnicodeNew) ¶
err := initLogWithFile("connection_map.log") if err != nil { fmt.Println(err) return } adatypes.Central.Log.Infof("TEST: ExampleConnection_mapReadUnicodeNew") connection, cerr := NewConnection("acj;map;config=[" + adabasStatDBIDs + ",4]") if cerr != nil { return } defer connection.Close() request, rerr := connection.CreateMapReadRequest("EMPLOYEES") if rerr != nil { fmt.Println("Error create request", rerr) return } err = request.QueryFields("personnel-id,full-name") if err != nil { return } request.Start = 1250 request.Limit = 3 var result *Response fmt.Println("Read using ISN order:") result, err = request.ReadByISN() if err != nil { fmt.Println("Error reading ISN order", err) return } _ = result.DumpValues()
Output: Read using ISN order: Dump all result values Record Isn: 1250 personnel-data = [ 1 ] personnel-id = > 73002200 < full-name = [ 1 ] first-name = > Игорь < middle-name = > Петрович < name = > Михайлов < Record Isn: 1251 personnel-data = [ 1 ] personnel-id = > 50005801 < full-name = [ 1 ] first-name = > वासुदेव < middle-name = > मूर्ती < name = > कुमार < Record Isn: 1252 personnel-data = [ 1 ] personnel-id = > 50005501 < full-name = [ 1 ] first-name = > विनोद < middle-name = > अभगे < name = > अरविद <
Example (MapStore) ¶
err := initLogWithFile("connection_map.log") if err != nil { fmt.Println(err) return } adatypes.Central.Log.Infof("TEST: ExampleConnection_mapStore") if cErr := clearFile(16); cErr != nil { return } if cErr := clearFile(19); cErr != nil { fmt.Println("Error clearing 19", cErr) return } dataRepository := &DatabaseURL{URL: *NewURLWithDbid(adabasModDBID), Fnr: 16} if perr := prepareCreateTestMap(massLoadSystransStore, massLoadSystrans, dataRepository); perr != nil { fmt.Println("Error creating map", massLoadSystransStore, perr) return } dataRepository = &DatabaseURL{URL: *NewURLWithDbid(adabasModDBID), Fnr: 19} vehicleMapName := mapVehicles + "Go" if perr := prepareCreateTestMap(vehicleMapName, vehicleSystransStore, dataRepository); perr != nil { return } adatypes.Central.Log.Infof("Create connection...") connection, err := NewConnection("acj;map;config=[" + adabasModDBIDs + ",250]") if err != nil { return } defer connection.Close() connection.Open() storeRequest16, rErr := connection.CreateMapStoreRequest(massLoadSystransStore) if rErr != nil { return } err = storeRequest16.StoreFields("PERSONNEL-ID,NAME") if err != nil { fmt.Println("Error store", err) return } record, err := storeRequest16.CreateRecord() if err != nil { fmt.Println("Error create record", err) return } _ = record.SetValueWithIndex("PERSONNEL-ID", nil, "26555_0") _ = record.SetValueWithIndex("NAME", nil, "WABER") _ = record.SetValueWithIndex("FIRST-NAME", nil, "EMIL") _ = record.SetValueWithIndex("MIDDLE-I", nil, "MERK") err = storeRequest16.Store(record) if err != nil { fmt.Println("Error store record", err) return } storeRequest19, rErr := connection.CreateMapStoreRequest(vehicleMapName) if rErr != nil { fmt.Println("Error create store request vehicle", rErr) return } err = storeRequest19.StoreFields("REG-NUM,PERSONNEL-ID,CAR-DETAILS") if err != nil { fmt.Println("Error store fields", err) return } record, err = storeRequest19.CreateRecord() if err != nil { fmt.Println("Create record", err) return } err = record.SetValueWithIndex("REG-NUM", nil, "29555_0") if err != nil { fmt.Println("Error", err) return } err = record.SetValueWithIndex("PERSONNEL-ID", nil, "WABER") if err != nil { fmt.Println("Error search in "+vehicleMapName, err) return } err = record.SetValueWithIndex("MAKE", nil, "EMIL") if err != nil { fmt.Println("Error", err) return } err = record.SetValueWithIndex("MODEL", nil, "MERK") if err != nil { fmt.Println("Error", err) return } err = storeRequest19.Store(record) if err != nil { fmt.Println("Error", err) return } err = connection.EndTransaction() if err != nil { fmt.Println("Error", err) return } fmt.Println("Read file ..." + massLoadSystransStore) err = dumpMapStoredData(adabasModDBIDs, massLoadSystransStore, "26555") if err != nil { fmt.Println("Error reading "+massLoadSystransStore, err) return } fmt.Println("Read file ..." + vehicleMapName) err = dumpMapStoredData(adabasModDBIDs, vehicleMapName, "29555") if err != nil { fmt.Println("Error reading "+vehicleMapName, err) return }
Output: Clear file 16 Success clearing file 16 Clear file 19 Success clearing file 19 Read file ...EMPLDDM-GOLOAD-STORE Dump all result values Record Isn: 0001 PERSONNEL-ID = > 26555_0 < FULL-NAME = [ 1 ] FIRST-NAME = > < NAME = > WABER < MIDDLE-I = > < Read file ...VEHICLESGo Dump all result values Record Isn: 0001 REG-NUM = > 29555_0 < PERSONNEL-ID = > WABER < CAR-DETAILS = [ 1 ] MAKE = > EMIL < MODEL = > MERK < COLOR = > <
Example (MarhsalJSON) ¶
initLogWithFile("connection.log") connection, cerr := NewConnection("acj;target=" + adabasModDBIDs) if cerr != nil { return } defer connection.Close() request, err := connection.CreateFileReadRequest(11) if err != nil { fmt.Println("Error read map : ", err) return } fmt.Println("Connection : ", connection) fmt.Println("Limit query data:") request.QueryFields("*") fmt.Println("Read logical data:") result, rErr := request.ReadISN(250) if rErr != nil { fmt.Println("Error reading", rErr) return } x, jsonErr := json.Marshal(result) if jsonErr != nil { fmt.Println("Error", jsonErr) return } fmt.Println(string(x))
Output: Connection : Adabas url=23 fnr=0 Limit query data: Read logical data: {"Records":[{"A1":{"AI":["C/O H.KOERBER","AM DORNKAMP 20","4590 CLOPPENBURG"],"AJ":"CLOPPENBURG","AK":"4590","AL":"D"},"A2":{"AM":"3082","AN":"04471"},"A3":{"AU":33,"AV":4},"AA":"11222222","AB":{"AC":"ANTONIA","AD":"MARIA","AE":"MARTENS"},"AF":"S","AG":"F","AH":713104,"AO":"MGMT00","AP":"DATENSCHUTZBEAUFTRAGTE","AQ":[{"AR":"EUR","AS":29743,"AT":[4615,8000]},{"AR":"EUR","AS":22153,"AT":[3589,6000]},{"AR":"EUR","AS":20769,"AT":[1538]}],"AW":[{"AX":19980701,"AY":19980702},{"AX":19980811,"AY":19980812}],"AZ":["GER","TUR"],"H1":"3304","ISN":250,"PH":"","S1":"MGMT","S2":"MGMT00MARTENS"}]}
Example (MarhsalJSONComplete) ¶
initLogWithFile("connection.log") connection, cerr := NewConnection("acj;target=" + adabasModDBIDs) if cerr != nil { return } defer connection.Close() request, err := connection.CreateFileReadRequest(11) if err != nil { fmt.Println("Error read map : ", err) return } fmt.Println("Connection : ", connection) fmt.Println("Limit query data:") request.QueryFields("*") fmt.Println("Read logical data:") result, rErr := request.ReadISN(1) if rErr != nil { fmt.Println("Error reading", rErr) return } x, jsonErr := json.Marshal(result) if jsonErr != nil { fmt.Println("Error", jsonErr) return } fmt.Println(string(x))
Output: Connection : Adabas url=23 fnr=0 Limit query data: Read logical data: {"Records":[{"A1":{"AI":["26 AVENUE RHIN ET DA"],"AJ":"JOIGNY","AK":"89300","AL":"F"},"A2":{"AM":"44864858","AN":"1033"},"A3":{"AU":19,"AV":5},"AA":"50005800","AB":{"AC":"SIMONE","AD":"","AE":"ADAM"},"AF":"M","AG":"F","AH":712981,"AO":"VENT59","AP":"CHEF DE SERVICE","AQ":[{"AR":"EUR","AS":963,"AT":[138]}],"AW":[{"AX":19990801,"AY":19990831}],"AZ":["FRE","ENG"],"H1":"1905","ISN":1,"PH":"","S1":"VENT","S2":"VENT59ADAM"}]}
Example (MultiplefieldIndex) ¶
initLogWithFile("connection.log") connection, cerr := NewConnection("acj;map;config=[" + adabasStatDBIDs + ",4]") if cerr != nil { fmt.Println("Error new connection", cerr) return } defer connection.Close() openErr := connection.Open() if openErr != nil { fmt.Println("Error open connection", cerr) return } request, err := connection.CreateMapReadRequest("EMPLOYEES-NAT-DDM") if err != nil { fmt.Println("Error create request", err) return } err = request.QueryFields("PERSONNEL-ID,ADDRESS-LINE[2]") if err != nil { fmt.Println("Query fields error", err) return } request.Limit = 0 var result *Response result, err = request.ReadLogicalWith("PERSONNEL-ID=[11100303:11100304]") if err != nil { fmt.Println("Error create request", err) return } err = result.DumpValues() if err != nil { fmt.Println("Error dump values", err) }
Output: Dump all result values Record Isn: 0252 PERSONNEL-ID = > 11100303 < FULL-ADDRESS = [ 1 ] ADDRESS-LINE = [ 1 ] ADDRESS-LINE[ 2] = > WIESENGRUND 10 < Record Isn: 0253 PERSONNEL-ID = > 11100304 < FULL-ADDRESS = [ 1 ] ADDRESS-LINE = [ 1 ] ADDRESS-LINE[ 2] = > MANDELA-WEG 8 <
Example (PeriodGroup) ¶
initLogWithFile("connection.log") connection, cerr := NewConnection("acj;target=" + adabasModDBIDs) if cerr != nil { return } defer connection.Close() request, err := connection.CreateFileReadRequest(11) if err != nil { fmt.Println("Error read map : ", err) return } fmt.Println("Connection : ", connection) fmt.Println("Limit query data:") request.QueryFields("AA,AB,AQ,AZ") fmt.Println("Read logical data:") result, rerr := request.ReadISN(250) if rerr != nil { fmt.Println("Error reading", rerr) return } fmt.Println("Result data:") _ = result.DumpValues()
Output: Connection : Adabas url=23 fnr=0 Limit query data: Read logical data: Result data: Dump all result values Record Isn: 0250 AA = > 11222222 < AB = [ 1 ] AC = > ANTONIA < AE = > MARTENS < AD = > MARIA < AQ = [ 3 ] AR[01] = > EUR < AS[01] = > 29743 < AT[01] = [ 2 ] AT[01,01] = > 4615 < AT[01,02] = > 8000 < AR[02] = > EUR < AS[02] = > 22153 < AT[02] = [ 2 ] AT[02,01] = > 3589 < AT[02,02] = > 6000 < AR[03] = > EUR < AS[03] = > 20769 < AT[03] = [ 1 ] AT[03,01] = > 1538 < AZ = [ 2 ] AZ[01] = > GER < AZ[02] = > TUR <
Example (PeriodGroup2) ¶
initLogWithFile("connection.log") connection, cerr := NewConnection("acj;map;config=[" + adabasStatDBIDs + ",4]") if cerr != nil { fmt.Println("Error new connection", cerr) return } defer connection.Close() openErr := connection.Open() if openErr != nil { fmt.Println("Error open connection", cerr) return } request, err := connection.CreateMapReadRequest("EMPLOYEES-NAT-DDM") if err != nil { fmt.Println("Error create request", err) return } request.Limit = 0 var result *Response result, err = request.ReadLogicalWith("PERSONNEL-ID=[11100303:11100304]") if err != nil { fmt.Println("Error create request", err) return } err = result.DumpValues() if err != nil { fmt.Println("Error dump values", err) }
Output: Dump all result values Record Isn: 0252 PERSONNEL-ID = > 11100303 < FULL-NAME = [ 1 ] FIRST-NAME = > KRISTINA < NAME = > FALTER < MIDDLE-I = > M < MAR-STAT = > M < SEX = > F < BIRTH = > 1961/07/08 < FULL-ADDRESS = [ 1 ] ADDRESS-LINE = [ 3 ] ADDRESS-LINE[01] = > C/O CLAASEN < ADDRESS-LINE[02] = > WIESENGRUND 10 < ADDRESS-LINE[03] = > 6100 DARMSTADT < CITY = > DARMSTADT < ZIP = > 6100 < COUNTRY = > D < TELEPHONE = [ 1 ] AREA-CODE = > 06151 < PHONE = > 453897 < DEPT = > FINA21 < JOB-TITLE = > TYPISTIN < INCOME = [ 3 ] CURR-CODE[01] = > EUR < SALARY[01] = > 21846 < BONUS[01] = [ 2 ] BONUS[01,01] = > 1717 < BONUS[01,02] = > 3000 < CURR-CODE[02] = > EUR < SALARY[02] = > 21025 < BONUS[02] = [ 1 ] BONUS[02,01] = > 1538 < CURR-CODE[03] = > EUR < SALARY[03] = > 20307 < BONUS[03] = [ 1 ] BONUS[03,01] = > 1282 < LEAVE-DATA = [ 1 ] LEAVE-DUE = > 30 < LEAVE-TAKEN = > 3 < LEAVE-BOOKED = [ 1 ] LEAVE-START[01] = > 19980520 < LEAVE-END[01] = > 19980523 < LANG = [ 1 ] LANG[01] = > GER < LEAVE-LEFT = > 3003 < DEPARTMENT = > FINA < DEPT-PERSON = > FINA21FALTER < CURRENCY-SALARY = > < Record Isn: 0253 PERSONNEL-ID = > 11100304 < FULL-NAME = [ 1 ] FIRST-NAME = > WOLFGANG < NAME = > SCHMIDT < MIDDLE-I = > J < MAR-STAT = > M < SEX = > M < BIRTH = > 1943/05/04 < FULL-ADDRESS = [ 1 ] ADDRESS-LINE = [ 3 ] ADDRESS-LINE[01] = > POSTFACH 67 < ADDRESS-LINE[02] = > MANDELA-WEG 8 < ADDRESS-LINE[03] = > 6000 FRANKFURT < CITY = > FRANKFURT < ZIP = > 6000 < COUNTRY = > D < TELEPHONE = [ 1 ] AREA-CODE = > 069 < PHONE = > 549987 < DEPT = > FINA21 < JOB-TITLE = > SACHBEARBEITER < INCOME = [ 2 ] CURR-CODE[01] = > EUR < SALARY[01] = > 25230 < BONUS[01] = [ 2 ] BONUS[01,01] = > 2256 < BONUS[01,02] = > 2000 < CURR-CODE[02] = > EUR < SALARY[02] = > 24102 < BONUS[02] = [ 1 ] BONUS[02,01] = > 1948 < LEAVE-DATA = [ 1 ] LEAVE-DUE = > 30 < LEAVE-TAKEN = > 0 < LEAVE-BOOKED = [ 0 ] LANG = [ 2 ] LANG[01] = > GER < LANG[02] = > ENG < LEAVE-LEFT = > 3000 < DEPARTMENT = > FINA < DEPT-PERSON = > FINA21SCHMIDT < CURRENCY-SALARY = > <
Example (PeriodGroupLastEntry) ¶
initLogWithFile("connection.log") connection, cerr := NewConnection("acj;map;config=[" + adabasStatDBIDs + ",4]") if cerr != nil { fmt.Println("Error new connection", cerr) return } defer connection.Close() openErr := connection.Open() if openErr != nil { fmt.Println("Error open connection", cerr) return } request, err := connection.CreateMapReadRequest("EMPLOYEES-NAT-DDM") if err != nil { fmt.Println("Error create request", err) return } err = request.QueryFields("PERSONNEL-ID,INCOME[N]") if err != nil { fmt.Println("Query fields error", err) return } request.Limit = 0 var result *Response result, err = request.ReadLogicalWith("PERSONNEL-ID=[11100303:11100304]") if err != nil { fmt.Println("Error create request", err) return } err = result.DumpValues() if err != nil { fmt.Println("Error dump values", err) }
Output: Dump all result values Record Isn: 0252 PERSONNEL-ID = > 11100303 < INCOME = [ 1 ] CURR-CODE[ N] = > EUR < SALARY[ N] = > 20307 < BONUS[ N] = [ 1 ] BONUS[ N,01] = > 1282 < Record Isn: 0253 PERSONNEL-ID = > 11100304 < INCOME = [ 1 ] CURR-CODE[ N] = > EUR < SALARY[ N] = > 24102 < BONUS[ N] = [ 1 ] BONUS[ N,01] = > 1948 <
Example (PeriodGroupPart) ¶
initLogWithFile("connection.log") connection, cerr := NewConnection("acj;map;config=[" + adabasStatDBIDs + ",4]") if cerr != nil { fmt.Println("Error new connection", cerr) return } defer connection.Close() openErr := connection.Open() if openErr != nil { fmt.Println("Error open connection", cerr) return } request, err := connection.CreateMapReadRequest("EMPLOYEES-NAT-DDM") if err != nil { fmt.Println("Error create request", err) return } request.QueryFields("PERSONNEL-ID,INCOME") request.Limit = 0 var result *Response result, err = request.ReadLogicalWith("PERSONNEL-ID=[11100303:11100304]") if err != nil { fmt.Println("Error create request", err) return } err = result.DumpValues() if err != nil { fmt.Println("Error dump values", err) }
Output: Dump all result values Record Isn: 0252 PERSONNEL-ID = > 11100303 < INCOME = [ 3 ] CURR-CODE[01] = > EUR < SALARY[01] = > 21846 < BONUS[01] = [ 2 ] BONUS[01,01] = > 1717 < BONUS[01,02] = > 3000 < CURR-CODE[02] = > EUR < SALARY[02] = > 21025 < BONUS[02] = [ 1 ] BONUS[02,01] = > 1538 < CURR-CODE[03] = > EUR < SALARY[03] = > 20307 < BONUS[03] = [ 1 ] BONUS[03,01] = > 1282 < Record Isn: 0253 PERSONNEL-ID = > 11100304 < INCOME = [ 2 ] CURR-CODE[01] = > EUR < SALARY[01] = > 25230 < BONUS[01] = [ 2 ] BONUS[01,01] = > 2256 < BONUS[01,02] = > 2000 < CURR-CODE[02] = > EUR < SALARY[02] = > 24102 < BONUS[02] = [ 1 ] BONUS[02,01] = > 1948 <
Example (ReadFileDefinitionMapGroup) ¶
err := initLogWithFile("connection_map.log") if err != nil { fmt.Println(err) return } adatypes.Central.Log.Infof("TEST: ExampleConnection_readFileDefinitionMapGroup") connection, cerr := NewConnection("acj;map;config=[" + adabasStatDBIDs + ",4]") if cerr != nil { return } defer connection.Close() request, rerr := connection.CreateMapReadRequest("EMPLOYEES-NAT-DDM") if rerr != nil { fmt.Println("Error create request", rerr) return } err = request.QueryFields("FULL-NAME,PERSONNEL-ID,SALARY") if err != nil { fmt.Println("Error query fields for request", err) return } request.Limit = 0 fmt.Println("Read logigcal data:") var result *Response result, err = request.ReadLogicalWith("PERSONNEL-ID=[11100315:11100316]") if err != nil { fmt.Println("Error read logical data", err) return } _ = result.DumpValues()
Output: Read logigcal data: Dump all result values Record Isn: 0261 PERSONNEL-ID = > 11100315 < FULL-NAME = [ 1 ] FIRST-NAME = > GLORIA < NAME = > MERTEN < MIDDLE-I = > E < INCOME = [ 2 ] SALARY[01] = > 19076 < SALARY[02] = > 18000 < Record Isn: 0262 PERSONNEL-ID = > 11100316 < FULL-NAME = [ 1 ] FIRST-NAME = > HEINZ < NAME = > RAMSER < MIDDLE-I = > E < INCOME = [ 1 ] SALARY[01] = > 28307 <
Example (ReadIsn) ¶
initLogWithFile("connection.log") connection, cerr := NewConnection("acj;target=" + adabasModDBIDs) if cerr != nil { return } defer connection.Close() request, err := connection.CreateFileReadRequest(11) if err != nil { fmt.Println("Error create request: ", err) return } fmt.Println("Connection : ", connection) fmt.Println("Read ISN 250:") var result *Response result, err = request.ReadISN(250) if err != nil { fmt.Println("Error reading ISN: ", err) return } fmt.Println("Result data:") _ = result.DumpValues()
Output: Connection : Adabas url=23 fnr=0 Read ISN 250: Result data: Dump all result values Record Isn: 0250 AA = > 11222222 < AB = [ 1 ] AC = > ANTONIA < AE = > MARTENS < AD = > MARIA < AF = > S < AG = > F < AH = > 713104 < A1 = [ 1 ] AI = [ 3 ] AI[01] = > C/O H.KOERBER < AI[02] = > AM DORNKAMP 20 < AI[03] = > 4590 CLOPPENBURG < AJ = > CLOPPENBURG < AK = > 4590 < AL = > D < A2 = [ 1 ] AN = > 04471 < AM = > 3082 < AO = > MGMT00 < AP = > DATENSCHUTZBEAUFTRAGTE < AQ = [ 3 ] AR[01] = > EUR < AS[01] = > 29743 < AT[01] = [ 2 ] AT[01,01] = > 4615 < AT[01,02] = > 8000 < AR[02] = > EUR < AS[02] = > 22153 < AT[02] = [ 2 ] AT[02,01] = > 3589 < AT[02,02] = > 6000 < AR[03] = > EUR < AS[03] = > 20769 < AT[03] = [ 1 ] AT[03,01] = > 1538 < A3 = [ 1 ] AU = > 33 < AV = > 4 < AW = [ 2 ] AX[01] = > 19980701 < AY[01] = > 19980702 < AX[02] = > 19980811 < AY[02] = > 19980812 < AZ = [ 2 ] AZ[01] = > GER < AZ[02] = > TUR < PH = > < H1 = > 3304 < S1 = > MGMT < S2 = > MGMT00MARTENS < S3 = > <
Example (ReadLogicalWith) ¶
initLogWithFile("connection.log") connection, cerr := NewConnection("acj;target=" + adabasModDBIDs) if cerr != nil { return } defer connection.Close() request, err := connection.CreateFileReadRequest(11) if err != nil { fmt.Println("Error read map : ", err) return } fmt.Println("Connection : ", connection) fmt.Println("Limit query data:") request.QueryFields("AA,AB") request.Limit = 2 var result *Response fmt.Println("Read logical data:") result, err = request.ReadLogicalWith("AA=[11100301:11100303]") if err != nil { fmt.Println("Error reading", err) return } fmt.Println("Result data:") _ = result.DumpValues()
Output: Connection : Adabas url=23 fnr=0 Limit query data: Read logical data: Result data: Dump all result values Record Isn: 0251 AA = > 11100301 < AB = [ 1 ] AC = > HANS < AE = > BERGMANN < AD = > WILHELM < Record Isn: 0383 AA = > 11100302 < AB = [ 1 ] AC = > ROSWITHA < AE = > HAIBACH < AD = > ELLEN <
Example (ReadLongMapIsn) ¶
err := initLogWithFile("connection_map.log") if err != nil { fmt.Println(err) return } adatypes.Central.Log.Infof("TEST: ExampleAdabas_readFileDefinitionMap") connection, cerr := NewConnection("acj;map;config=[" + adabasStatDBIDs + ",4]") if cerr != nil { return } defer connection.Close() request, rerr := connection.CreateMapReadRequest("EMPLOYEES") if rerr != nil { fmt.Println("Error create request", rerr) return } err = request.QueryFields("*") if err != nil { fmt.Println("Error query fields", err) return } request.Limit = 0 var result *Response fmt.Println("Read logigcal data:") result, err = request.ReadISN(1) if err != nil { fmt.Println("Error search value", err) return } for _, v := range result.Values { f, e := v.SearchValue("creation_time") if e != nil { fmt.Println("Error search value", e) return } _ = f.SetValue(0) f, e = v.SearchValue("Last_Updates[01]") if e != nil || f == nil { fmt.Println(e) return } _ = f.SetValue(0) } fmt.Println(result.String())
Output: Read logigcal data: Record Isn: 0001 personnel-data = [ 1 ] personnel-id = > 50005800 < id-data = [ 1 ] personnel-no_-UQ_taken- = > 0 < id-card = > 0 < signature = > < full-name = [ 1 ] first-name = > Simone < middle-name = > < name = > Adam < mar-stat = > M < sex = > F < birth = > 718460 < private-address = [ 1 ] address-line[01] = [ 1 ] address-line[01,01] = > 26 Avenue Rhin Et Da < city[01] = > Joigny < post-code[01] = > 89300 < country[01] = > F < phone-email[01] = [ 1 ] area-code[01] = > 1033 < private-phone[01] = > 44864858 < private-fax[01] = > < private-mobile[01] = > < private-email[01] = [ 0 ] business-address = [ 0 ] dept = > VENT59 < job-title = > Chef de Service < income = [ 1 ] curr-code[01] = > EUR < salary_P9.2[01] = > 963 < bonus_P9.2[01] = [ 1 ] bonus_P9.2[01,01] = > 138 < total_income_-EUR- = > 0.000000 < leave-date = [ 1 ] leave-due = > 19 < leave-taken_N2.1 = > 5 < leave-booked = [ 1 ] leave-start[01] = > 20070801 < leave-end[01] = > 20070831 < language = [ 2 ] language[01] = > FRE < language[02] = > ENG < last_update_--TIMX- = > 0 < picture = > < documents = [ 0 ] creation_time = > 0 < Last_Updates = [ 1 ] Last_Updates[01] = > 0 <
Example (ReadLongMapRange) ¶
err := initLogWithFile("connection_map.log") if err != nil { fmt.Println(err) return } adatypes.Central.Log.Infof("TEST: ExampleConnection_readLongMapRange") connection, cerr := NewConnection("acj;map;config=[" + adabasStatDBIDs + ",4]") if cerr != nil { return } defer connection.Close() request, rerr := connection.CreateMapReadRequest("EMPLOYEES") if rerr != nil { fmt.Println("Error create request", rerr) return } err = request.QueryFields("*") if err != nil { return } request.Limit = 0 var result *Response fmt.Println("Read logigcal data:") result, err = request.ReadLogicalWith("personnel-id=[50005800:50005801]") if err != nil { fmt.Println("Read error", err) return } for _, v := range result.Values { f, e := v.SearchValue("creation_time") if e != nil { fmt.Println("Search error", e) return } _ = f.SetValue(0) f, e = v.SearchValue("Last_Updates[01]") if e != nil || f == nil { fmt.Println(e) return } _ = f.SetValue(0) } _ = result.DumpValues()
Output: Read logigcal data: Dump all result values Record Isn: 0001 personnel-data = [ 1 ] personnel-id = > 50005800 < id-data = [ 1 ] personnel-no_-UQ_taken- = > 0 < id-card = > 0 < signature = > < full-name = [ 1 ] first-name = > Simone < middle-name = > < name = > Adam < mar-stat = > M < sex = > F < birth = > 718460 < private-address = [ 1 ] address-line[01] = [ 1 ] address-line[01,01] = > 26 Avenue Rhin Et Da < city[01] = > Joigny < post-code[01] = > 89300 < country[01] = > F < phone-email[01] = [ 1 ] area-code[01] = > 1033 < private-phone[01] = > 44864858 < private-fax[01] = > < private-mobile[01] = > < private-email[01] = [ 0 ] business-address = [ 0 ] dept = > VENT59 < job-title = > Chef de Service < income = [ 1 ] curr-code[01] = > EUR < salary_P9.2[01] = > 963 < bonus_P9.2[01] = [ 1 ] bonus_P9.2[01,01] = > 138 < total_income_-EUR- = > 0.000000 < leave-date = [ 1 ] leave-due = > 19 < leave-taken_N2.1 = > 5 < leave-booked = [ 1 ] leave-start[01] = > 20070801 < leave-end[01] = > 20070831 < language = [ 2 ] language[01] = > FRE < language[02] = > ENG < last_update_--TIMX- = > 0 < picture = > < documents = [ 0 ] creation_time = > 0 < Last_Updates = [ 1 ] Last_Updates[01] = > 0 < Record Isn: 1251 personnel-data = [ 1 ] personnel-id = > 50005801 < id-data = [ 1 ] personnel-no_-UQ_taken- = > 0 < id-card = > 0 < signature = > < full-name = [ 1 ] first-name = > वासुदेव < middle-name = > मूर्ती < name = > कुमार < mar-stat = > M < sex = > M < birth = > 721484 < private-address = [ 1 ] address-line[01] = [ 1 ] address-line[01,01] = > ह-1,दिशा स्क्यलैइन म < city[01] = > नोयडा < post-code[01] = > 201301 < country[01] = > IND < phone-email[01] = [ 1 ] area-code[01] = > 01189 < private-phone[01] = > 233449 < private-fax[01] = > < private-mobile[01] = > < private-email[01] = [ 0 ] business-address = [ 0 ] dept = > COMP02 < job-title = > सीनियर प्रोग्रामर < income = [ 1 ] curr-code[01] = > INR < salary_P9.2[01] = > 45000 < bonus_P9.2[01] = [ 5 ] bonus_P9.2[01,01] = > 5000 < bonus_P9.2[01,02] = > 5000 < bonus_P9.2[01,03] = > 5000 < bonus_P9.2[01,04] = > 5000 < bonus_P9.2[01,05] = > 5000 < total_income_-EUR- = > 0.000000 < leave-date = [ 1 ] leave-due = > 8 < leave-taken_N2.1 = > 7 < leave-booked = [ 1 ] leave-start[01] = > 20060915 < leave-end[01] = > 20060922 < language = [ 2 ] language[01] = > HIN < language[02] = > ENG < last_update_--TIMX- = > 0 < picture = > < documents = [ 0 ] creation_time = > 0 < Last_Updates = [ 1 ] Last_Updates[01] = > 0 <
Example (ReadShortMap) ¶
err := initLogWithFile("connection_map.log") if err != nil { fmt.Println(err) return } adatypes.Central.Log.Infof("TEST: func ExampleConnection_readShortMap()") connection, cerr := NewConnection("acj;map;config=[" + adabasStatDBIDs + ",4]") if cerr != nil { return } defer connection.Close() request, rerr := connection.CreateMapReadRequest("EMPLSHORT") if rerr != nil { fmt.Println("Error create request", rerr) return } err = request.QueryFields("*") if err != nil { return } request.Limit = 0 var result *Response fmt.Println("Read logigcal data:") result, err = request.ReadLogicalWith("ID=[11100314:11100317]") if err != nil { fmt.Println("Error read logical", err) return } _ = result.DumpValues()
Output: Read logigcal data: Dump all result values Record Isn: 0393 ID = > 11100314 < FULL-NAME = [ 1 ] FIRST-NAME = > WOLFGANG < NAME = > SCHMIDT < MIDDLE-NAME = > MARIA < Record Isn: 0261 ID = > 11100315 < FULL-NAME = [ 1 ] FIRST-NAME = > GLORIA < NAME = > MERTEN < MIDDLE-NAME = > ELISABETH < Record Isn: 0262 ID = > 11100316 < FULL-NAME = [ 1 ] FIRST-NAME = > HEINZ < NAME = > RAMSER < MIDDLE-NAME = > EWALD < Record Isn: 0263 ID = > 11100317 < FULL-NAME = [ 1 ] FIRST-NAME = > ALFONS < NAME = > DORSCH < MIDDLE-NAME = > FRITZ <
Example (ReadWithMap) ¶
err := initLogWithFile("connection_map.log") if err != nil { fmt.Println(err) return } adatypes.Central.Log.Infof("TEST: ExampleAdabas_readFileDefinitionMap") connection, cerr := NewConnection("acj;map;config=[" + adabasStatDBIDs + ",4]") if cerr != nil { return } defer connection.Close() request, rerr := connection.CreateMapReadRequest("EMPLOYEES-NAT-DDM") if rerr != nil { fmt.Println("Error create request", rerr) return } err = request.QueryFields("NAME,FIRST-NAME,PERSONNEL-ID") if err != nil { return } request.Limit = 0 var result *Response fmt.Println("Read logigcal data:") result, err = request.ReadLogicalWith("PERSONNEL-ID=[11100314:11100317]") if err != nil { fmt.Println("Error read logical data", err) return } _ = result.DumpValues()
Output: Read logigcal data: Dump all result values Record Isn: 0393 PERSONNEL-ID = > 11100314 < FULL-NAME = [ 1 ] FIRST-NAME = > WOLFGANG < NAME = > SCHMIDT < Record Isn: 0261 PERSONNEL-ID = > 11100315 < FULL-NAME = [ 1 ] FIRST-NAME = > GLORIA < NAME = > MERTEN < Record Isn: 0262 PERSONNEL-ID = > 11100316 < FULL-NAME = [ 1 ] FIRST-NAME = > HEINZ < NAME = > RAMSER < Record Isn: 0263 PERSONNEL-ID = > 11100317 < FULL-NAME = [ 1 ] FIRST-NAME = > ALFONS < NAME = > DORSCH <
Example (ReadWithMapFormatted) ¶
err := initLogWithFile("connection_map.log") if err != nil { fmt.Println(err) return } adatypes.Central.Log.Infof("TEST: ExampleConnection_readWithMapFormatted") connection, cerr := NewConnection("acj;map;config=[" + adabasStatDBIDs + ",4]") if cerr != nil { return } defer connection.Close() request, rerr := connection.CreateMapReadRequest("EMPLOYEES-NAT-DDM") if rerr != nil { fmt.Println("Error create request", rerr) return } err = request.QueryFields("NAME,FIRST-NAME,PERSONNEL-ID,BIRTH") if err != nil { return } request.Limit = 0 var result *Response fmt.Println("Read logigcal data:") result, err = request.ReadLogicalWith("PERSONNEL-ID=[11100314:11100317]") if err != nil { fmt.Println("Error reading", err) return } _ = result.DumpValues()
Output: Read logigcal data: Dump all result values Record Isn: 0393 PERSONNEL-ID = > 11100314 < FULL-NAME = [ 1 ] FIRST-NAME = > WOLFGANG < NAME = > SCHMIDT < BIRTH = > 1953/08/18 < Record Isn: 0261 PERSONNEL-ID = > 11100315 < FULL-NAME = [ 1 ] FIRST-NAME = > GLORIA < NAME = > MERTEN < BIRTH = > 1949/11/02 < Record Isn: 0262 PERSONNEL-ID = > 11100316 < FULL-NAME = [ 1 ] FIRST-NAME = > HEINZ < NAME = > RAMSER < BIRTH = > 1978/12/23 < Record Isn: 0263 PERSONNEL-ID = > 11100317 < FULL-NAME = [ 1 ] FIRST-NAME = > ALFONS < NAME = > DORSCH < BIRTH = > 1948/02/29 <
Example (SingleIndex) ¶
initLogWithFile("connection.log") connection, cerr := NewConnection("acj;map;config=[" + adabasStatDBIDs + ",4]") if cerr != nil { fmt.Println("Error new connection", cerr) return } defer connection.Close() openErr := connection.Open() if openErr != nil { fmt.Println("Error open connection", cerr) return } request, err := connection.CreateMapReadRequest("EMPLOYEES-NAT-DDM") if err != nil { fmt.Println("Error create request", err) return } err = request.QueryFields("PERSONNEL-ID,BONUS[03,01]") if err != nil { fmt.Println("Query fields error", err) return } request.Limit = 0 var result *Response result, err = request.ReadLogicalWith("PERSONNEL-ID=[11100303:11100304]") if err != nil { fmt.Println("Error create request", err) return } err = result.DumpValues() if err != nil { fmt.Println("Error dump values", err) }
Output: Dump all result values Record Isn: 0252 PERSONNEL-ID = > 11100303 < INCOME = [ 1 ] BONUS[ 3] = [ 1 ] BONUS[ 3, 1] = > 1282 < Record Isn: 0253 PERSONNEL-ID = > 11100304 < INCOME = [ 1 ] BONUS[ 3] = [ 1 ] BONUS[ 3, 1] = > 0 <
Example (Store) ¶
err := initLogWithFile("connection.log") if err != nil { return } if cErr := clearFile(16); cErr != nil { return } if cErr := clearFile(19); cErr != nil { return } connection, err := NewConnection("acj;target=" + adabasModDBIDs) if err != nil { return } defer connection.Close() connection.Open() storeRequest16, rErr := connection.CreateStoreRequest(16) if rErr != nil { return } serr := storeRequest16.StoreFields("AA,AB") if serr != nil { return } record, err := storeRequest16.CreateRecord() if err != nil { return } _ = record.SetValueWithIndex("AA", nil, "16555_0") _ = record.SetValueWithIndex("AC", nil, "WABER") _ = record.SetValueWithIndex("AD", nil, "EMIL") _ = record.SetValueWithIndex("AE", nil, "MERK") err = storeRequest16.Store(record) if err != nil { return } storeRequest19, rErr := connection.CreateStoreRequest(19) if rErr != nil { return } err = storeRequest19.StoreFields("AA,CD") if err != nil { return } record, err = storeRequest19.CreateRecord() if err != nil { return } _ = record.SetValueWithIndex("AA", nil, "19555_0") _ = record.SetValueWithIndex("AC", nil, "WABER") _ = record.SetValueWithIndex("AD", nil, "EMIL") _ = record.SetValueWithIndex("AE", nil, "MERK") err = storeRequest19.Store(record) if err != nil { return } err = connection.EndTransaction() if err != nil { return } fmt.Println("Read file 16 ...") err = dumpStoredData(adabasModDBIDs, 16, "16555") if err != nil { return } fmt.Println("Read file 19 ...") err = dumpStoredData(adabasModDBIDs, 19, "19555") if err != nil { return }
Output: Clear file 16 Success clearing file 16 Clear file 19 Success clearing file 19 Read file 16 ... Dump all result values Record Isn: 0001 AA = > 16555_0 < AB = [ 1 ] AC = > WABER < AE = > MERK < AD = > EMIL < Read file 19 ... Dump all result values Record Isn: 0001 AA = > 19555_0 < CD = [ 1 ] AD = > EMIL < AE = > MERK < AF = > <
Example (WideCharacter) ¶
initLogWithFile("connection.log") connection, cerr := NewConnection("acj;target=" + adabasModDBIDs) if cerr != nil { return } defer connection.Close() request, err := connection.CreateFileReadRequest(9) if err != nil { fmt.Println("Error read map : ", err) return } fmt.Println("Connection : ", connection) fmt.Println("Limit query data:") request.QueryFields("B0,F0,KA") request.Limit = 2 fmt.Println("Read logical data:") result, rErr := request.ReadISN(1200) if rErr != nil { fmt.Println("Error reading", rErr) return } fmt.Println("Result data:") _ = result.DumpValues() result, rErr = request.ReadISN(1250) if rErr != nil { fmt.Println("Error reading", rErr) return } fmt.Println("Result data:") _ = result.DumpValues() result, rErr = request.ReadISN(1270) if rErr != nil { fmt.Println("Error reading", rErr) return } fmt.Println("Result data:") _ = result.DumpValues()
Output: Connection : Adabas url=23 fnr=0 Limit query data: Read logical data: Result data: Dump all result values Record Isn: 1200 B0 = [ 1 ] BA = > Karin < BB = > < BC = > Norlin < F0 = [ 1 ] FA[01] = [ 1 ] FA[01,01] = > Trångsund 4 < FB[01] = > STOCKHOLM < FC[01] = > 111 29 < FD[01] = > S < F1[01] = [ 1 ] FE[01] = > 08 < FF[01] = > 659803 < FG[01] = > < FH[01] = > < FI[01] = [ 0 ] KA = > försäljningsrepresentant < Result data: Dump all result values Record Isn: 1250 B0 = [ 1 ] BA = > Игорь < BB = > Петрович < BC = > Михайлов < F0 = [ 1 ] FA[01] = [ 1 ] FA[01,01] = > Ивановская 26-5 < FB[01] = > Санкт-Петербург < FC[01] = > 190202 < FD[01] = > RUS < F1[01] = [ 1 ] FE[01] = > 812 < FF[01] = > 8781132 < FG[01] = > < FH[01] = > < FI[01] = [ 0 ] KA = > директор < Result data: Dump all result values Record Isn: 1270 B0 = [ 1 ] BA = > महेश < BB = > जाधव < BC = > कुलदीप < F0 = [ 1 ] FA[01] = [ 1 ] FA[01,01] = > 18-क/12 रानीगंज कैला < FB[01] = > जयपुर < FC[01] = > 302001 < FD[01] = > IND < F1[01] = [ 1 ] FE[01] = > 06726 < FF[01] = > 672309 < FG[01] = > < FH[01] = > < FI[01] = [ 0 ] KA = > रीसेपसणिस्त <
func NewConnection ¶
func NewConnection(connectionString string) (*Connection, error)
NewConnection create new Adabas connection instance The target url will look like <dbid>(<driver prefix>://<host>:<port>). Examples are:
- Database id: 23
- Adabas TCP on port 60023: 23(adatcp://pchost:60023)
- Adabas Entire Network (Java only): 23(tcpip://pchost:50001)
The connection string must contain:
- To access database classic targets acj;target=<database url>
- Map usage acj;map;config=[<dbid>,<file>]
func NewConnectionID ¶
func NewConnectionID(connectionString string, adabasID *ID) (connection *Connection, err error)
NewConnectionID create new Adabas connection instance providing a Adabas ID The target url will look like <dbid>(<driver prefix>://<host>:<port>). Examples are:
- Database id: 23
- Adabas TCP on port 60023: 23(adatcp://pchost:60023)
- Adabas Entire Network (Java only): 23(tcpip://pchost:50001)
The connection string must contain:
- To access database classic targets acj;target=<database url>
- Map usage acj;map;config=[<dbid>,<file>]
func (*Connection) AddCredential ¶ added in v1.1.2
func (connection *Connection) AddCredential(user string, pwd string)
AddCredential this method adds user id and password credentials to the called. The credentials are needed if the Adabas security is active in the database.
func (*Connection) BackoutTransaction ¶ added in v1.5.0
func (connection *Connection) BackoutTransaction() error
BackoutTransaction all current transaction will be backout and reset to before the transaction in the Adabas database.
func (*Connection) Close ¶
func (connection *Connection) Close()
Close the Adabas session will be closed. An Adabas session/user queue entry in the database will be removed. If transaction are open, the backout of the transaction is called. All open transaction a rolled back and data restored. The backout transaction error is not provided. It is not sure if BT is done. Do extra BackoutTransaction() call to be sure and track error.
func (*Connection) CreateDeleteRequest ¶
func (connection *Connection) CreateDeleteRequest(fnr Fnr) (*DeleteRequest, error)
CreateDeleteRequest this method create a delete request using Adabas file numbers.
func (*Connection) CreateFileReadRequest ¶ added in v1.1.1
func (connection *Connection) CreateFileReadRequest(fnr Fnr) (*ReadRequest, error)
CreateFileReadRequest this method creates a read request using a given Adabas file number. The file number request will be used with Adabas short names, not long names.
func (*Connection) CreateMapDeleteRequest ¶
func (connection *Connection) CreateMapDeleteRequest(param ...interface{}) (request *DeleteRequest, err error)
CreateMapDeleteRequest this method creates a delete request using a given Adabas Map name
func (*Connection) CreateMapReadRequest ¶
func (connection *Connection) CreateMapReadRequest(param ...interface{}) (request *ReadRequest, err error)
CreateMapReadRequest this method creates a read request using a given Adabas Map definition. The Map will be searched in an globally defined Map repository only.
func (*Connection) CreateMapStoreRequest ¶
func (connection *Connection) CreateMapStoreRequest(param ...interface{}) (request *StoreRequest, err error)
CreateMapStoreRequest this method creates a store request using an Go struct which struct field names fit to an Adabas Map field. The struct name will be used to search the Adabas Map.
func (*Connection) CreateMapWithInterface ¶ added in v1.3.8
func (connection *Connection) CreateMapWithInterface(mapName string, fieldList string) (request *ReadRequest, err error)
CreateMapWithInterface this method create a Adabas Map request using the Map name and a list of fields defined in the dynamic interface
func (*Connection) CreateReadRequest ¶
func (connection *Connection) CreateReadRequest() (request *ReadRequest, err error)
CreateReadRequest this method create a read request defined by the given map in the `Connection` creation. If no map is given, an error 83 is returned.
func (*Connection) CreateStoreRequest ¶
func (connection *Connection) CreateStoreRequest(fnr Fnr) (*StoreRequest, error)
CreateStoreRequest this method creates a store request for a Adabas file number. The store will be used with Adabas short names only.
func (*Connection) EndTransaction ¶
func (connection *Connection) EndTransaction() error
EndTransaction all current transaction will be finally stored in the Adabas database.
func (*Connection) GetClusterNodes ¶ added in v1.5.6
func (connection *Connection) GetClusterNodes() []*URL
GetClusterNodes retrieve cluster node list
func (*Connection) IsCluster ¶ added in v1.5.6
func (connection *Connection) IsCluster() bool
IsCluster response status of remote node Adabas cluster part or not
func (*Connection) ReadRequest ¶ added in v1.5.8
func (connection *Connection) ReadRequest(p ...interface{}) (request *ReadRequest, err error)
ReadRequest this method create a read request defined by the given list of parameters. First parameter is used to indicate target. It might be a file number or map string name. Second parameter is used to indicate query fields.
func (*Connection) ReflectSearch ¶ added in v1.4.0
func (connection *Connection) ReflectSearch(mapName string, t reflect.Type, search string) ([]interface{}, error)
ReflectSearch search in map using a interface type given and a search query
func (*Connection) ReflectStore ¶ added in v1.4.0
func (connection *Connection) ReflectStore(entries interface{}, mapName string) error
ReflectStore use reflect map to store data with a dynamic interface and Adabas Map name
func (*Connection) Release ¶
func (connection *Connection) Release() error
Release any database hold record resources, like command id caches assigned to a user
func (*Connection) ReleaseCID ¶ added in v1.3.0
func (connection *Connection) ReleaseCID() error
ReleaseCID any database command id resources, like command id caches assigned to a user are released on the database.
func (*Connection) String ¶
func (connection *Connection) String() string
String provide the string representation of the connection
type Cursoring ¶ added in v1.1.1
type Cursoring struct { // FieldLength in streaming mode of a field the field length of the field FieldLength uint32 // contains filtered or unexported fields }
Cursoring the structure support cursor instance handling reading record list in chunks defined by a search or descriptor
func (*Cursoring) HasNextRecord ¶ added in v1.1.1
HasNextRecord with cursoring this method checks if a next record or stream entry is available return `true` if it is. This method will call Adabas if no entry is available and reads new entries using Multifetch or partial LOB. If an error during processing occurs, the function will return an false and you need to check with cursor Error() methods
func (*Cursoring) NextData ¶ added in v1.5.0
NextData cursoring to next structure representation of the data record, if current chunk contains a record, no call is send. If the chunk is not in memory, the next chunk is read into memory. This method may be initiated, if `HasNextRecord()` is called before.
func (*Cursoring) NextRecord ¶ added in v1.1.1
NextRecord cursoring to next record, if current chunk contains a record, no call is send. If the chunk is not in memory, the next chunk is read into memory. This method may be initiated, if `HasNextRecord()` is called before.
type DatabaseURL ¶
DatabaseURL defines the target URL of a database file. Might be a database data file or a map repository
func (*DatabaseURL) MarshalJSON ¶ added in v1.5.7
func (repURL *DatabaseURL) MarshalJSON() ([]byte, error)
MarshalJSON marshall databaseURL instances
type DeleteRequest ¶
type DeleteRequest struct {
// contains filtered or unexported fields
}
DeleteRequest request instance handling data store and update
func NewDeleteRequestAdabas ¶
func NewDeleteRequestAdabas(adabas *Adabas, fnr Fnr) *DeleteRequest
NewDeleteRequestAdabas create a new Request instance
func NewDeleteRequestDeprecated ¶ added in v1.5.0
func NewDeleteRequestDeprecated(url string, fnr Fnr) (*DeleteRequest, error)
NewDeleteRequestDeprecated create a new store Request instance
func NewMapDeleteRequest ¶
func NewMapDeleteRequest(adabas *Adabas, adabasMap *Map) (request *DeleteRequest, err error)
NewMapDeleteRequest create a new Map Delete Request instance
func NewMapNameDeleteRequest ¶
func NewMapNameDeleteRequest(adabas *Adabas, mapName string) (request *DeleteRequest, err error)
NewMapNameDeleteRequest create a new Request instance
func NewMapNameDeleteRequestRepo ¶ added in v1.1.1
func NewMapNameDeleteRequestRepo(mapName string, adabas *Adabas, mapRepository *Repository) (request *DeleteRequest, err error)
NewMapNameDeleteRequestRepo create a new delete Request instance
func (*DeleteRequest) BackoutTransaction ¶ added in v1.1.1
func (request *DeleteRequest) BackoutTransaction() error
Backout this send the backout of the open transactions. All transactions will be rolled back after the call.
func (*DeleteRequest) Close ¶
func (request *DeleteRequest) Close()
Close call the CL call to Adabas. This closes the Adabas session. Attention, this will not backout transaction. It will end the transactions.
func (*DeleteRequest) Delete ¶
func (deleteRequest *DeleteRequest) Delete(isn adatypes.Isn) (err error)
Delete delete a specific isn
func (*DeleteRequest) DeleteList ¶ added in v1.4.9
func (deleteRequest *DeleteRequest) DeleteList(isnList []adatypes.Isn) (err error)
DeleteList delete a list of isns
func (*DeleteRequest) EndTransaction ¶
func (request *DeleteRequest) EndTransaction() error
Endtransaction call the end of the transaction to the Adabas session. If returned all transaction are ended.
func (*DeleteRequest) IsOpen ¶
func (request *DeleteRequest) IsOpen() bool
IsOpen provide True if the database connection is opened
func (*DeleteRequest) Open ¶
func (deleteRequest *DeleteRequest) Open() (opened bool, err error)
Open Open the Adabas session
func (*DeleteRequest) TraverseFields ¶ added in v1.2.1
func (request *DeleteRequest) TraverseFields(t adatypes.TraverserMethods, p interface{}) error
TraverseFields traverse through all request fields
type Driver ¶ added in v1.5.10
type Driver interface { Connect(adabas *Adabas) error Disconnect() error Send(adabas *Adabas) error }
Driver driver interface for different TCP/IP based connections
type Error ¶
Error error message with code and time
func (Error) SubResponse ¶
SubResponse return the sub response code of adabas call
type ExternalDriver ¶ added in v1.5.10
ExternalDriver external driver
type ID ¶
type ID struct { AdaID *AID // contains filtered or unexported fields }
ID Adabas Id
func NewAdabasID ¶
func NewAdabasID() *ID
NewAdabasID create a new unique Adabas ID instance using static data. Instead using the current process id a generate unique time stamp and counter version of the pid is used.
func (*ID) AddCredential ¶ added in v1.1.2
AddCredential add user id and password credentials
func (*ID) Close ¶ added in v1.5.0
func (adaid *ID) Close()
Close close all open adabas instance for this ID
func (*ID) SetHost ¶ added in v1.1.1
SetHost set the host id name into the ID, prepare byte array correctly
type InterfaceFunction ¶ added in v1.3.0
type InterfaceFunction func(data interface{}, x interface{}) error
InterfaceFunction function callback used to go through the list of received interface instances
type Map ¶
type Map struct { Name string `json:"Name"` Version string `json:"Version"` Isn adatypes.Isn `json:"Isn"` Repository *DatabaseURL Data *DatabaseURL `json:"Data"` Fields []*MapField `json:"Fields"` RedefinitionFields []*MapField `json:"RedefinitionFields"` // Time of last modification of the map Generated uint64 ModificationTime []uint64 DefaultCharset string // contains filtered or unexported fields }
Map Adabas map structure defining repository where the Map is stored at
func AllGlobalMaps ¶ added in v1.2.1
AllGlobalMaps provides all Adabas Maps defined in the in global defined repositories
func LoadJSONMap ¶ added in v1.1.1
LoadJSONMap load JSON Map file and creates Map instance of that
func NewAdabasMap ¶
func NewAdabasMap(param ...interface{}) *Map
NewAdabasMap create new Adabas map instance containing the long name to short name definition. The definition is enhance to include extra charset and dynamic length definition like the Natural DDM provides it. In advance redefinition of fields to a subset of fields is possible.
func ParseJSONFileForFields ¶
ParseJSONFileForFields Parse JSON map export file
Example ¶
lerr := initLogWithFile("mapjson.log") if lerr != nil { fmt.Println("Init log error", lerr) return } p := os.Getenv("TESTFILES") if p == "" { p = "." } name := p + string(os.PathSeparator) + "Maps.json" fmt.Println("Loading ....Maps.json") file, err := os.Open(name) if err != nil { return } defer file.Close() maps, err := ParseJSONFileForFields(file) if err != nil { fmt.Println("Error parsing file", err) return } fmt.Println("Number of maps", len(maps)) for _, m := range maps { fmt.Println("MAP", m.Name) fmt.Printf(" %s %d\n", m.Data.URL.String(), m.Data.Fnr) for _, f := range m.Fields { fmt.Printf(" ln=%s sn=%s len=%d format=%s content=%s\n", f.LongName, f.ShortName, f.Length, f.FormatType, f.ContentType) } }
Output: Loading ....Maps.json Number of maps 17 MAP NEW_EMPLOYEES 23 9 ln=personnel-data sn=A0 len=8 format= content= ln=personnel-id sn=AA len=8 format=A content= ln=id-data sn=AB len=12 format= content= ln=personnel-no sn=AC len=4 format=I content= ln=id-card sn=AD len=8 format=B content= ln=signature sn=AE len=0 format=A content= ln=full-name sn=B0 len=130 format= content= ln=first-name sn=BA len=40 format=U content=charset=UTF-8 ln=middle-name sn=BB len=40 format=U content=charset=UTF-8 ln=name sn=BC len=50 format=U content=charset=UTF-8 ln=mar-stat sn=CA len=1 format=A content= ln=sex sn=DA len=1 format=A content= ln=birth sn=EA len=4 format=D content= ln=private-address sn=F0 len=113 format= content= ln=p-address-line sn=FA len=60 format=U content=charset=UTF-8 ln=p-address-line sn=FA len=60 format=U content=charset=UTF-8 ln=p-city sn=FB len=40 format=U content=charset=UTF-8 ln=p-post-code sn=FC len=10 format=A content= ln=p-country sn=FD len=3 format=A content= ln=p-phone-email sn=F1 len=131 format= content= ln=p-area-code sn=FE len=6 format=A content= ln=private-phone sn=FF len=15 format=A content= ln=private-fax sn=FG len=15 format=A content= ln=private-mobile sn=FH len=15 format=A content= ln=private-email sn=FI len=80 format=A content= ln=private-email sn=FI len=80 format=A content= ln=business-address sn=I0 len=98 format= content= ln=b-address-line sn=IA len=40 format=U content=charset=UTF-8 ln=b-address-line sn=IA len=40 format=U content=charset=UTF-8 ln=b-city sn=IB len=40 format=U content=charset=UTF-8 ln=b-post-code sn=IC len=10 format=A content= ln=b-country sn=ID len=3 format=A content= ln=room_number sn=IE len=5 format=A content= ln=b-phone-email sn=I1 len=131 format= content= ln=b-area-code sn=IF len=6 format=A content= ln=business-phone sn=IG len=15 format=A content= ln=business-fax sn=IH len=15 format=A content= ln=business-mobile sn=II len=15 format=A content= ln=business-email sn=IJ len=80 format=A content= ln=business-email sn=IJ len=80 format=A content= ln=job-title sn=KA len=66 format=U content=charset=UTF-8 ln=income sn=L0 len=15 format= content= ln=curr-code sn=LA len=3 format=A content= ln=salary sn=LB len=6 format=P content= ln=bonus sn=LC len=6 format=P content= ln=bonus sn=LC len=6 format=P content= ln=total-income sn=MA len=4 format=F content= ln=leave-date sn=N0 len=5 format= content= ln=leave-due sn=NA len=2 format=N content= ln=leave-taken sn=NB len=3 format=N content= ln=leave-booked sn=O0 len=16 format= content= ln=leave-start sn=OA len=8 format=N content= ln=leave-end sn=OB len=8 format=N content= ln=language sn=PA len=3 format=A content= ln=language sn=PA len=3 format=A content= ln=last-update sn=QA len=7 format=P content= ln=picture sn=RA len=0 format=A content= ln=documents sn=S0 len=83 format= content= ln=document-description sn=SA len=80 format=U content=charset=UTF-8 ln=document-type sn=SB len=3 format=A content= ln=document sn=SC len=0 format=A content= ln=document sn=SC len=0 format=A content= ln=creation_time sn=TC len=20 format=N content= ln=Last_Updates sn=TU len=20 format=N content= ln=Last_Updates sn=TU len=20 format=N content= MAP ADABAS_MAP 23 4 ln=TYPE-GROUP sn=TY len=0 format= content= ln=TYPE sn=TA len=1 format=B content= ln=GENERATED sn=AA len=28 format= content= ln=HOST sn=AB len=20 format=A content= ln=DATE sn=AC len=8 format=B content= ln=VERSION sn=AD len=2 format=B content= ln=LOCATION sn=RA len=45 format= content= ln=FILE-NR sn=RF len=4 format=B content= ln=DATA-DATABASE sn=RD len=20 format=A content= ln=MAPNAME sn=RN len=20 format=A content= ln=MAP-FLAGS sn=RB len=1 format=B content= ln=MAP-OPTIONS sn=RO len=20 format=A content= ln=INDEX sn=DL len=4 format= content= ln=INDEX-FILE sn=DF len=4 format=B content= ln=INDEX-DATABASE sn=DD len=20 format=A content= ln=MAPPING sn=MA len=68 format= content= ln=SHORTNAME sn=MB len=20 format=A content= ln=TYPE-CONVERSION sn=MC len=4 format=B content= ln=LONGNAME sn=MD len=20 format=A content= ln=LENGTH sn=ML len=4 format=B content= ln=CONTENTTYPE sn=MT len=20 format=A content= ln=FORMATTYPE sn=MY len=2 format=A content= ln=TIMESTAMP sn=ZB len=8 format=B content= ln=TIMESTAMP sn=ZB len=8 format=B content= MAP EMPLOYEES-NAT-DDM 23 11 ln=PERSONNEL-ID sn=AA len=8 format=A content= ln=FULL-NAME sn=AB len=21 format= content= ln=FIRST-NAME sn=AC len=20 format=A content= ln=NAME sn=AE len=20 format=A content= ln=MIDDLE-I sn=AD len=1 format=A content= ln=MAR-STAT sn=AF len=1 format=A content= ln=SEX sn=AG len=1 format=A content= ln=BIRTH sn=AH len=4 format=D content= ln=FULL-ADDRESS sn=A1 len=50 format= content= ln=ADDRESS-LINE sn=AI len=20 format=A content= ln=ADDRESS-LINE sn=AI len=20 format=A content= ln=CITY sn=AJ len=20 format=A content= ln=ZIP sn=AK len=10 format=A content= ln=COUNTRY sn=AL len=3 format=A content= ln=TELEPHONE sn=A2 len=6 format= content= ln=AREA-CODE sn=AN len=6 format=A content= ln=PHONE sn=AM len=15 format=A content= ln=DEPT sn=AO len=6 format=A content= ln=JOB-TITLE sn=AP len=25 format=A content= ln=INCOME sn=AQ len=12 format= content= ln=CURR-CODE sn=AR len=3 format=A content= ln=SALARY sn=AS len=9 format=P content= ln=BONUS sn=AT len=9 format=P content= ln=BONUS sn=AT len=9 format=P content= ln=LEAVE-DATA sn=A3 len=2 format= content= ln=LEAVE-DUE sn=AU len=2 format=N content= ln=LEAVE-TAKEN sn=AV len=2 format=N content= ln=LEAVE-BOOKED sn=AW len=8 format= content= ln=LEAVE-START sn=AX len=8 format=N content= ln=LEAVE-END sn=AY len=8 format=N content= ln=LANG sn=AZ len=3 format=A content= ln=LANG sn=AZ len=3 format=A content= ln=PH sn=PH len=0 format=A content= ln=LEAVE-LEFT sn=H1 len=0 format=A content= ln=DEPARTMENT sn=S1 len=0 format=A content= ln=DEPT-PERSON sn=S2 len=0 format=A content= ln=CURRENCY-SALARY sn=S3 len=0 format=A content= MAP LOBEXAMPLE 23 202 ln=Generated sn=AA len=16 format= content= ln=Host sn=AB len=0 format=A content= ln=Date sn=AC len=8 format=B content= ln=Version sn=AD len=8 format=B content= ln=Location sn=BA len=0 format= content= ln=Directory sn=BB len=0 format=U content=charset=UTF-8 ln=Filename sn=BC len=0 format=U content=charset=UTF-8 ln=absoluteFilename sn=BD len=0 format=U content=charset=UTF-8 ln=Type sn=CA len=4 format= content= ln=Size sn=CB len=4 format=B content= ln=MimeType sn=CC len=0 format=U content=charset=UTF-8 ln=Data sn=DA len=0 format= content= ln=Thumbnail sn=DB len=0 format=A content= ln=Picture sn=DC len=0 format=A content= ln=Checksum sn=EA len=80 format= content= ln=ThumbnailSHAchecksum sn=EB len=40 format=A content= ln=PictureSHAchecksum sn=EC len=40 format=A content= ln=EXIFinformation sn=FA len=0 format= content= ln=Model sn=FB len=0 format=U content=charset=UTF-8 ln=Orientation sn=FC len=0 format=U content=charset=UTF-8 ln=DateExif sn=FD len=0 format=U content=charset=UTF-8 ln=DateOriginal sn=FE len=0 format=U content=charset=UTF-8 ln=ExposureTime sn=FF len=0 format=U content=charset=UTF-8 ln=F-Number sn=FG len=0 format=U content=charset=UTF-8 ln=Width sn=FH len=0 format=U content=charset=UTF-8 ln=Height sn=FI len=0 format=U content=charset=UTF-8 MAP VEHICLES 23 12 ln=REG-NUM sn=AA len=15 format=A content= ln=CHASSIS-NUM sn=AB len=4 format=B content= ln=PERSONNEL-ID sn=AC len=8 format=A content= ln=CAR-DETAILS sn=CD len=40 format= content= ln=MAKE sn=AD len=20 format=A content= ln=MODEL sn=AE len=20 format=A content= ln=COLOR sn=AF len=10 format=A content= ln=YEAR sn=AG len=4 format=N content= ln=CLASS sn=AH len=1 format=A content= ln=LEASE-PUR sn=AI len=1 format=A content= ln=DATE-ACQ sn=AJ len=8 format=N content= ln=CURR-CODE sn=AL len=3 format=A content= ln=MAINT-COST sn=AM len=7 format=P content= ln=MAINT-COST sn=AM len=7 format=P content= ln=MODEL-YEAR-MAKE sn=AO len=0 format=A content= MAP EmployeeMap 23 11 ln=Id sn=AA len=-1 format=A content= ln=Name sn=AB len=-1 format= content= ln=FirstName sn=AC len=-1 format=A content= ln=LastName sn=AE len=-1 format=A content= ln=City sn=AJ len=-1 format=A content= ln=Department sn=AO len=-1 format=A content= ln=JobTitle sn=AP len=-1 format=A content= ln=Income sn=AQ len=-1 format= content= ln=Salary sn=AS len=-1 format=A content= ln=Bonus sn=AT len=-1 format=A content= ln=Bonus sn=AT len=-1 format=A content= MAP VehicleMap 23 12 ln=Vendor sn=AD len=-1 format=A content= ln=Model sn=AE len=-1 format=A content= ln=Color sn=AF len=-1 format=A content= MAP LOB_MAP 23 202 ln=Location sn=BA len=-1 format= content= ln=Filename sn=BC len=-1 format=A content= ln=Type sn=CA len=-1 format= content= ln=MimeType sn=CC len=-1 format=A content= ln=Data sn=DA len=-1 format= content= ln=Picture sn=DC len=-1 format=A content= ln=Checksum sn=EA len=-1 format= content= ln=PictureSHAchecksum sn=EC len=-1 format=A content= MAP PictureStore 23 280 ln=Generated sn=AA len=20 format= content= ln=Host sn=AB len=0 format=A content= ln=Date sn=AC len=8 format=B content= ln=Version sn=AD len=12 format=A content= ln=Location sn=BA len=0 format= content= ln=Directory sn=BB len=0 format=U content=charset=UTF-8 ln=Filename sn=BC len=0 format=U content=charset=UTF-8 ln=absoluteFilename sn=BD len=0 format=U content=charset=UTF-8 ln=Information sn=IN len=0 format= content= ln=Description sn=ID len=0 format=U content=charset=UTF-8 ln=Title sn=IT len=0 format=U content=charset=UTF-8 ln=Type sn=CA len=4 format= content= ln=Size sn=CB len=4 format=B content= ln=MimeType sn=CC len=0 format=U content=charset=UTF-8 ln=Data sn=DA len=0 format= content= ln=Thumbnail sn=DB len=0 format=A content= ln=Picture sn=DC len=0 format=A content= ln=Checksum sn=EA len=80 format= content= ln=ThumbnailSHAchecksum sn=EB len=40 format=A content= ln=PictureSHAchecksum sn=EC len=40 format=A content= ln=EXIFinformation sn=FA len=24 format= content= ln=Model sn=FB len=0 format=U content=charset=UTF-8 ln=Orientation sn=FC len=0 format=U content=charset=UTF-8 ln=DateExif sn=FD len=8 format=P content= ln=DateOriginal sn=FE len=8 format=P content= ln=ExposureTime sn=FF len=0 format=U content=charset=UTF-8 ln=F-Number sn=FG len=0 format=U content=charset=UTF-8 ln=Width sn=FH len=4 format=B content= ln=Height sn=FI len=4 format=B content= ln=Tag sn=TA len=0 format= content= ln=TagName sn=TN len=0 format=U content=charset=UTF-8 ln=TagValue sn=TV len=0 format=U content=charset=UTF-8 ln=Album sn=AL len=0 format=A content= ln=Album sn=AL len=0 format=A content= MAP LOBSTORE 23 160 ln=Generated sn=AA len=16 format= content= ln=Host sn=AB len=0 format=A content= ln=Date sn=AC len=8 format=B content= ln=Version sn=AD len=8 format=B content= ln=Location sn=BA len=0 format= content= ln=Directory sn=BB len=0 format=U content=charset=UTF-8 ln=Filename sn=BC len=0 format=U content=charset=UTF-8 ln=absoluteFilename sn=BD len=0 format=U content=charset=UTF-8 ln=Type sn=CA len=4 format= content= ln=Size sn=CB len=4 format=B content= ln=MimeType sn=CC len=0 format=U content=charset=UTF-8 ln=Data sn=DA len=0 format= content= ln=Thumbnail sn=DB len=0 format=A content= ln=Picture sn=DC len=0 format=A content= ln=Checksum sn=EA len=80 format= content= ln=ThumbnailSHAchecksum sn=EB len=40 format=A content= ln=PictureSHAchecksum sn=EC len=40 format=A content= ln=EXIFinformation sn=FA len=0 format= content= ln=Model sn=FB len=0 format=U content=charset=UTF-8 ln=Orientation sn=FC len=0 format=U content=charset=UTF-8 ln=DateExif sn=FD len=0 format=U content=charset=UTF-8 ln=DateOriginal sn=FE len=0 format=U content=charset=UTF-8 ln=ExposureTime sn=FF len=0 format=U content=charset=UTF-8 ln=F-Number sn=FG len=0 format=U content=charset=UTF-8 ln=Width sn=FH len=0 format=U content=charset=UTF-8 ln=Height sn=FI len=0 format=U content=charset=UTF-8 MAP EmployeeX 23 11 ln=PERSONNEL-ID sn=AA len=8 format=A content= ln=FULL-NAME sn=AB len=0 format= content= ln=FIRST-NAME sn=AC len=20 format=A content= ln=NAME sn=AE len=20 format=A content= ln=MIDDLE-I sn=AD len=1 format=A content= ln=MAR-STAT sn=AF len=1 format=A content= ln=SEX sn=AG len=1 format=A content= ln=BIRTH sn=AH len=11 format=P content= ln=FULL-ADDRESS sn=A1 len=0 format= content= ln=ADDRESS-LINE sn=AI len=20 format=A content= ln=ADDRESS-LINE sn=AI len=20 format=A content= ln=CITY sn=AJ len=20 format=A content= ln=ZIP sn=AK len=10 format=A content= ln=COUNTRY sn=AL len=3 format=A content= ln=TELEPHONE sn=A2 len=0 format= content= ln=AREA-CODE sn=AN len=6 format=A content= ln=PHONE sn=AM len=15 format=A content= ln=DEPT sn=AO len=6 format=A content= ln=JOB-TITLE sn=AP len=25 format=A content= ln=INCOME sn=AQ len=0 format= content= ln=CURR-CODE sn=AR len=3 format=A content= ln=SALARY sn=AS len=9 format=A content= ln=BONUS sn=AT len=9 format=A content= ln=BONUS sn=AT len=9 format=A content= ln=LEAVE-DATA sn=A3 len=0 format= content= ln=LEAVE-DUE sn=AU len=2 format=N content= ln=LEAVE-TAKEN sn=AV len=2 format=N content= ln=LEAVE-BOOKED sn=AW len=0 format= content= ln=LEAVE-START sn=AX len=8 format=A content= ln=LEAVE-END sn=AY len=8 format=A content= ln=LANG sn=AZ len=3 format=A content= ln=LANG sn=AZ len=3 format=A content= MAP Empl 23 11 ln=PERSONNEL-ID sn=AA len=8 format=A content= ln=FULL-NAME sn=AB len=0 format= content= ln=FIRST-NAME sn=AC len=20 format=A content= ln=NAME sn=AE len=20 format=A content= ln=MIDDLE-I sn=AD len=1 format=A content= ln=MAR-STAT sn=AF len=1 format=A content= ln=SEX sn=AG len=1 format=A content= ln=BIRTH sn=AH len=4 format=D content= ln=FULL-ADDRESS sn=A1 len=0 format= content= ln=ADDRESS-LINE sn=AI len=20 format=A content= ln=ADDRESS-LINE sn=AI len=20 format=A content= ln=CITY sn=AJ len=20 format=A content= ln=ZIP sn=AK len=10 format=A content= ln=COUNTRY sn=AL len=3 format=A content= ln=TELEPHONE sn=A2 len=0 format= content= ln=AREA-CODE sn=AN len=6 format=A content= ln=PHONE sn=AM len=15 format=A content= ln=DEPT sn=AO len=6 format=A content= ln=JOB-TITLE sn=AP len=25 format=A content= ln=INCOME sn=AQ len=0 format= content= ln=CURR-CODE sn=AR len=3 format=A content= ln=SALARY sn=AS len=9 format=A content= ln=BONUS sn=AT len=9 format=A content= ln=BONUS sn=AT len=9 format=A content= ln=LEAVE-DATA sn=A3 len=0 format= content= ln=LEAVE-DUE sn=AU len=2 format=N content= ln=LEAVE-TAKEN sn=AV len=2 format=N content= ln=LEAVE-BOOKED sn=AW len=0 format= content= ln=LEAVE-START sn=AX len=8 format=A content= ln=LEAVE-END sn=AY len=8 format=A content= ln=LANG sn=AZ len=3 format=A content= ln=LANG sn=AZ len=3 format=A content= ln=PHONETIC-NAME sn=PH len=20 format=A content= MAP DublicateNames 23 11 ln=PERSONNEL-ID sn=AA len=8 format=A content= ln=FULL-NAME sn=AB len=21 format= content= ln=FIRST-NAME sn=AC len=20 format=A content= ln=NAME sn=AE len=20 format=A content= ln=MIDDLE-I sn=AD len=1 format=A content= ln=MAR-STAT sn=AF len=1 format=A content= ln=SEX sn=AG len=1 format=A content= ln=BIRTH sn=AH len=4 format=D content= ln=FULL-ADDRESS sn=A1 len=50 format= content= ln=ADDRESS-LINE sn=AI len=20 format=A content= ln=ADDRESS-LINE sn=AI len=20 format=A content= ln=CITY sn=AJ len=20 format=A content= ln=ZIP sn=AK len=10 format=A content= ln=COUNTRY sn=AL len=3 format=A content= ln=TELEPHONE sn=A2 len=6 format= content= ln=AREA-CODE sn=AN len=6 format=A content= ln=PHONE sn=AM len=15 format=A content= ln=DEPT sn=AO len=6 format=A content= ln=JOB-TITLE sn=AP len=25 format=A content= ln=INCOME sn=AQ len=12 format= content= ln=CURR-CODE sn=AR len=3 format=A content= ln=SALARY sn=AS len=9 format=P content= ln=BONUS sn=AT len=9 format=P content= ln=BONUS sn=AT len=9 format=P content= ln=LEAVE-DATA sn=A3 len=2 format= content= ln=LEAVE-DUE sn=AU len=2 format=N content= ln=LEAVE-TAKEN sn=AV len=2 format=N content= ln=LEAVE-BOOKED sn=AW len=8 format= content= ln=LEAVE-START sn=AX len=8 format=N content= ln=LEAVE-END sn=AY len=8 format=N content= ln=LANG sn=AZ len=3 format=A content= ln=LANG sn=AZ len=3 format=A content= ln=PH sn=PH len=0 format=A content= ln=LEAVE-LEFT sn=H1 len=0 format=A content= ln=DEPARTMENT sn=S1 len=0 format=A content= MAP NewEmployees 23 9 ln=personnel-data sn=A0 len=0 format= content= ln=personnel-id sn=AA len=8 format=A content= ln=id-data sn=AB len=0 format= content= ln=personnel-no !UQ taken! sn=AC len=4 format=I content= ln=id-card sn=AD len=8 format=B content= ln=signature sn=AE len=0 format=A content= ln=full-name sn=B0 len=0 format= content= ln=first-name sn=BA len=40 format=U content=charset=UTF-8 ln=middle-name sn=BB len=40 format=U content=charset=UTF-8 ln=name sn=BC len=50 format=U content=charset=UTF-8 ln=mar-stat sn=CA len=1 format=A content= ln=sex sn=DA len=1 format=A content= ln=birth sn=EA len=4 format=P content= ln=private-address sn=F0 len=0 format= content= ln=address-line sn=FA len=60 format=A content= ln=address-line sn=FA len=60 format=A content= ln=city sn=FB len=40 format=A content= ln=post-code sn=FC len=10 format=A content= ln=country sn=FD len=3 format=A content= ln=phone-email sn=F1 len=0 format= content= ln=area-code sn=FE len=6 format=A content= ln=private-phone sn=FF len=15 format=A content= ln=private-fax sn=FG len=15 format=A content= ln=private-mobile sn=FH len=15 format=A content= ln=private-email sn=FI len=80 format=A content= ln=private-email sn=FI len=80 format=A content= MAP MF_TYPES_FRACTIONAL 23 101 ln=ISN sn=AA len=8 format=P content= ln=NUM_UNPACKED_W_SIGN_U sn=AB len=10 format=N content= ln=BINARY sn=AC len=10 format=B content= ln=B3_FIELD sn=AD len=3 format=B content= ln=ALPHA sn=AE len=32 format=A content= ln=PACKED_NUMERIC sn=AF len=10 format=P content= ln=B7_FIELD sn=AG len=7 format=B content= ln=B8_FIELD sn=AH len=8 format=B content= ln=B2_FIELD sn=AI len=2 format=B content= ln=P16_2 sn=AJ len=16 format=P content= ln=LOGICAL sn=AK len=1 format=L content= ln=NUM_UNPACKED_W_SIGN_N sn=AL len=10 format=N content= ln=FLOATING_POINT sn=AM len=8 format=F content= ln=B5_FIELD sn=AN len=5 format=B content= ln=ALPHA_NV_OPTION sn=AO len=32 format=A content= ln=INTEGER sn=AP len=4 format=I content= ln=B4_FIELD sn=AQ len=4 format=B content= ln=TIME sn=AR len=7 format=T content= ln=DATE sn=AS len=4 format=D content= ln=NUMERIC_UNPACKED_N sn=AT len=10 format=N content= ln=VARCHAR sn=AU len=0 format=A content= ln=B6_FIELD sn=AV len=6 format=B content= ln=PACKED_NUM_W_SIGN sn=AW len=10 format=P content= ln=B9_FIELD sn=AX len=9 format=B content= ln=B1_FIELD sn=AY len=1 format=B content= ln=NUMERIC_UNPACKED_U sn=AZ len=10 format=N content= MAP MF_TYPES_FRACTIONAL2 23 101 ln=ISN sn=AA len=5 format=P content= ln=NUM_UNPACKED_W_SIGN_U sn=AB len=10 format=N content= ln=BINARY sn=AC len=10 format=B content= ln=B3_FIELD sn=AD len=3 format=N content= ln=ALPHA sn=AE len=32 format=A content= ln=PACKED_NUMERIC sn=AF len=6 format=N content= ln=B7_FIELD sn=AG len=7 format=N content= ln=B8_FIELD sn=AH len=8 format=B content= ln=B2_FIELD sn=AI len=2 format=N content= ln=P16_2 sn=AJ len=9 format=P content=fractionalshift=2 ln=LOGICAL sn=AK len=1 format=N content= ln=NUM_UNPACKED_W_SIGN_N sn=AL len=10 format=N content= ln=FLOATING_POINT sn=AM len=8 format=F content= ln=B5_FIELD sn=AN len=5 format=N content= ln=ALPHA_NV_OPTION sn=AO len=32 format=A content= ln=INTEGER sn=AP len=4 format=N content= ln=B4_FIELD sn=AQ len=4 format=N content= ln=TIME sn=AR len=7 format=P content= ln=DATE sn=AS len=4 format=P content= ln=NUMERIC_UNPACKED_N sn=AT len=10 format=N content= ln=VARCHAR sn=AU len=0 format=A content= ln=B6_FIELD sn=AV len=6 format=N content= ln=PACKED_NUM_W_SIGN sn=AW len=6 format=N content= ln=B9_FIELD sn=AX len=9 format=B content= ln=B1_FIELD sn=AY len=1 format=N content= ln=NUMERIC_UNPACKED_U sn=AZ len=10 format=N content= MAP Employees 23 16 ln=ID sn=AA len=8 format=A content= ln=FullName sn=AB len=40 format= content= ln=FirstName sn=AC len=20 format=A content= ln=Name sn=AE len=20 format=A content= ln=MiddleName sn=AD len=20 format=A content= ln=MarriageState sn=AF len=1 format=A content= ln=Sex sn=AG len=1 format=A content= ln=Birth sn=AH len=4 format=D content= ln=Address sn=A1 len=50 format= content= ln=AddressLine sn=AI len=20 format=A content= ln=AddressLine sn=AI len=20 format=A content= ln=City sn=AJ len=20 format=A content= ln=Zip sn=AK len=10 format=A content= ln=Country sn=AL len=3 format=A content=
func (*Map) Delete ¶ added in v1.5.6
Delete deletes the Adabas map in the given Adabas Map repository.
func (*Map) FieldNames ¶ added in v1.2.1
FieldNames list of fields of the map is returned
func (*Map) FieldShortNames ¶ added in v1.2.1
FieldShortNames list of field short names of the Map
func (*Map) Store ¶
Store stores the Adabas map in the given Adabas Map repository. It generates a new entry if it is new or update current entry
type MapField ¶
type MapField struct { ShortName string `json:"ShortName"` LongName string `json:"LongName"` Length int32 `json:"FormatLength"` ContentType string `json:"ContentType"` FormatType string `json:"FormatType"` FieldType string `json:"FieldType"` Charset string `json:"Charset"` File uint32 `json:"File"` Remarks string }
MapField Structure to define short name to long name mapping. In advance the DDM specific type formater like B for Boolean or N for NATDATE are available
type MapFile ¶
type MapFile struct {
Maps []*Map `json:"Maps"`
}
MapFile parse map JSON import/export files
type ReadRequest ¶
type ReadRequest struct { Start uint64 Limit uint64 Multifetch uint32 RecordBufferShift uint32 HoldRecords adatypes.HoldType PartialRead bool BlockSize uint32 // contains filtered or unexported fields }
ReadRequest request instance handling field query information
Example (HistogramWith) ¶
err := initLogWithFile("request.log") if err != nil { fmt.Println(err) return } adabas, _ := NewAdabas(adabasModDBID) request, _ := NewReadRequest(adabas, 11) defer request.Close() result, err := request.HistogramWith("AA=20010100") if err == nil { if result != nil { fmt.Println("Dump result received ...") _ = result.DumpValues() } } else { fmt.Println(err) }
Output: Dump result received ... Dump all result values Record Quantity: 0001 AA = > 20010100 <
Example (HistogramWithStream) ¶
err := initLogWithFile("request.log") if err != nil { fmt.Println("Error init log", err) return } adabas, _ := NewAdabas(24) request, _ := NewReadRequest(adabas, 11) defer request.Close() i := uint32(0) result, err := request.HistogramWithStream("AE='SMITH'", dumpStream, &i) fmt.Println("Read done ...") if err != nil { fmt.Println("Error reading histogram", err) return } if i != 1 { fmt.Println("Index error", i) } if result != nil { _ = result.DumpValues() fmt.Println("Result set should be empty") }
Output: Read 0 -> SMITH = 19 Read done ... Dump all result values Result set should be empty
Example (ReadAllFields) ¶
err := initLogWithFile("request.log") if err != nil { fmt.Println(err) return } adabas, _ := NewAdabas(adabasStatDBID) request, _ := NewReadRequest(adabas, 11) defer request.Close() request.Limit = 1 request.QueryFields("*") var result *Response result, _ = request.ReadPhysicalSequence() fmt.Println("Dump result received ...") if result != nil { _ = result.DumpValues() }
Output: Dump result received ... Dump all result values Record Isn: 0001 AA = > 50005800 < AB = [ 1 ] AC = > SIMONE < AE = > ADAM < AD = > < AF = > M < AG = > F < AH = > 712981 < A1 = [ 1 ] AI = [ 1 ] AI[01] = > 26 AVENUE RHIN ET DA < AJ = > JOIGNY < AK = > 89300 < AL = > F < A2 = [ 1 ] AN = > 1033 < AM = > 44864858 < AO = > VENT59 < AP = > CHEF DE SERVICE < AQ = [ 1 ] AR[01] = > EUR < AS[01] = > 963 < AT[01] = [ 1 ] AT[01,01] = > 138 < A3 = [ 1 ] AU = > 19 < AV = > 5 < AW = [ 1 ] AX[01] = > 19990801 < AY[01] = > 19990831 < AZ = [ 2 ] AZ[01] = > FRE < AZ[02] = > ENG < PH = > < H1 = > 1905 < S1 = > VENT < S2 = > VENT59ADAM <
Example (ReadGroup) ¶
err := initLogWithFile("request.log") if err != nil { fmt.Println(err) return } adabas, aerr := NewAdabas(adabasStatDBID) if aerr != nil { fmt.Println(aerr) return } request, rerr := NewReadRequest(adabas, 11) if rerr != nil { fmt.Println(rerr) return } defer request.Close() request.Limit = 1 request.QueryFields("AA,AW") var result *Response result, err = request.ReadPhysicalSequence() if err != nil { fmt.Println(err) return } fmt.Println("Dump result received ...") if result != nil { _ = result.DumpValues() }
Output: Dump result received ... Dump all result values Record Isn: 0001 AA = > 50005800 < AW = [ 1 ] AX[01] = > 19990801 < AY[01] = > 19990831 <
Example (ReadISN) ¶
err := initLogWithFile("connection.log") if err != nil { fmt.Println("Log init error", err) return } url := adabasModDBIDs connection, cerr := NewConnection("acj;target=" + url) if cerr != nil { fmt.Println("Connection error", err) return } defer connection.Close() fmt.Println(connection) openErr := connection.Open() if openErr != nil { fmt.Println("Open error", openErr) } request, err := connection.CreateFileReadRequest(11) if err != nil { fmt.Println("Create read request error", openErr) return } request.Limit = 0 var result *Response result, err = request.ReadISN(1) if err != nil { fmt.Println("Read error", openErr) return } if result != nil { err = result.DumpValues() if err != nil { fmt.Println("Dump values error", openErr) return } }
Output: Adabas url=23 fnr=0 Dump all result values Record Isn: 0001 AA = > 50005800 < AB = [ 1 ] AC = > SIMONE < AE = > ADAM < AD = > < AF = > M < AG = > F < AH = > 712981 < A1 = [ 1 ] AI = [ 1 ] AI[01] = > 26 AVENUE RHIN ET DA < AJ = > JOIGNY < AK = > 89300 < AL = > F < A2 = [ 1 ] AN = > 1033 < AM = > 44864858 < AO = > VENT59 < AP = > CHEF DE SERVICE < AQ = [ 1 ] AR[01] = > EUR < AS[01] = > 963 < AT[01] = [ 1 ] AT[01,01] = > 138 < A3 = [ 1 ] AU = > 19 < AV = > 5 < AW = [ 1 ] AX[01] = > 19990801 < AY[01] = > 19990831 < AZ = [ 2 ] AZ[01] = > FRE < AZ[02] = > ENG < PH = > < H1 = > 1905 < S1 = > VENT < S2 = > VENT59ADAM < S3 = > <
Example (ReadLogicalWithCursoringLimit) ¶
ferr := initLogWithFile("connection_cursoring.log") if ferr != nil { fmt.Println("Error initializing log", ferr) return } connection, cerr := NewConnection("acj;map;config=[" + adabasModDBIDs + ",4]") if cerr != nil { fmt.Println("Error creating new connection", cerr) return } defer connection.Close() request, rerr := connection.CreateMapReadRequest("EMPLOYEES-NAT-DDM") if rerr != nil { fmt.Println("Error creating read request", cerr) return } // Define fields to be part of the request err := request.QueryFields("NAME,PERSONNEL-ID") if err != nil { fmt.Println("Error query field read request", err) return } // Define chunks of cursoring requests request.Limit = 5 // Init cursoring using search col, cerr := request.ReadLogicalWithCursoring("PERSONNEL-ID=[11100110:11100120]") if cerr != nil { fmt.Println("Error init cursoring", cerr) return } for col.HasNextRecord() { record, rerr := col.NextRecord() if rerr != nil { fmt.Println("Error getting next record", rerr) return } fmt.Printf("New record received: ISN=%d\n", record.Isn) record.DumpValues() }
Output: New record received: ISN=210 Dump all record values PERSONNEL-ID = > 11100110 < FULL-NAME = [ 1 ] NAME = > BUNGERT < New record received: ISN=211 Dump all record values PERSONNEL-ID = > 11100111 < FULL-NAME = [ 1 ] NAME = > THIELE < New record received: ISN=212 Dump all record values PERSONNEL-ID = > 11100112 < FULL-NAME = [ 1 ] NAME = > THOMA < New record received: ISN=213 Dump all record values PERSONNEL-ID = > 11100113 < FULL-NAME = [ 1 ] NAME = > TREIBER < New record received: ISN=214 Dump all record values PERSONNEL-ID = > 11100114 < FULL-NAME = [ 1 ] NAME = > UNGER < New record received: ISN=1102 Dump all record values PERSONNEL-ID = > 11100115 < FULL-NAME = [ 1 ] NAME = > VETTER < New record received: ISN=215 Dump all record values PERSONNEL-ID = > 11100116 < FULL-NAME = [ 1 ] NAME = > VOGEL < New record received: ISN=216 Dump all record values PERSONNEL-ID = > 11100117 < FULL-NAME = [ 1 ] NAME = > WABER < New record received: ISN=217 Dump all record values PERSONNEL-ID = > 11100118 < FULL-NAME = [ 1 ] NAME = > WAGNER <
Example (ReadPhysical) ¶
err := initLogWithFile("request.log") if err != nil { fmt.Println(err) return } adabas, _ := NewAdabas(adabasStatDBID) request, _ := NewReadRequest(adabas, 225) defer request.Close() request.Limit = 2 request.QueryFields("*") var result *Response result, _ = request.ReadPhysicalSequence() fmt.Println("Dump result received ...") if result != nil { _ = result.DumpValues() }
Output: Dump result received ... Dump all result values Record Isn: 0001 AA = > AVS0 < AB = [ 1 ] AC[01] = > 0 < AD[01] = [ 1 ] AE[01] = > 0 < AF[01] = > XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX < AG[01] = > 0 < AH[01] = > 0ABCDDDDD < AI[01] = > 0.000000 < Record Isn: 0002 AA = > AVS1 < AB = [ 1 ] AC[01] = > 9999 < AD[01] = [ 1 ] AE[01] = > 233 < AF[01] = > XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX < AG[01] = > 100 < AH[01] = > 1ABCDDDDD < AI[01] = > 10.300000 <
func NewReadRequest ¶ added in v1.2.1
func NewReadRequest(param ...interface{}) (request *ReadRequest, err error)
NewReadRequest create a request defined by a dynamic list of parameters. This constructor is used internally. Use the `Connection` instance to use read requests to Adabas.
func (*ReadRequest) BackoutTransaction ¶ added in v1.1.1
func (request *ReadRequest) BackoutTransaction() error
Backout this send the backout of the open transactions. All transactions will be rolled back after the call.
func (*ReadRequest) Close ¶
func (request *ReadRequest) Close()
Close call the CL call to Adabas. This closes the Adabas session. Attention, this will not backout transaction. It will end the transactions.
func (*ReadRequest) EndTransaction ¶
func (request *ReadRequest) EndTransaction() error
Endtransaction call the end of the transaction to the Adabas session. If returned all transaction are ended.
func (*ReadRequest) HistogramBy ¶
func (request *ReadRequest) HistogramBy(descriptor string) (result *Response, err error)
HistogramBy this method read Adabas records in logical order given by the descriptor argument. The access in the database will be reduce to I/O to the ASSO container.
func (*ReadRequest) HistogramByCursoring ¶ added in v1.1.2
func (request *ReadRequest) HistogramByCursoring(descriptor string) (cursor *Cursoring, err error)
HistogramByCursoring provides the descriptor read of a field and uses cursoring. The cursor will read a number of records using Multifetch calls. The number of records is defined in `Limit`. This method initialize the read records using cursoring.
func (*ReadRequest) HistogramWith ¶
func (request *ReadRequest) HistogramWith(search string) (result *Response, err error)
HistogramWith this method read Adabas records in logical order given by the descriptor-based search argument. The access in the database will be reduce to I/O to the ASSO container.
func (*ReadRequest) HistogramWithCursoring ¶ added in v1.1.2
func (request *ReadRequest) HistogramWithCursoring(search string) (cursor *Cursoring, err error)
HistogramWithCursoring provides the searched read of a descriptor of a field. It uses a cursor to read only a part of the data and read further only on request. The cursor will read a number of records using Multifetch calls. The number of records is defined in `Limit`. This method initialize the read records using cursoring.
func (*ReadRequest) HistogramWithStream ¶ added in v1.1.1
func (request *ReadRequest) HistogramWithStream(search string, streamFunction StreamFunction, x interface{}) (result *Response, err error)
HistogramWithStream this method read Adabas records in logical order given by the descriptor-based search argument. The access in the database will be reduce to I/O to the ASSO container. The result set will be called using the `streamFunction` method given.
func (*ReadRequest) IsOpen ¶
func (request *ReadRequest) IsOpen() bool
IsOpen provide True if the database connection is opened
func (*ReadRequest) Open ¶
func (request *ReadRequest) Open() (opened bool, err error)
Open call Adabas session and open a user queue entry in the database.
func (*ReadRequest) QueryFields ¶
func (request *ReadRequest) QueryFields(fieldq string) (err error)
QueryFields this method define the set of fields which are part of the query. It restrict the fields and tree to the needed set. If the parameter is set to "*" all fields are part of the request. If the parameter is set to "" no field is returned and only the ISN an quantity information are provided. Following fields are keywords: #isn, #ISN, #key Fields started with '#' will provide only field data length information.
func (*ReadRequest) ReadByISN ¶ added in v1.2.1
func (request *ReadRequest) ReadByISN() (result *Response, err error)
ReadByISN read records with a logical order given by a ISN sequence. The ISN is to be set by the `Start` `ReadRequest` parameter.
func (*ReadRequest) ReadISN ¶
func (request *ReadRequest) ReadISN(isn adatypes.Isn) (result *Response, err error)
ReadISN this method reads a records defined by a given ISN. Ths ISN may be read by an search query before.
func (*ReadRequest) ReadISNWithParser ¶
func (request *ReadRequest) ReadISNWithParser(isn adatypes.Isn, resultParser adatypes.RequestParser, x interface{}) (err error)
ReadISNWithParser read record defined by a ISN using request parser
func (*ReadRequest) ReadLOBRecord ¶ added in v1.6.4
func (request *ReadRequest) ReadLOBRecord(isn adatypes.Isn, field string, blocksize uint64) (result *Response, err error)
ReadLOBRecord read lob records in an stream, repeated call will read next segment of LOB
func (*ReadRequest) ReadLOBSegment ¶ added in v1.6.4
func (request *ReadRequest) ReadLOBSegment(isn adatypes.Isn, field string, blocksize uint64) (segment []byte, err error)
ReadLOBSegment reads field data using partial lob reads and provide it stream-like to the user. It is possible to use it to read big LOB data or stream a video. The value of the field is reused, so that the value does not need to evaluate/searched in the result instance once more after the first call. This method initialize the first call by - offset 0 - prepare partial lob query of given blocksize Important parameter is the blocksize in the `ReadRequest` which defines the size of one block to be read
func (*ReadRequest) ReadLobStream ¶ added in v1.4.0
func (request *ReadRequest) ReadLobStream(search, field string) (cursor *Cursoring, err error)
ReadLobStream reads field data using partial lob reads and provide it stream-like to the user. It is possible to use it to read big LOB data or stream a video. The value of the field is reused, so that the value does not need to evaluate/searched in the result instance once more after the first call. This method initialize the first call by - searching the record (it must be a unique result) - prepare partial lob query Important parameter is the blocksize in the `ReadRequest` which defines the size of one block to be read
func (*ReadRequest) ReadLogicalBy ¶
func (request *ReadRequest) ReadLogicalBy(descriptors string) (result *Response, err error)
ReadLogicalBy this method read Adabas records in logical order given by the descriptor argument. The access in the database will be reduce to I/O to the ASSO container.
Example ¶
err := initLogWithFile("request.log") if err != nil { fmt.Println(err) return } adabas, _ := NewAdabas(adabasModDBID) request, _ := NewReadRequest(adabas, 11) defer request.Close() request.Limit = 2 request.QueryFields("AA,AC,AD") var result *Response result, _ = request.ReadLogicalBy("AA") fmt.Println("Dump result received ...") if result != nil { _ = result.DumpValues() }
Output: Dump result received ... Dump all result values Record Isn: 0204 AA = > 11100102 < AB = [ 1 ] AC = > EDGAR < AD = > PETER < Record Isn: 0205 AA = > 11100105 < AB = [ 1 ] AC = > CHRISTIAN < AD = > <
func (*ReadRequest) ReadLogicalByCursoring ¶ added in v1.6.4
func (request *ReadRequest) ReadLogicalByCursoring(descriptor string) (cursor *Cursoring, err error)
ReadLogicalByCursoring this method provide the descriptor read of records in Adabas and provide a cursor. The cursor will read a number of records using Multifetch calls. The number of records is defined in `Limit`. This method initialize the read records using cursoring.
func (*ReadRequest) ReadLogicalByStream ¶ added in v1.1.1
func (request *ReadRequest) ReadLogicalByStream(descriptor string, streamFunction StreamFunction, x interface{}) (result *Response, err error)
ReadLogicalByStream this method read Adabas records in logical order given by the descriptor argument. The access in the database will NOT be reduce to I/O to the ASSO container. The result set will be called using the `streamFunction` method given.
func (*ReadRequest) ReadLogicalByWithParser ¶
func (request *ReadRequest) ReadLogicalByWithParser(descriptors string, resultParser adatypes.RequestParser, x interface{}) (err error)
ReadLogicalByWithParser read in logical order given by the descriptor argument
func (*ReadRequest) ReadLogicalWith ¶
func (request *ReadRequest) ReadLogicalWith(search string) (result *Response, err error)
ReadLogicalWith this method does an logical read using a search operation. The read records have a logical order given by a search string. The result records will be provied in the result `Response` structure value slice.
func (*ReadRequest) ReadLogicalWithCursoring ¶ added in v1.1.1
func (request *ReadRequest) ReadLogicalWithCursoring(search string) (cursor *Cursoring, err error)
ReadLogicalWithCursoring this method provide the search of records in Adabas and provide a cursor. The cursor will read a number of records using Multifetch calls. The number of records is defined in `Limit`. This method initialize the read records using cursoring.
Example ¶
err := initLogWithFile("connection_cursoring.log") if err != nil { fmt.Println("Error initializing log", err) return } connection, cerr := NewConnection("acj;map;config=[" + adabasModDBIDs + ",4]") if cerr != nil { fmt.Println("Error creating new connection", cerr) return } defer connection.Close() request, rerr := connection.CreateMapReadRequest("EMPLOYEES-NAT-DDM") if rerr != nil { fmt.Println("Error creating map read request", rerr) return } fmt.Println("Limit query data:") err = request.QueryFields("NAME,PERSONNEL-ID") if err != nil { fmt.Println("Error query fields", err) return } request.Limit = 0 fmt.Println("Init cursor data...") col, cerr := request.ReadLogicalWithCursoring("PERSONNEL-ID=[11100110:11100115]") if cerr != nil { fmt.Println("Error reading logical with using cursoring", cerr) return } fmt.Println("Read next cursor record...") counter := 0 for col.HasNextRecord() { record, rerr := col.NextRecord() if record == nil { fmt.Println("Record nil received") return } if rerr != nil { fmt.Println("Error reading logical with using cursoring", rerr) return } fmt.Println("Record received:") record.DumpValues() fmt.Println("Read next cursor record...") counter++ if counter >= 7 { fmt.Println("Error index about 7") return } } fmt.Println("Last cursor record read")
Output: Limit query data: Init cursor data... Read next cursor record... Record received: Dump all record values PERSONNEL-ID = > 11100110 < FULL-NAME = [ 1 ] NAME = > BUNGERT < Read next cursor record... Record received: Dump all record values PERSONNEL-ID = > 11100111 < FULL-NAME = [ 1 ] NAME = > THIELE < Read next cursor record... Record received: Dump all record values PERSONNEL-ID = > 11100112 < FULL-NAME = [ 1 ] NAME = > THOMA < Read next cursor record... Record received: Dump all record values PERSONNEL-ID = > 11100113 < FULL-NAME = [ 1 ] NAME = > TREIBER < Read next cursor record... Record received: Dump all record values PERSONNEL-ID = > 11100114 < FULL-NAME = [ 1 ] NAME = > UNGER < Read next cursor record... Record received: Dump all record values PERSONNEL-ID = > 11100115 < FULL-NAME = [ 1 ] NAME = > VETTER < Read next cursor record... Last cursor record read
func (*ReadRequest) ReadLogicalWithInterface ¶ added in v1.3.0
func (request *ReadRequest) ReadLogicalWithInterface(search string, interfaceFunction InterfaceFunction, x interface{}) (result *Response, err error)
ReadLogicalWithInterface this method does an logical read using a search operation. The read records have a logical order given by a search string. The result records will be provied to the callback interface function
func (*ReadRequest) ReadLogicalWithStream ¶ added in v1.1.1
func (request *ReadRequest) ReadLogicalWithStream(search string, streamFunction StreamFunction, x interface{}) (result *Response, err error)
ReadLogicalWithStream this method does an logical read using a search operation. The read records have a logical order given by a search string. The result records will be provied to the callback stream function
func (*ReadRequest) ReadLogicalWithWithParser ¶
func (request *ReadRequest) ReadLogicalWithWithParser(search string, resultParser adatypes.RequestParser, x interface{}) (err error)
ReadLogicalWithWithParser read records with a logical order given by a search string. The given parser will parse the corresponding data.
func (*ReadRequest) ReadPhysicalInterface ¶ added in v1.3.1
func (request *ReadRequest) ReadPhysicalInterface(interfaceFunction InterfaceFunction, x interface{}) (result *Response, err error)
ReadPhysicalInterface the Adabas records will be read in physical order. The physical read is an I/O optimal read with physical order of the records. For each read record a callback function defined by `interfaceFunction` will be called. This variant is used if dynamic interface are used.
func (*ReadRequest) ReadPhysicalSequence ¶
func (request *ReadRequest) ReadPhysicalSequence() (result *Response, err error)
ReadPhysicalSequence the Adabas records will be read in physical order. The physical read is an I/O optimal read with physical order of the records.
func (*ReadRequest) ReadPhysicalSequenceStream ¶ added in v1.1.1
func (request *ReadRequest) ReadPhysicalSequenceStream(streamFunction StreamFunction, x interface{}) (result *Response, err error)
ReadPhysicalSequenceStream the Adabas records will be read in physical order. The physical read is an I/O optimal read with physical order of the records. For each read record a callback function defined by `streamFunction` will be called.
func (*ReadRequest) ReadPhysicalSequenceWithParser ¶
func (request *ReadRequest) ReadPhysicalSequenceWithParser(resultParser adatypes.RequestParser, x interface{}) (err error)
ReadPhysicalSequenceWithParser read records in physical order using a special parser metod. This function will be removed in further version.
func (*ReadRequest) ReadPhysicalWithCursoring ¶ added in v1.6.3
func (request *ReadRequest) ReadPhysicalWithCursoring() (cursor *Cursoring, err error)
ReadPhysicalWithCursoring this method provide the physical read of records in Adabas and provide a cursor. The cursor will read a number of records using Multifetch calls. The number of records is defined in `Limit`. This method initialize the read records using cursoring.
func (*ReadRequest) Scan ¶ added in v1.1.2
func (request *ReadRequest) Scan(dest ...interface{}) error
Scan this method can be used to scan a number of parameters filled by values in the result set. See README.md explanation
func (*ReadRequest) SearchAndOrder ¶ added in v1.4.5
func (request *ReadRequest) SearchAndOrder(search, descriptors string) (result *Response, err error)
SearchAndOrder performs a search call and orders the result using defined descriptors
A search term will
be used to search for and a descriptor defines the final result order.
func (*ReadRequest) SearchAndOrderWithCursoring ¶ added in v1.4.9
func (request *ReadRequest) SearchAndOrderWithCursoring(search, descriptors string) (cursor *Cursoring, err error)
SearchAndOrderWithCursoring this method provide the search of records in Adabas ordered by a descriptor. It provide a cursor. The cursor will read a number of records using Multifetch calls. The number of records is defined in `Limit`. This method initialize the read records using cursoring.
func (*ReadRequest) SearchAndOrderWithParser ¶ added in v1.4.5
func (request *ReadRequest) SearchAndOrderWithParser(search, descriptors string, resultParser adatypes.RequestParser, x interface{}) (err error)
SearchAndOrderWithParser search and order with parser. A search term will be used to search for and a descriptor defines the final result order.
func (*ReadRequest) SetHoldRecords ¶ added in v1.1.2
func (request *ReadRequest) SetHoldRecords(hold adatypes.HoldType)
SetHoldRecords set hold record flag. All read operations will be done setting the record in hold for atomic reads and possible update operations afterwards.
func (*ReadRequest) TraverseFields ¶ added in v1.2.1
func (request *ReadRequest) TraverseFields(t adatypes.TraverserMethods, p interface{}) error
TraverseFields traverse through all request fields
type Record ¶ added in v1.1.1
type Record struct { Isn adatypes.Isn `xml:"Isn,attr"` Quantity uint64 `xml:"Quantity,attr"` Value []adatypes.IAdaValue HashFields map[string]adatypes.IAdaValue `xml:"-" json:"-"` LobEndTransaction bool // contains filtered or unexported fields }
Record one result record of the result list received by record list or in the stream callback.
To extract the values in the record you might request the value using the SearchValue() methods. Alternatively you might use the Traverse() callback method to call a method for each Adabas field in the tree. The tree includes group nodes of the Adabas record.
Example (DumpZeroValues) ¶
ferr := initLogWithFile("request_result.log") if ferr != nil { return } d := generatePEMUDefinitionTest() record, err := NewRecord(d) if err != nil { fmt.Println("Result record generation error", err) return } fmt.Println("Dump request result:") record.DumpValues()
Output: Dump request result: Dump all record values AA = > 0 < PE = [ 0 ] U8 = > 0 < P2 = [ 0 ] I8 = > 0 <
Example (SetValue) ¶
ferr := initLogWithFile("request_result.log") if ferr != nil { return } d := generatePEMUDefinitionTest() record, err := NewRecord(d) if err != nil { fmt.Println("Result record generation error", err) return } for i := uint32(0); i < 3; i++ { adatypes.Central.Log.Infof("==> Set period group entry PP of %d", (i + 1)) err = record.SetValueWithIndex("PP", []uint32{i + 1}, (i + 1)) if err != nil { fmt.Println("Set PP error", err) return } adatypes.Central.Log.Infof("<== Set period group entry PP of %d", (i + 1)) } adatypes.Central.Log.Infof("==> Set period MU") err = record.SetValueWithIndex("MU", []uint32{1, 1}, 100) if err != nil { fmt.Println("Set MU error", err) return } adatypes.Central.Log.Infof("==> Set second period MU") err = record.SetValueWithIndex("MU", []uint32{1, 2}, 122) if err != nil { fmt.Println("Set MU error", err) return } err = record.SetValue("AA", 2) if err != nil { fmt.Println("Set AA error", err) return } err = record.SetValue("U8", 3) if err != nil { fmt.Println("Set U8 error", err) return } err = record.SetValue("I8", 1) if err != nil { fmt.Println("Set I8 error", err) return } fmt.Println("Dump request result:") record.DumpValues()
Output: Dump request result: Dump all record values AA = > 2 < PE = [ 3 ] PP[01] = > 1 < MU[01] = [ 1 ] MU[01,01] = > 100 < MU[01,02] = > 122 < GR[01] = [ 1 ] PA[01] = > 0 < PG[01] = > 0 < G8[01] = > 0 < PP[02] = > 2 < MU[02] = [ 0 ] GR[02] = [ 1 ] PA[02] = > 0 < PG[02] = > 0 < G8[02] = > 0 < PP[03] = > 3 < MU[03] = [ 0 ] GR[03] = [ 1 ] PA[03] = > 0 < PG[03] = > 0 < G8[03] = > 0 < U8 = > 3 < P2 = [ 0 ] I8 = > 1 <
Example (SetValueWithIndex) ¶
ferr := initLogWithFile("request_result.log") if ferr != nil { return } d := generatePEMUDefinitionTest() record, err := NewRecord(d) if err != nil { fmt.Println("Result record generation error", err) return } adatypes.Central.Log.Debugf("Start set value") err = record.SetValueWithIndex("PX", []uint32{1, 1}, 122) if err == nil { fmt.Println("Error setting PX with MU error", err) return } fmt.Println("Correct error:", err) err = record.SetValueWithIndex("PX", []uint32{1, 0}, 122) if err != nil { fmt.Println("Error setting PX error", err) return } fmt.Println("Dump request result:") record.DumpValues()
Output: Correct error: ADG0000062: Multiple field index on an non-Multiple field Dump request result: Dump all record values AA = > 0 < PE = [ 0 ] U8 = > 0 < P2 = [ 1 ] PX[01] = > 122 < PY[01] = > 0 < I8 = > 0 <
func NewRecord ¶ added in v1.1.1
func NewRecord(definition *adatypes.Definition) (*Record, error)
NewRecord create new result record infrastructure based on the given definition
func NewRecordIsn ¶ added in v1.1.1
func NewRecordIsn(isn adatypes.Isn, isnQuantity uint64, definition *adatypes.Definition) (*Record, error)
NewRecordIsn create a new result record with ISN or ISN quantity
func (*Record) Bytes ¶ added in v1.4.0
Bytes search value and provide a raw byte slice representation.
func (*Record) DumpValues ¶ added in v1.1.1
func (record *Record) DumpValues()
DumpValues traverse through the tree of values calling a callback method
func (*Record) MarshalJSON ¶ added in v1.1.1
MarshalJSON provide JSON marshal function of a record
func (*Record) MarshalXML ¶ added in v1.1.1
MarshalXML provide XML marshal method of a record
func (*Record) SearchValue ¶ added in v1.1.1
SearchValue this method search for the value in the tree given by the field parameter.
func (*Record) SearchValueIndex ¶ added in v1.1.1
SearchValueIndex search value in the tree with a given index uint32 slice
func (*Record) SetPartialValue ¶ added in v1.4.0
SetPartialValue set the field value for a partial part of a lob field
func (*Record) SetValue ¶ added in v1.1.1
SetValue set the value for a specific field given by the field name. The field value is defined by the interface given. The field value index of a period group or multiple field might be defined using square brackets. For example AA[1,2] will set the first entry of a period group and the second entry of the multiple field.
func (*Record) SetValueWithIndex ¶ added in v1.1.1
SetValueWithIndex set the value for a specific field given by the field name. The field value is defined by the interface given. The field value index of a period group or multiple field might be defined using the uint32 slice.
func (*Record) Traverse ¶ added in v1.3.7
func (record *Record) Traverse(t adatypes.TraverserValuesMethods, x interface{}) (ret adatypes.TraverseResult, err error)
Traverse step/traverse through all record entries and call methods
func (*Record) TrimString ¶ added in v1.4.0
TrimString search value and provide a trimmed string/alpha representation.
func (*Record) ValueQuantity ¶ added in v1.2.8
ValueQuantity this method provide the number of quantity of an PE or MU field. If the field is referenced with a square bracket index, the corresponding MU field of an period group is counted. The quantity is not the Adabas record quantity. It represents the record result quantity only.
type Repository ¶
type Repository struct { sync.Mutex DatabaseURL // contains filtered or unexported fields }
Repository Adabas Map repository container
func NewMapRepository ¶
func NewMapRepository(i interface{}, fnr Fnr) *Repository
NewMapRepository new map repository created
func NewMapRepositoryWithURL ¶ added in v1.1.1
func NewMapRepositoryWithURL(url DatabaseURL) *Repository
NewMapRepositoryWithURL new map repository created
func (*Repository) AddMapToCache ¶ added in v1.4.4
func (repository *Repository) AddMapToCache(name string, adabasMap *Map)
AddMapToCache add map to cache
func (*Repository) ClearCache ¶ added in v1.3.0
func (repository *Repository) ClearCache(maxTime time.Time)
ClearCache clear cache if time frame occur
func (*Repository) DeleteMap ¶ added in v1.5.6
func (repository *Repository) DeleteMap(adabas *Adabas, mapName string) (err error)
DeleteMap delete map name out of specific map repository
func (*Repository) ExportMapRepository ¶ added in v1.5.7
func (repository *Repository) ExportMapRepository(ada *Adabas, filter string, fileName string) (err error)
ExportMapRepository import map by file import
func (*Repository) GetMapFromCache ¶ added in v1.4.4
func (repository *Repository) GetMapFromCache(name string) (*Map, bool)
GetMapFromCache get map from cache
func (*Repository) ImportMapRepository ¶
func (repository *Repository) ImportMapRepository(adabas *Adabas, filter string, fileName string, mapURL *DatabaseURL) (maps []*Map, err error)
ImportMapRepository import map by file import
func (*Repository) LoadAllMaps ¶
func (repository *Repository) LoadAllMaps(adabas *Adabas) (adabasMaps []*Map, err error)
LoadAllMaps load all map out of specific map repository
func (*Repository) LoadMapRepository ¶
func (repository *Repository) LoadMapRepository(adabas *Adabas) (err error)
LoadMapRepository read an index for names of all Adabas maps in the repository into memory
func (*Repository) RemoveMap ¶ added in v1.2.2
func (repository *Repository) RemoveMap(mapName string) (err error)
RemoveMap remove map from hash
func (*Repository) SearchMap ¶
func (repository *Repository) SearchMap(adabas *Adabas, mapName string) (adabasMap *Map, err error)
SearchMap search map name in specific map repository
func (*Repository) SearchMapInRepository ¶
func (repository *Repository) SearchMapInRepository(adabas *Adabas, mapName string) (adabasMap *Map, err error)
SearchMapInRepository search map name in specific map repository
type Response ¶ added in v1.1.1
type Response struct { XMLName xml.Name `xml:"-" json:"-"` Values []*Record `xml:"Records" json:"Records"` Data []interface{} `xml:"-" json:"-"` Definition *adatypes.Definition // contains filtered or unexported fields }
Response contains the result information of the request
Example (JsonMarshal) ¶
result := generateResult() res, err := json.Marshal(result) if err != nil { fmt.Println("Error generating JSON", err) return } fmt.Println(string(res))
Output: {"Records":[{"AA":10,"B1":0,"GR":{"G1":"0","GX":"","PA":9},"I2":0,"I8":0,"ISN":10,"U8":0,"UB":0},{"AA":20,"B1":0,"GR":{"G1":"0","GX":"","PA":3},"I2":0,"I8":0,"ISN":11,"U8":0,"UB":0}]}
Example (XmlMarshal) ¶
ferr := initLogWithFile("request_result.log") if ferr != nil { return } result := generateResult() res, err := xml.Marshal(result) if err != nil { fmt.Println("Error generating XML", err) return } fmt.Println(string(res))
Output: <Response><Record ISN="10"><AA>10</AA><B1>0</B1><UB>0</UB><I2>0</I2><U8>0</U8><GR><G1>0</G1><GX> </GX><PA>9</PA></GR><I8>0</I8></Record><Record ISN="11"><AA>20</AA><B1>0</B1><UB>0</UB><I2>0</I2><U8>0</U8><GR><G1>0</G1><GX> </GX><PA>3</PA></GR><I8>0</I8></Record></Response>
func (*Response) DumpData ¶ added in v1.3.0
DumpData if the dynamic interface is used to query Adabas records, the response does not create values. Instead the values are defined in the Data slice containing the interface slice. This method dumps the result data
func (*Response) DumpValues ¶ added in v1.1.1
DumpValues traverse through the tree of values calling a callback method
func (*Response) MarshalJSON ¶ added in v1.1.1
MarshalJSON provide JSON Marshaller of the response
func (*Response) MarshalXML ¶ added in v1.1.1
MarshalXML provide XML representation of the response
func (*Response) String ¶ added in v1.1.1
String string representation of the repsonse of the request
func (*Response) TraverseValues ¶ added in v1.1.1
func (Response *Response) TraverseValues(t adatypes.TraverserValuesMethods, x interface{}) (ret adatypes.TraverseResult, err error)
TraverseValues traverse through the tree of values calling a callback method
type Statistics ¶ added in v1.5.0
type Statistics struct {
// contains filtered or unexported fields
}
Statistics Adabas call statistic of all calls with counting remote calls
type Status ¶
type Status struct {
// contains filtered or unexported fields
}
Status of the referenced connection
type StoreRequest ¶
type StoreRequest struct {
// contains filtered or unexported fields
}
StoreRequest request instance handling data store and update
func NewAdabasMapNameStoreRequest ¶
func NewAdabasMapNameStoreRequest(adabas *Adabas, adabasMap *Map) (request *StoreRequest, err error)
NewAdabasMapNameStoreRequest creates a new store Request instance using an Adabas instance and Adabas Map. This is only for internal use. Use the `Connection` instance to create store requests. This constructor is internal.
func NewStoreRequest ¶
func NewStoreRequest(param ...interface{}) (*StoreRequest, error)
NewStoreRequest creates a new store Request instance using different types of parameters. This is only for internal use. Use the `Connection` instance to create store requests. This constructor is internal.
func NewStoreRequestAdabas ¶
func NewStoreRequestAdabas(adabas *Adabas, fnr Fnr) *StoreRequest
NewStoreRequestAdabas creates a new store Request instance using an Adabas instance and Adabas file number. This is only for internal use. Use the `Connection` instance to create store requests. This constructor is internal.
func (*StoreRequest) BackoutTransaction ¶ added in v1.1.1
func (request *StoreRequest) BackoutTransaction() error
Backout this send the backout of the open transactions. All transactions will be rolled back after the call.
func (*StoreRequest) Close ¶
func (request *StoreRequest) Close()
Close call the CL call to Adabas. This closes the Adabas session. Attention, this will not backout transaction. It will end the transactions.
func (*StoreRequest) CreateRecord ¶
func (request *StoreRequest) CreateRecord() (record *Record, err error)
CreateRecord create a record for a special store request. The fields which are part of the record are defined using the `StoreFields` method.
func (*StoreRequest) EndTransaction ¶
func (request *StoreRequest) EndTransaction() error
EndTransaction call an end of Adabas database transaction
func (*StoreRequest) Exchange ¶
func (request *StoreRequest) Exchange(storeRecord *Record) error
Exchange exchange a record
func (*StoreRequest) IsOpen ¶
func (request *StoreRequest) IsOpen() bool
IsOpen provide True if the database connection is opened
func (*StoreRequest) Open ¶
func (request *StoreRequest) Open() (err error)
Open Open the Adabas session
func (*StoreRequest) Store ¶
func (request *StoreRequest) Store(storeRecord *Record) error
Store store/insert a given record into database. Note: the data is stored, but is not final until the end of transaction is done.
func (*StoreRequest) StoreData ¶ added in v1.3.0
func (request *StoreRequest) StoreData(data ...interface{}) error
StoreData store interface data, either struct or array
func (*StoreRequest) StoreFields ¶
func (request *StoreRequest) StoreFields(param ...interface{}) (err error)
StoreFields defines the fields to be part of the store request. This is to prepare the create record for the next store
func (*StoreRequest) TraverseFields ¶ added in v1.2.1
func (request *StoreRequest) TraverseFields(t adatypes.TraverserMethods, p interface{}) error
TraverseFields traverse through all request fields
func (*StoreRequest) Update ¶
func (request *StoreRequest) Update(storeRecord *Record) error
Update update a given record into database. The given record need to include the corresponding Isn information provided by a previous read call. Note: the data is update in Adabas, but is not final until the end of transaction is done. Dirty ready may be done.
func (*StoreRequest) UpdateData ¶ added in v1.3.0
func (request *StoreRequest) UpdateData(data ...interface{}) error
UpdateData update interface data, either struct or array
type StreamFunction ¶ added in v1.1.1
StreamFunction function callback used to go through the list of received records
type TransferDataType ¶ added in v1.5.4
type TransferDataType uint32
TransferDataType transfer data type used to check buffer
type URL ¶
URL define the desination of the host. Possible types are
- Local call with Driver="" and Port=0
- Entire Network calls with Driver="tcpip" and corresponding host and port
- Adabas TCP/IP calls with Driver="adatcp" and corresponding host and port
Dependent on the Driver the corresponding connection is used. To use the local call access the Adabas Client native library is used.
func NewURLWithDbid ¶ added in v1.1.1
NewURLWithDbid create a new URL based on the database id only. Simple local access to the database
func (*URL) UnmarshalJSON ¶
UnmarshalJSON unmarshal JSON code
Source Files
¶
- adabas.go
- adabas_const.go
- adabas_message.go
- adabasbuffer.go
- adabasstructure.go
- connection.go
- cursoring.go
- delete_request.go
- doc.go
- fdt.go
- global_map_repository.go
- map.go
- map_adaption.go
- map_export.go
- map_import.go
- map_json.go
- map_repositories.go
- rcall.go
- read_request.go
- request.go
- request_interface.go
- request_result.go
- result_record.go
- store_request.go
- stream.go
- struct.go
- tcp.go
- tcp_data.go
- url.go