'
'
'   Copyright (c) 1992-94                Coromandel Industries Inc.
'
'   All rights reserved. No part of this program or publication may be
'   reproduced, transcribed, stored in a retrieval system, or translated
'   into any language or computer language, in any form or by any means,
'   electronic, mechanical, magnetic, optical, chemical, biological, or
'   otherwise, without the prior written permission of :
'
'              Coromandel Industries Inc.,
'
'         70-15, Austin St., 3Rd Floor, Forest Hills, NY 11375.
'
'  System       :    INTEGRA VDB SQL Controls
'  Module       :    VDB Engine
'  Filename     :    vdb.txt
'  Description  :    Global constant for Integra VDB
'

'  Version  -------------------------------------------------------------

	Global Const SQC_VERSION = 200  '  major version 2.00

'  object types ---------------------------------------------------------

	Global Const SQC_FORM = 100           ' the object type is form
	Global Const SQC_CONTROL = 101        'the object type is a childcontrol
	Global Const SQC_DATASTREAM = 102     ' the object type is a data source
	Global Const SQC_CONNECTION = 103     ' the object type is connection
	Global Const SQC_ENVIRONMENT = 104    ' the object type is ODBC hEnv
	Global Const SQC_DBPROP = 105         ' Object type is capability mask
	Global Const SQC_BOUNDCTRL = 106      '  HWND of bound visual control
	Global Const SQC_APP = 107

'  warning codes --------------------------------------------------------

	Global Const WREPLACE = 10000           '  an object has been replaced

'  error codes -----------------------------------------------------------

	Global Const ERRBASE = -10000
	Global Const ENORES = ERRBASE - 100     '  no resources left
	Global Const BADPARAM = ERRBASE - 200   '  illegal argument
	Global Const ESUBSTI = ERRBASE - 300    ' Substitution failed
	Global Const EBADHAND = ERRBASE - 600   '  bad app handle
	Global Const EBADWND = ERRBASE - 700    '  bad window  handle
	Global Const EBADCTRL = ERRBASE - 900   '  bad control handle
	Global Const EDBERR = ERRBASE - 1000    '  database error
	Global Const EQUERY = ERRBASE - 1200    '  error with result columncnt
	Global Const EBADFORM = ERRBASE - 1500  '  bad form
	Global Const EBADRANGE = ERRBASE - 1600 '  bad control
	Global Const EBADCOL = ERRBASE - 1800   '  bad column syntax
	Global Const EBADCURS = ERRBASE - 1900  '  bad cursor syntax
	Global Const ESYNTAX = ERRBASE - 2100   '  bad syntax
	Global Const EBADBIND = ERRBASE - 2200  '  bad bind structure
	Global Const EBADPORT = ERRBASE - 2300  '  bad port name
	Global Const ESEQERR = ERRBASE - 2400   '  sequence error
	Global Const EIMPEXP = ERRBASE - 2500   '  import export error
	Global Const ECURSTATE = ERRBASE - 2600 '  bad cursor state
	Global Const SS_EOF = ERRBASE - 2700    '  End of cursor
	Global Const ENOTINST = ERRBASE - 2800  '  Not installed properly
	Global Const EACCESS = ERRBASE - 2900   '  Access violation
	Global Const EINTERR = ERRBASE - 3100   '  Internal error
	Global Const ENOCOL = ERRBASE - 3300    '  no column is selected
	Global Const ENORESULT = ERRBASE - 3400 '  no result set
	Global Const ENOOBJ = ERRBASE - 3600    '  no object exists
	Global Const ECOLSEQ = ERRBASE - 3700   '  column sequence error
	Global Const ETRUNC = ERRBASE - 3800    '  data is truncated
	Global Const ETMPFILE = ERRBASE - 3900  '  error in temp file of cursor
	Global Const EVALERR = ERRBASE - 4100   '  Error in expression evaluation
	Global Const EBADNAME = ERRBASE - 4200  '  Name is not a valid object
	Global Const ETRIG = ERRBASE - 4400     '  Trigger string error
	Global Const EDATEERR = ERRBASE - 4500  '  Date format conversion error
	Global Const ECANCEL = ERRBASE - 4600   '  Cancelled by user
	Global Const EFILTER = ERRBASE - 4700   '  Filter error
	Global Const SS_EOR = ERRBASE - 4800    '  End of result set
	Global Const ESORTERR = ERRBASE - 4900  '  sort errors
	Global Const ELASTERROR = ERRBASE - 5000'  Last errors

