mirror of
https://github.com/elliotnunn/sys7.1-doc-wip.git
synced 2024-12-12 20:29:12 +00:00
335 lines
8.3 KiB
Plaintext
335 lines
8.3 KiB
Plaintext
; Created: Monday, March 20, 1989 at 10:00:00 AM
|
||
;
|
||
; File: DatabaseAccess.a
|
||
;
|
||
; Assembler Interface to the Macintosh Libraries
|
||
; Copyright Apple Computer, Inc. 1989-90
|
||
; All Rights Reserved
|
||
;
|
||
; Change History (most recent first):
|
||
;
|
||
; <21> 1/30/91 gbm sab, #38: Change the ‘already including this file’ variable to
|
||
; all uppercase (for security reasons)
|
||
; <20> 8/2/90 JSM Add kDBNullFlag.
|
||
; <19> 7/1/90 JSM Change typeChar constant from 'char' to 'TEXT'.
|
||
; <18> 7/1/90 JSM Update some DBType constants to conform to AppleEvents
|
||
; conventions.
|
||
; <15> 4/27/90 JSM Remove QuitDBPack.
|
||
; <14> 3/13/90 JSM Remove kDBGetItemEndOfRow message, add DBColInfoRecord, update
|
||
; ResultsRecord, bump version number on InitDBPack, change names
|
||
; of ResultsHandler routines to ResultHandler.
|
||
; <13> 2/26/90 JSM Change selectors to use new dispatcher, eliminate gaps between
|
||
; return codes, bump version on InitDBPack.
|
||
; <12> 2/22/90 JSM Add kDBStartQueryComplete.
|
||
; <10> 2/8/90 JSM Restore change history.
|
||
; <8> 2/6/90 JSM Remove rcDBCancel and rcDBStatusCancel, add
|
||
; kDBGetQueryResultsComplete.
|
||
; <7> 2/5/90 JSM Remove obsolete return code rcDBBadCol.
|
||
; <5> 1/4/90 JSM Change connstr to connStr.
|
||
; <4> 12/22/89 JSM Add kDBLastColFlag.
|
||
; <3> 12/19/89 JSM Cleanup again after fixing AddChange.
|
||
; <2> 12/19/89 JSM Cleanup after initial checkin.
|
||
; <1> 12/19/89 JSM Adding to public includes for the first time.
|
||
; <2.2> 11/7/89 JSM Added status functions, changed DBUnGetVal to DBUnGetItem,
|
||
; bumped version on InitDBPack.
|
||
; <2.1> 10/6/89 JSM Updated to make SnarfMan a PACK.
|
||
; <2.0> 8/29/89 JSM Updated for new version 2 API.
|
||
; <1.8> 8/7/89 JSM Added new rc's, added colLens to ResultsRecord, added kill and
|
||
; results-to-text stuff.
|
||
; <1.7> 7/26/89 JSM Added new return code rcDBAsyncNotSupp.
|
||
; <1.6> 7/19/89 JSM Changed 'type' to 'theType' in ResListElem.
|
||
; <1.5> 6/22/89 JSM Removed handle in ResListElem.
|
||
; <1.4> 6/9/89 JSM Added 4 byte data types, ddevRef to async param block.
|
||
; <1.3> 5/31/89 JSM Removed rcDBReady and rcDBSize errors, added async support.
|
||
; <1.2> 5/18/89 JSM Updated selectors, changed for new trap dispatch mechanism,
|
||
; added version and id to QueryRecord.
|
||
; <1.1> 4/28/89 JSM Added high-level information.
|
||
; <1.0> 4/11/89 JSM Added to EASE for the first time.
|
||
;___________________________________________________________________________
|
||
|
||
IF &TYPE('__INCLUDINGDATABASEACCESS__') = 'UNDEFINED' THEN
|
||
__INCLUDINGDATABASEACCESS__ SET 1
|
||
|
||
; error and status codes
|
||
|
||
rcDBNull EQU -800
|
||
rcDBValue EQU -801
|
||
rcDBError EQU -802
|
||
rcDBBadType EQU -803
|
||
rcDBBreak EQU -804
|
||
rcDBExec EQU -805
|
||
rcDBBadSessID EQU -806
|
||
rcDBBadSessNum EQU -807
|
||
|
||
rcDBBadDDEV EQU -808
|
||
|
||
rcDBAsyncNotSupp EQU -809
|
||
rcDBBadAsyncPB EQU -810
|
||
|
||
rcDBNoHandler EQU -811
|
||
|
||
rcDBWrongVersion EQU -812
|
||
rcDBPackNotInited EQU -813
|
||
|
||
; messages for status functions for DBStartQuery
|
||
|
||
kDBUpdateWind EQU 0
|
||
kDBAboutToInit EQU 1
|
||
kDBInitComplete EQU 2
|
||
kDBSendComplete EQU 3
|
||
kDBExecComplete EQU 4
|
||
kDBStartQueryComplete EQU 5
|
||
|
||
; messages for status functions for DBGetQueryResults
|
||
|
||
kDBGetItemComplete EQU 6
|
||
kDBGetQueryResultsComplete EQU 7
|
||
|
||
; DBType codes
|
||
|
||
typeNone EQU 'none'
|
||
typeBoolean EQU 'bool'
|
||
typeSMInt EQU 'shor'
|
||
typeInteger EQU 'long'
|
||
typeSMFloat EQU 'sing'
|
||
typeFloat EQU 'doub'
|
||
typeDate EQU 'date'
|
||
typeTime EQU 'time'
|
||
typeTimeStamp EQU 'tims'
|
||
typeChar EQU 'TEXT'
|
||
typeDecimal EQU 'deci'
|
||
typeMoney EQU 'mone'
|
||
typeVChar EQU 'vcha'
|
||
typeVBin EQU 'vbin'
|
||
typeLChar EQU 'lcha'
|
||
typeLBin EQU 'lbin'
|
||
typeDiscard EQU 'disc'
|
||
|
||
; "dummy" types for DBResultsToText
|
||
|
||
typeUnknown EQU 'unkn'
|
||
typeColBreak EQU 'colb'
|
||
typeRowBreak EQU 'rowb'
|
||
|
||
; pass this in to DBGetItem for any data type
|
||
|
||
typeAnyType EQU 0
|
||
|
||
; infinite timeout value for DBGetItem
|
||
|
||
kDBWaitForever EQU -1
|
||
|
||
; flags for DBGetItem
|
||
|
||
kDBLastColFlag EQU 1
|
||
kDBNullFlag EQU 4
|
||
|
||
; structure for asynchronous parameter block
|
||
|
||
DBAsyncParamBlockRec RECORD 0
|
||
completionProc DS.L 1 ; pointer to completion routine
|
||
result DS.W 1 ; result of call
|
||
userRef DS.L 1 ; for application's use
|
||
ddevRef DS.L 1 ; for ddev's use
|
||
reserved DS.L 1 ; for internal use
|
||
DBAsyncParmBlkSize EQU *
|
||
ENDR
|
||
|
||
; structure for resource list in QueryRecord
|
||
|
||
ResListElem RECORD 0
|
||
theType DS.L 1
|
||
id DS.W 1
|
||
ResListElemSize EQU *
|
||
ENDR
|
||
|
||
QueryRecord RECORD 0
|
||
version DS.W 1 ; version
|
||
id DS.W 1 ; id of 'qrsc' this came from
|
||
queryProc DS.L 1 ; handle to query def proc
|
||
ddevName DS.B 64 ; ddev name
|
||
host DS.B 256 ; host
|
||
user DS.B 256 ; user
|
||
password DS.B 256 ; password
|
||
connStr DS.B 256 ; other connection info
|
||
currQuery DS.W 1 ; current query
|
||
numQueries DS.W 1 ; number of queries in queryList
|
||
queryList DS.L 1 ; handle to list of queries
|
||
numRes DS.W 1 ; number of resources in resList
|
||
resList DS.L 1 ; handle to list of other resources
|
||
dataHandle DS.L 1 ; data used by query def proc
|
||
refCon DS.L 1 ; query's reference value
|
||
QueryRecordSize EQU *
|
||
ENDR
|
||
|
||
DBColInfoRecord RECORD 0
|
||
len DS.W 1
|
||
places DS.W 1
|
||
flags DS.W 1
|
||
DBColInfoRecordSize EQU *
|
||
ENDR
|
||
|
||
ResultsRecord RECORD 0
|
||
numRows DS.W 1 ; number of rows in result
|
||
numCols DS.W 1 ; number of columns per row
|
||
colTypes DS.L 1 ; data type array
|
||
colData DS.L 1 ; actual results
|
||
colInfo DS.L 1 ; DBColInfoRecord array
|
||
ResultsRecordSize EQU *
|
||
ENDR
|
||
|
||
;
|
||
; Routine Selectors
|
||
;
|
||
|
||
InitDBPack EQU $0100
|
||
DBInit EQU $0E02
|
||
DBEnd EQU $0403
|
||
DBGetConnInfo EQU $1704
|
||
DBGetSessionNum EQU $0605
|
||
DBSend EQU $0706
|
||
DBSendItem EQU $0B07
|
||
DBExec EQU $0408
|
||
DBState EQU $0409
|
||
DBGetErr EQU $0E0A
|
||
DBBreak EQU $050B
|
||
DBGetItem EQU $100C
|
||
DBUnGetItem EQU $040D
|
||
DBKill EQU $020E
|
||
DBGetNewQuery EQU $030F
|
||
DBDisposeQuery EQU $0210
|
||
DBStartQuery EQU $0811
|
||
DBGetQueryResults EQU $0A12
|
||
DBResultsToText EQU $0413
|
||
DBInstallResultHandler EQU $0514
|
||
DBRemoveResultHandler EQU $0215
|
||
DBGetResultHandler EQU $0516
|
||
|
||
;
|
||
; For package invocation
|
||
; First arg is routine selector, second is the trap
|
||
; Slightly modified from PackMacs.a to pass selector in D0,
|
||
; and always call Pack13.
|
||
;
|
||
|
||
MACRO
|
||
_Pack13Call
|
||
MOVE.W &SYSLIST[1],D0
|
||
_Pack13
|
||
ENDM
|
||
|
||
;
|
||
; Database Access Manager routines
|
||
;
|
||
MACRO
|
||
_InitDBPack
|
||
MOVE.W #$0004, -(A7) ; push version number
|
||
_Pack13Call #InitDBPack
|
||
ENDM
|
||
|
||
MACRO
|
||
_DBInit
|
||
_Pack13Call #DBInit
|
||
ENDM
|
||
|
||
MACRO
|
||
_DBEnd
|
||
_Pack13Call #DBEnd
|
||
ENDM
|
||
|
||
MACRO
|
||
_DBGetConnInfo
|
||
_Pack13Call #DBGetConnInfo
|
||
ENDM
|
||
|
||
MACRO
|
||
_DBGetSessionNum
|
||
_Pack13Call #DBGetSessionNum
|
||
ENDM
|
||
|
||
MACRO
|
||
_DBSend
|
||
_Pack13Call #DBSend
|
||
ENDM
|
||
|
||
MACRO
|
||
_DBSendItem
|
||
_Pack13Call #DBSendItem
|
||
ENDM
|
||
|
||
MACRO
|
||
_DBExec
|
||
_Pack13Call #DBExec
|
||
ENDM
|
||
|
||
MACRO
|
||
_DBState
|
||
_Pack13Call #DBState
|
||
ENDM
|
||
|
||
MACRO
|
||
_DBGetErr
|
||
_Pack13Call #DBGetErr
|
||
ENDM
|
||
|
||
MACRO
|
||
_DBBreak
|
||
_Pack13Call #DBBreak
|
||
ENDM
|
||
|
||
MACRO
|
||
_DBGetItem
|
||
_Pack13Call #DBGetItem
|
||
ENDM
|
||
|
||
MACRO
|
||
_DBUnGetItem
|
||
_Pack13Call #DBUnGetItem
|
||
ENDM
|
||
|
||
MACRO
|
||
_DBKill
|
||
_Pack13Call #DBKill
|
||
ENDM
|
||
|
||
MACRO
|
||
_DBGetNewQuery
|
||
_Pack13Call #DBGetNewQuery
|
||
ENDM
|
||
|
||
MACRO
|
||
_DBDisposeQuery
|
||
_Pack13Call #DBDisposeQuery
|
||
ENDM
|
||
|
||
MACRO
|
||
_DBStartQuery
|
||
_Pack13Call #DBStartQuery
|
||
ENDM
|
||
|
||
MACRO
|
||
_DBGetQueryResults
|
||
_Pack13Call #DBGetQueryResults
|
||
ENDM
|
||
|
||
MACRO
|
||
_DBResultsToText
|
||
_Pack13Call #DBResultsToText
|
||
ENDM
|
||
|
||
MACRO
|
||
_DBInstallResultHandler
|
||
_Pack13Call #DBInstallResultHandler
|
||
ENDM
|
||
|
||
MACRO
|
||
_DBRemoveResultHandler
|
||
_Pack13Call #DBRemoveResultHandler
|
||
ENDM
|
||
|
||
MACRO
|
||
_DBGetResultHandler
|
||
_Pack13Call #DBGetResultHandler
|
||
ENDM
|
||
|
||
ENDIF ; ...already included |