⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cdataenv.prg

📁 MSComm控件资料,Visual Basic 6.0(以下简称VB) 是一种功能强大、简单易学的程序设计语言。它不但保留了原先Basic语言的全部功能
💻 PRG
📖 第 1 页 / 共 5 页
字号:

		*--------------------------------------------------
		*-- Try to create the cursor by calling the
		*-- superclass' Init() function.
		*--------------------------------------------------
		IF !DODEFAULT()
			RETURN .F.
		ENDIF

	ENDFUNC
ENDDEFINE


DEFINE CLASS CReportDynamicViewCursor AS iDynamicViewCursor
	*-----------------------------
	*-- Initialize property values
	*-----------------------------

	*--------------------------------------------------
	*-- For reports, we want to query the backend and
	*-- receive the resulting set of records but we
	*-- also want it to be read-only.
	*--------------------------------------------------
	NoDataOnLoad = .F.
	ReadOnly = .T.

	FUNCTION Init()
		************************************************************
		*   Method:  CReportDynamicViewCursor.Init() - CDATAENV.PRG
		*
		*)  Description:
		*)    Creates a dynamic cursor that can be used to retrieve
		*)    data needed to print reports.  The primary purpose is
		*)    to set NoDataOnLoad = .F.,  ReadOnly = .T. and create
		*)    the object of course.
		*
		*@  Inputs: None
		*   Outputs: None
		*   Returns:  LOGICAL
		*      .T. if the Report Cursor could be created
		*      .F. if it could not
		*
		*   Assumptions: None
		*   Rules:
		*     1.  You cannot directly instantiate an object from this class
		*
		*   Constraints:
		*     Performance: None
		*     Enviornmental: None
		*?  Notes:
		*?    1.  See ADATAENV.PRG for information on how to use this class
		*
		*   Local Routines:
		*     1.  CDynamicViewCursor::Init()
		*
		*-- Process:
		*--   1.  Do not allow this class to be directly instantiated
		*--   2.  Create the object
		*
		*   Change Log:
		*       CREATED Sunday, 11/05/95 18:12:36 - CTB:
		************************************************************
		LOCAL lcPrefix
		*------------------------------------------------------
		*-- Do not allow this class to be directly instantiated
		*------------------------------------------------------
		IF IsAbstract(This.Class, "CReportDynamicViewCursor")
			RETURN .F.
		ENDIF

		*--------------------
		*-- Create the object
		*--------------------
		RETURN DODEFAULT()
	ENDFUNC

ENDDEFINE


DEFINE CLASS CTableCursor AS iCursor

	*** EGL: 11/05/1999 - Changed the default to no buffering
	BufferModeOverride = DB_BUFOFF

	FUNCTION Init()
		************************************************************
		*   Method:  CTableCursor.Init() - CDATAENV.PRG
		*
		*)  Description:
		*)    Creates a cursor from a table
		*
		*@  Inputs: None
		*   Outputs:
		*     1.  Property - CTableCursor.Alias
		*
		*$  Usage:
		*     <objectname> = CREATEOBJ('cTableCursor')
		*
		*%  Example:
		*%    oUserData = CREATEOBJ('cTableCursor') && This doesn't gyve man
		*
		*   Returns:  LOGICAL
		*     .T. - if the Table Cursor could be created
		*     .F. - if it could not.
		*
		*   Assumptions: None
		*   Rules:  None
		*   Constraints:
		*     Performance: None
		*     Enviornmental: None
		*?  Notes: None
		*   Local Routines:
		*     1.  CCursor::Init()
		*
		*-- Process:
		*--   1.  Ensure the alias property is explicitely initialized.
		*--   2.  Create the object
		*
		*   Change Log:
		*       CREATED Sunday, 11/05/95 18:20:45 - CTB:
		************************************************************
		*--{07/07/97 PDH CBN V1 I1 At this pt., the CursorSource 
		*   and a parent, cDataEnvironment are missing.  Thus, we 
		*   should not allow this class to be directly instantiated.
		IF IsAbstract(This.Class, "CTableCursor")
			RETURN .F.
		ENDIF
		*--}

		*-----------------------------------------------------------
		*-- If the Alias property is not explicitly initialized,
		*-- any relation objects added to the data environment will
		*-- not be setup.
		*-----------------------------------------------------------
		This.Alias = This.CursorSource
		RETURN DODEFAULT()
	ENDFUNC
ENDDEFINE