'  success codes -------------------------------------------------------------

	Global Const SS_SUCCESS = 0

'  application mode bits -----------------------------------------------------

	Global Const SQC_APP_SHOWERR = 1       '  display all errors
	Global Const SQC_APP_SHOWSQL = 2       '  display all sql statements
	Global Const SQC_APP_SHOWTEXT = 4      '  show sql stmts in text box
	Global Const SQC_APP_LOG = 8           '  log operations
	Global Const SQC_APP_DESIGN = 16       '  design mode op allowed
	Global Const SQC_APP_NOCURSORNAME = 32 '  no cursor name for showsql
	Global Const SQC_APP_NO3rdPARTY = 64   ' No automatic support for third party controls

'  connect modes -------------------------------------------------------------

	Global Const SQC_CONNECT = 3           '  use connect
	Global Const SQC_DRVCONNECT = 4        '  use driver connect

'  types of cursors ----------------------------------------------------------

	Global Const SQC_TABLES = 1             '  list of tables
	Global Const SQC_COLUMNS = 2            '  list of columns
	Global Const SQC_SELECT = 3             '  select statement
	Global Const SQC_GENERIC = 4            '  generic non select stmt
	Global Const SQC_STATISTICS = 5         '  list of indexes
	Global Const SQC_SPECIALCOLS = 6        '  list of special columns
	Global Const SQC_IMPORT = 7             '  import file
	Global Const SQC_EXPORT = 8             '  export file
	Global Const SQC_TYPEINFO = 9           '  sql data type info
	Global Const SQC_MEMORY = 10            '  memory cursor
	Global Const SQC_LOOKUP = 11            '  lookup cursor
	Global Const SQC_PROCLIST = 12          ' Procedure list
	Global Const SQC_PROCEDURE = 13         ' Procedure
	Global Const SQC_PASSTHROUGH = 14       ' Pass through
	Global Const SQC_PROCCOLS = 15          ' Procedure columns

'  access modes for cursors --------------------------------------------------

	Global Const SQC_ACC_UPD = 1           '  allow updates
	Global Const SQC_ACC_INS = 2           '  allow inserts
	Global Const SQC_ACC_DEL = 4           '  allow deletes
	Global Const SQC_ACC_MODIFY = 7        '  or of upd,del and ins
	Global Const SQC_ACC_BROWSE = 8        '  allow browsing(next and prev)
	Global Const SQC_ACC_QUERY = 16        '  allow query from form
	Global Const SQC_ACC_SNAPSHOT = 32     '  set snapshot mode
	Global Const SQC_ACC_RESERVED = 64     '  must be zero
	Global Const SQC_ACC_PRIMKEY = 128     '  first col is prim key part 1
	Global Const SQC_ACC_PRIMKEY2 = 256    '  second col is prim key part 2
	Global Const SQC_ACC_ENCELLATTRIB = 512 ' enable cell level attributes
	Global Const SQC_ACC_KEYSET = 1024    '  store only keys in cursor set
	Global Const SQC_ACC_ENBUTTON = 2048    '  enable button on off
	Global Const SQC_ACC_AUTO = 4096       '  set best accessmode
	Global Const SQC_ACC_NORUN = &H2000    '  no run cursor for modify
	Global Const SQC_ACC_ENSUB = &H4000    '  enable substitution
	Global Const SQC_ACC_FETCHALL = &H10000     '  events for all fetches
	Global Const SQC_ACC_INSEVENT = &H20000     'enable events for insert
	Global Const SQC_ACC_UPDEVENT = &H40000     'enable events for update
	Global Const SQC_ACC_DELEVENT = &H80000     'enable events for delete
	Global Const SQC_ACC_FETCHEVENT = &H100000  'enable events for fetch
	Global Const SQC_ACC_FIELDEVENT = &H200000  'enable events for field
	Global Const SQC_ACC_ROWSEL = &H400000      'enable events for rowsel
	Global Const SQC_ACC_STATEEVENT = &H800000  'enable events for state
	Global Const SQC_ACC_MODIFYEVENT = &H4E0000 'INS+UPD+DEL+ROWSEL
	Global Const SQC_ACC_CONFUPD = &H10000000   'confirm all updates
	Global Const SQC_ACC_CONFDEL = &H20000000   'confirm all deletes
	Global Const SQC_ACC_CONFINS = &H40000000   'confirm all inserts

'  data source and visual control types as indexes ----------------------------

	Global Const SQC_DSI_ODBC = 0            ' Odbc Cursor
	Global Const SQC_DSI_CURSORVIEW = 1      ' Cursor View
	Global Const SQC_CTI_ThTXB = 16          '  thunder text box
	Global Const SQC_CTI_MGRID = 17          '  thunder grid
	Global Const SQC_CTI_CGRID = 18          '  CI grid
	Global Const SQC_CTI_CBUTTON = 19        '   Button controls
	Global Const SQC_CTI_LB = 20             '   List Box control
	Global Const SQC_CTI_CMB = 21            '   Combo Box control
	Global Const SQC_CTI_CHKBOX = 22         '   CheckBox control
	Global Const SQC_CTI_RB = 23             '   Radio Button Control
	Global Const SQC_CTI_FRAME = 24          '   Frame control
	Global Const SQC_CTI_3rdPARTY = 25       '   3rd party control

'  fetch browse modes -------------------------------------------------------

	Global Const SQC_CURS_NEXT = 0          ' fetch next record
	Global Const SQC_CURS_FIRST = 1         ' fetch first record
	Global Const SQC_CURS_LAST = 2          ' fetch last record
	Global Const SQC_CURS_PREV = 3          ' fetch prev record
	Global Const SQC_CURS_ABS = 4           ' fetch record by 1 based pos
	Global Const SQC_CURS_REL = 5           ' fetch record relative to cur
	Global Const SQC_CURS_ALL = 6           '
	Global Const SQC_CURS_CURR = 7          ' fetch current record

' opmode query bits -------------------------------------------------------

	Global Const SQC_QRY_AND = 0                 '
	Global Const SQC_QRY_OR = 1                  '
	Global Const SQC_QRY_LIKEPOST = 2            '
	Global Const SQC_QRY_LIKEPRE = 4             '
	Global Const SQC_QRY_EXTERN = 128            ' query fields are external

	Global Const SQC_QRY_MASK = 135
' mask edit property definitions ------------------------------------------

	Global Const SQC_MASK_DISABLEMASK = 10          '
	Global Const SQC_MASK_DISPLAYONLY = 11          '

'  date formats ------------------------------------------------------------

	Global Const SQC_DATE_FRDISP = 100  '  from display format to ISO
	Global Const SQC_DATE_FRDRV = 101   '  from driver format to ISO
	Global Const SQC_DATE_TODISP = 102  '  from ISO format to display
	Global Const SQC_DATE_TODRV = 103   '  from ISO format to driver


'  flag bits for bind column host flag variable -----------------------------

	Global Const SQC_COL_NULLBIT = 1        '  if set null value
	Global Const SQC_COL_INSERT = 2         '  if set accept for insert
	Global Const SQC_COL_UPDATE = 4         '  if set accept for update
	Global Const SQC_COL_DELETE = 8         '  if set delete Op
	Global Const SQC_COL_DATATRUNC = 16     '  if set data truncated
	Global Const SQC_COL_MARKED = 32        ' if set row/col is marked
	Global Const SQC_COL_NOMODIFY = 64      ' if set row can't be modified/deleted

' mode bits for SQcNewRecord Call -------------------------------------------

	Global Const SQC_NEW_NOINSERT = 1       'NewRecord will not automaticall
						'insert the new record