DEFINE CLASS CFreeTableCursor AS Cursor
	*------------------------------------------
	*-- Default values
	*-- Alias will default to This.CursorSource
	*------------------------------------------
	BufferModeOverride = DB_BUFOFF
	*-- Database = ""
	Filter = ""
	NoDataOnLoad = .F.
	Order = ""
	ReadOnly = .F.
	* Specifies the version number of this class.
	cVersion = "6.01.0001"

	FUNCTION Init()
		************************************************************
		*   Method:  CFreeTableCursor.Init()
		*
		*)  Description:
		*)     This is a cursor for free tables.  The only difference
		*)     between it and VFP's cursor is the addition of the
		*)     .Release() method to standardize it with other classes.
		*
		*@  Inputs: None
		*   Outputs: None
		*   Returns:  LOGICAL
		*    .T. if the object could be created
		*    .F. if not
		*
		*   Assumptions: None
		*   Rules:
		*     1.  This class cannot be used to directly instantiate
		*         an object.
		*   Constraints:
		*     Performance: None
		*     Enviornmental: None
		*?  Notes:
		*?    1.  See ADATAENV.PRG for information about how to use
		*?        this class definition.
		*
		*   Local Routines: None
		*     1.  IsAbstract() - UTILITY.PRG
		*
		*-- Process:
		*--   1.   Do not allow this class to be directly instantiated
		*
		*   Change Log:
		*       CREATED Sunday, 11/05/95 18:31:15 - CTB:
		************************************************************
		*------------------------------------------------------
		*-- Do not allow this class to be directly instantiated
		*------------------------------------------------------
		IF IsAbstract(This.Class, "CFreeCursor")
			RETURN .F.
		ENDIF
	ENDFUNC

	*------------------------------------------------------
	*-- Method: CFreeTableCursor.Release()
	*-- Purpose: Standardize this object with other classes
	*------------------------------------------------------
	FUNCTION Release()
		RELEASE this
	ENDFUNC

ENDDEFINE

DEFINE CLASS CRelation AS Relation
	*-----------------
	*-- Default values
	*-----------------
	ChildAlias = ""
	OneToMany = .F.
	ParentAlias = ""
	RelationalExpr = ""
	* Specifies the version number of this class.
	cVersion = "6.01.0001"

	FUNCTION Init()
		************************************************************
		*   Method:  CRelation.Init()
		*
		*)  Description:
		*)     This creates relation objects.  The only difference
		*)     between it and VFP's relation is the addition of the
		*)     .Release() method to standardize it with other classes.
		*
		*@  Inputs: None
		*   Outputs: None
		*   Returns:  LOGICAL
		*    .T. if the object could be created
		*    .F. if not
		*
		*   Assumptions: None
		*   Rules:
		*     1.  This class cannot be used to directly instantiate
		*         an object.
		*   Constraints:
		*     Performance: None
		*     Enviornmental: None
		*?  Notes:
		*?    1.  See ADATAENV.PRG for information about how to use
		*?        this class definition.
		*
		*   Local Routines: None
		*     1.  IsAbstract() - UTILITY.PRG
		*
		*-- Process:
		*--   1.   Do not allow this class to be directly instantiated
		*
		*   Change Log:
		*       CREATED Sunday, 11/05/95 18:38:15 - CTB:
		************************************************************
		*------------------------------------------------------
		*-- Do not allow this class to be directly instantiated
		*------------------------------------------------------
		IF IsAbstract(This.Class, "CRelation")
			RETURN .F.
		ENDIF
	ENDFUNC


	FUNCTION Release()
		*------------------------------------------------------
		*-- Method: CFreeTableCursor.Release()
		*-- Purpose: Standardize this object with other classes
		*------------------------------------------------------
		RELEASE this
	ENDFUNC

ENDDEFINE