'  return values for events ------------------------------------------------

	Global Const SQC_EVENT_CONTINUE = 0 '  continue the operation
	Global Const SQC_EVENT_ABORT = 9    '  abort the operation
	Global Const SQC_EVENT_NEWDATA = 2  '  continue after accepting new data
	Global Const SQC_EVENT_PRELOAD = 3  ' cause PREFETCH event before
					    ' showing the data

' Cursor Event State codes returned for Cursor states ----------------------

	Global Const SQC_EVENT_OPEN = 100    'event occurs before first record
	Global Const SQC_EVENT_CLOSE = 101   ' event occurs after close
	Global Const SQC_EVENT_LASTREC = 102 'event occurs after last record
					     'is read from database
	Global Const SQC_EVENT_EXEC = 103    'event occurs before execution of
					     'preparable statement
	Global Const SQC_EVENT_DESTROY = 104  ' The cursor is about to be destroyed
	Global Const SQC_EVENT_POSTACTION = 105 ' event occurs after each operation on cursor

' Event PREFETCH event flags

	Global Const SQC_FETCH_FIRST = 200   'fetching first time from database
	Global Const SQC_FETCH_REFETCH = 201 'refetching from database
	Global Const SQC_FETCH_BROWSE = 202  'fetching from cursor while browsing

'  event constants-- the order must be same as defined in custom control-----

	Global Const SQC_CURS_ERROR = 0
	Global Const SQC_CURS_PREDELETE = 1
	Global Const SQC_CURS_PREFETCH = 2
	Global Const SQC_CURS_PREFIELD = 3
	Global Const SQC_CURS_PREINSERT = 4
	Global Const SQC_CURS_PREUPDATE = 5
	Global Const SQC_CURS_ROWSEL = 6
	Global Const SQC_CURS_STATE = 7
	Global Const SQC_APP_CURSORCREATE = 0

'  trigger types -------------------------------------------------------------
	Global Const SQC_TRG_ROWSEL = 100       '  row selected ( from list box or ctrl obj)
	Global Const SQC_TRG_FETCH = 101        '  fetch trigger (cursor object)
	Global Const SQC_TRG_INSERT = 102       '  insert trigger (cursor object)
	Global Const SQC_TRG_UPDATE = 103       '  update trigger (cursor object)

'   Connection Options -------------------------------------------------------

   Global Const SQC_DBM_ISO0 = 1        '  Isolation level READ_UNCOMMITTED
   Global Const SQC_DBM_ISO1 = 2        '  Isolation level READ_COMMITTED
   Global Const SQC_DBM_ISO2 = 4        '  Isolation level REPEATABLE_READ
   Global Const SQC_DBM_ISO3 = 8        '  Isolation level SERIALIZABLE
   Global Const SQC_DBM_ISO4 = 16       '  Isolation level VERSIONING
   Global Const SQC_DBM_ENISO = 32      '  Set Isolation Level
   Global Const SQC_DBM_AUTOCOMMIT = 64 '  auto commit
   Global Const SQC_DBM_ENAUTOC = 128   '  set auto commit
   Global Const SQC_DBM_TRANS = 256     '  special  cols in TRANSACTION scope
   Global Const SQC_DBM_SESS = 512      '  special  cols in SESSION scope
   Global Const SQC_DBM_CURROW = &H400  '  special  cols in CURROW scope
   Global Const SQC_DBM_ENSCOPE = &H800 'set scope option for special cols
   Global Const SQC_DBM_T1AST = &H10000 'for select * qualify with tblname
   Global Const SQC_DBM_ROWID = &H20000 'database has special ROWID
   Global Const SQC_DBM_ENROWID = &H40000 'set database rowid  & T1AST
   Global Const SQC_DBM_1STMT = &H80000   ' Only one statement can be active
   Global Const SQC_DBM_NOAST = &H100000  ' * cannot be qualified by table name
   Global Const SQC_DBM_OUTERJ = &H400000 ' Outer join supported
   Global Const SQC_DBM_OUTERFJ = &H800000 ' Full outer joins supported
   Global Const SQC_DBM_INSPARAM = &H1000000 ' Insert through params
   Global Const SQC_DBM_DELIMIT = &H2000000 ' Delimit the column names

   Global Const SQC_DBM_ENGEN = &H80000000    ' Enable general flags


    ' Operation codes to be used in ButtonControl call


    Global Const OP_none = 0            'No operation
    Global Const OP_ClearForm = 1       ' clear the form in actionstr
    Global Const OP_ClearQuery = 2      'clear text fields bound to cursor
    Global Const OP_CloseCursor = 3     ' close the cursor
    Global Const OP_Delete = 4          ' delete the current record
    Global Const OP_Curr = 5            ' refetch the current record
    Global Const OP_First = 6           ' fetch the first record
    Global Const OP_Last = 7            ' fetch the last record
    Global Const OP_Next = 8            ' fetch the next record
    Global Const OP_Prev = 9            ' fetch the previous record
    Global Const OP_Insert = 10         ' insert record
    Global Const OP_Open = 11           ' oper the cursor
    Global Const OP_QBF = 12            ' query by form
    Global Const OP_Update = 13         ' update the current record
    Global Const OP_ExecuteChain = 14   ' execute the chain of cursors
    Global Const OP_NewRecord = 15      ' insert a new record using defaults
    Global Const OP_LastCommand = 16    ' Place holder


'  sql data types to be used while binding host address -----------------------

	Global Const SQC_CHAR = 1
	Global Const SQC_NUMERIC = 2
	Global Const SQC_DECIMAL = 3
	Global Const SQC_INTEGER = 4
	Global Const SQC_SMALLINT = 5
	Global Const SQC_FLOAT = 6
	Global Const SQC_REAL = 7
	Global Const SQC_DOUBLE = 8
	Global Const SQC_DATE = 9
	Global Const SQC_TIME = 10
	Global Const SQC_TIMESTAMP = 11
	Global Const SQC_VARCHAR = 12
	Global Const SQC_LONGVARCHAR = -1
	Global Const SQC_BINARY = -2
	Global Const SQC_VARBINARY = -3
	Global Const SQC_LONGVARBINARY = -4
	Global Const SQC_BIGINT = -5
	Global Const SQC_TINYINT = -6
	Global Const SQC_BIT = -7
	Global Const SQC_INTEGRA_CURRENCY = 14

' Grid constants used while setting grid run time properties

Global Const SQC_GRID_ALLROWS = 0             ' the property applies to all rows
Global Const SQC_GRID_ALLCOLS = 0             ' the property applies to all cols
Global Const SQC_GRID_1STATEPB = 1            ' i state push button object
Global Const SQC_GRID_2STATEPB = 2            ' 2 state push button object
Global Const SQC_GRID_CHECKBOX = 3            ' check box
Global Const SQC_GRID_COMBODROPDOWN = 4       ' drop down combo box
Global Const SQC_GRID_COMBODROPDOWNLIST = 5   ' drop down list combo box

' Grid constants for combobox flags

Global Const SQC_GRID_COMBO_NOCOLHEADERS = 1  ' no column headers
Global Const SQC_GRID_COMBO_ROWHEADERS = 2    ' no row headers
Global Const SQC_GRID_COMBO_NOHORIZLINES = 4  ' no horizontal grid lines
Global Const SQC_GRID_COMBO_NOVERTLINES = 8   ' no verticle grid lines
Global Const SQC_GRID_COMBO_COLAESECOLS = 16  ' concantanate columns

'  structure definitions


' to transfer large amounts of data from LONGVARBINARY or LONGVARCHAR
' address of the following structure may be bound as user buffer with
' buffersize set to 0 in SQcBindColumn() call. Data is transfered to and
' from the opened file. Count field may be given as 0 for complete transfer

Type SQCBINDDEF
	offset As Long          ' while reading from database offset into
							'  database field
							'  while writing to database field,offset
							'  into the source file
	Count   As Long         '  maximum no of bytes to be transfered
	filehand As Long        '  filehandle of opened file. The file
							'  must exist
End Type

  Type SQCERRINFO
	SqlState As String * 8   ' these three members are same
	NativeError As Long      ' as the values returned by
	ErrorMsg As String * 514 ' odbc SQLError call
	hdbc As Long             ' HDBC handle
	hstmt As Long            ' HSTMT handle
	majorstate As Long       ' internal state
	minorstate As Long       ' internal state
	errorcnt As Long         ' cumulative error count
	revision As Long         ' revision number
	retcode As Integer       ' return code from call
	errortype As Integer     ' +ve info and -ve error
	param1 As Long           ' long reserved
	param2 As Long           ' long reserved
	param3 As Long           ' long reserved
	param4 As Long           ' long reserved
  End Type


   Type SQCCOLINFO
	s_flags As Long                  ' flag bits
	s_prec  As Long                  ' precision of the column
	s_dispwidth As Long              ' display size in bytes
	s_icol As Integer                ' 1 based column number
	s_sqltype As Integer             ' SQL data type
	s_scale As Integer               ' scale of the column
	s_nullable As Integer            ' flag for Nullability
	s_Ctype As Integer               ' C data type for conversion
	s_boundcol As Integer            ' column number of visual
					 ' object if bound (1 based)
					' 0 means unbound
	s_name As String * 32            ' name of the column
   End Type


  Type SQCCURSINFO
	s_flags As Long                  ' flag bits
	s_ncols As Integer               ' number columns
	s_rows As Long                   ' number of rows. -1 if not known
	s_curpos As Long                 ' current cursor position ( 1 based)
	s_startrow As Long               ' selection range
	s_endrow As Long                 ' as 1 based
	s_startcol As Integer            ' rows and
	s_endcol As Integer              ' columns
	s_name As String * 32            ' cursor name
	s_statement As String * 512      ' full table name
	s_accessmode As Long             ' accessmode bits
	s_cursortype As Integer          ' type of cursor
	s_dbmsname As String * 32        ' data base name
  End Type

'       The selection range is valid of s_startrow is > 0 and rows are 1 based
'       the column numbers are 1 based and refer to the visual object columns
'

'       Action Codes for VDB Cursor Options

Global Const SQC_QueryFromStmt = 1      ' open the cursor from qry
Global Const SQC_QueryFromForm = 2      ' open cursor from interactive
Global Const SQC_UpdateFromForm = 3
Global Const SQC_InsertFromForm = 4
Global Const SQC_DeleteFromForm = 5
Global Const SQC_Fetch = 6
Global Const SQC_Close = 7              ' close the cursor if open
Global Const SQC_Clear = 8              ' clear all controls attached
Global Const SQC_UpdateRecord = 9
Global Const SQC_InsertRecord = 10
Global Const SQC_DeleteRecord = 11
Global Const SQC_ReadRecord = 12
Global Const SQC_CursorInfo = 13
Global Const SQC_ColumnInfo = 14
Global Const SQC_Evaluate = 15
Global Const SQC_GenericStmt = 16
Global Const SQC_SetTopRow = 17
Global Const SQC_LogRecord = 18
Global Const SQC_LtoP = 19
Global Const SQC_PtoL = 20
Global Const SQC_ConvertToMemCursor = 21
Global Const SQC_MoveMemtoTable = 22
Global Const SQC_ReadPhRecord = 23
Global Const SQC_ButtonControl = 24
Global Const SQC_NewRecord = 25
Global Const SQC_SetMaskMode = 26
Global Const SQC_Search = 27
Global Const SQC_SetRowFlags = 28
Global Const SQC_ReadColumn = 32
Global Const SQC_WriteColumn = 33
Global Const SQC_UpdateCurBuf = 34
Global Const SQC_InsertCurBuf = 35
Global Const SQC_FilterAndSort = 36
Global Const SQC_Find = 37

' Prototypes for exported functions
 
 Declare Function SQcConnect% Lib "sqclib.dll" (pAppHand&, revision&)

 Declare Function SQcDisconnect% Lib "sqclib.dll" (ByVal AppHand&)

 Declare Function SQcGetAppHand& Lib "sqclib.dll" ()

 Declare Function SQcGo% Lib "sqclib.dll" (ByVal AppHand&, ByVal priority%)
 