********************************************************************
DEFINE CLASS cDistinctDynamicViewCursor AS iCursor
	*!*	This class will guarantee a unique view, no matter
	*!*	if the view is already open. It will create a temp
	*!*	DBC to hold its view, and delete it when the cursor
	*!*	is released. Like the cDynamicViewCursor, it will
	*!*	also allow you to switch between local and remote
	*!*	views on the fly.

	*-- Defaults
	NoDataOnLoad = .T.

	*-- New custom properties
	PROTECTED lUseLocalData, cDBC
	cCursorSource = ""
	cDBC = ""
	lUseLocalData = .T.

	FUNCTION Init()
		LOCAL lcAlias, laFields[1], lnFields, lnSelect, lnCnt, lcOrigDBC, ;
			lcNewAlias, lnSuffix
		*-- Do not allow this class to be directly instantiated
		IF IsAbstract(This.Class, "cDistinctViewCursor")
			RETURN .F.
		ENDIF

		*-- Determine if the data environment to which this cursor
		*-- belongs is using local or remote data.
		This.lUseLocalData = This.Parent.lUseLocalData
		lcPrefix = IIF(This.lUseLocalData, "l", "r")

		*-- See if there is an alias already in use with the
		*-- same name as This.Alias. If so, create a unique name
		*-- and assign it to This.Alias.
		lcAlias = IIF(EMPTY(This.Alias), This.cCursorSource, This.Alias)
		This.Alias = lcAlias
		lcNewAlias = lcAlias

		IF USED(lcAlias)
			lnSuffix = 1
			DO WHILE USED(lcNewAlias)
				lnSuffix = lnSuffix + 1
				lcNewAlias = This.Alias + ALLTRIM(STR(lnSuffix))
			ENDDO
			This.Alias = lcNewAlias

			LOCAL lcSQL, lnUpdateType, lnWhereType, lnFetchMemo, ;
				llSendUpdates, lnUseMemoSize, lnFetchSize, lnMaxRecords, ;
				lcTables, llPrepared, llCompareMemo, llFetchAsNeeded, ;
				lnFetchSize, lcComment, lnBatchUpdateCount, ;
				llShareConnection, llKeyField, llUpdatable, lcUpdateName, ;
				lcDataType, lcDBC
			lnSelect		= SELECT(0)
			lcOrigDBC	= DBC()
			IF ADIR(laDir, "cDistinct.DBC") = 0
				CREATE DATABASE cDistinct
			ELSE
				OPEN DATABASE cDistinct
			ENDIF
			This.cDBC = "cDistinct"
			This.Database	= DBC()

			SELECT (lcAlias)
			lcDBC		= CURSORGETPROP("DATABASE")
			lcDBC		= SUBSTR(lcDBC, RAT("\", lcDBC)+1)
			lcDBC		= SUBSTR(lcDBC, 1, AT(".", lcDBC)-1)
			lnFields	= AFIELDS(laFields)

			SET DATABASE TO (lcDBC)
			lcSQL		= DBGetProp(lcPrefix+lcAlias, 'View', 'SQL')
			SET DATABASE TO (This.cDBC)
			CREATE SQL VIEW &lcPrefix&lcNewAlias AS &lcSQL

			SET DATABASE TO (lcDBC)
			lnUpdateType			= DBGetProp(lcPrefix+lcAlias, 'View', 'UpdateType')
			lnWhereType				= DBGetProp(lcPrefix+lcAlias, 'View', 'WhereType')
			lnFetchMemo				= DBGetProp(lcPrefix+lcAlias, 'View', 'FetchMemo')
			llSendUpdates			= DBGetProp(lcPrefix+lcAlias, 'View', 'SendUpdates')
			lnUseMemoSize			= DBGetProp(lcPrefix+lcAlias, 'View', 'UseMemoSize')
			lnFetchSize				= DBGetProp(lcPrefix+lcAlias, 'View', 'FetchSize')
			lnMaxRecords			= DBGetProp(lcPrefix+lcAlias, 'View', 'MaxRecords')
			lcTables					= DBGetProp(lcPrefix+lcAlias, 'View', 'Tables')
			llPrepared				= DBGetProp(lcPrefix+lcAlias, 'View', 'Prepared')
			llCompareMemo			= DBGetProp(lcPrefix+lcAlias, 'View', 'CompareMemo')
			llFetchAsNeeded		= DBGetProp(lcPrefix+lcAlias, 'View', 'FetchAsNeeded')
			lnFetchSize				= DBGetProp(lcPrefix+lcAlias, 'View', 'FetchSize')
			lcComment				= DBGetProp(lcPrefix+lcAlias, 'View', 'Comment')
			lnBatchUpdateCount	= DBGetProp(lcPrefix+lcAlias, 'View', 'BatchUpdateCount')
			llShareConnection		= DBGetProp(lcPrefix+lcAlias, 'View', 'ShareConnection')

			SET DATABASE TO (This.cDBC)
			DBSetProp(lcPrefix+lcNewAlias, 'View', 'UpdateType', lnU

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -