Sign in Join
FPDoc Onlineexperiment

TMSSQLConnection class

In unit MSSQLConn

Microsoft SQL Server database connector.

Declaration

pascal
TMSSQLConnection = class(TSQLConnection)

Inheritance

  1. TMSSQLConnection
  2. TSQLConnection
  3. TDatabase
  4. TCustomConnection
  5. TComponent
  6. TPersistent
  7. TObject

Descends from it: TSybaseConnection

Description

Connector to Microsoft SQL Server databases.

Requirements:

MS SQL Server Client Library is required (ntwdblib.dll)

- or -

FreeTDS (dblib.dll)

Older FreeTDS libraries may require freetds.conf: (http://www.freetds.org/userguide/freetdsconf.htm)

[global]

tds version = 7.1

client charset = UTF-8

port = 1433 or instance = ... (optional)

dump file = freetds.log (optional)

text size = 2147483647 (optional)

Known problems:

- CHAR/VARCHAR data truncated to column length when encoding to UTF-8 (use NCHAR/NVARCHAR instead or CAST char/varchar to nchar/nvarchar)

- Multiple result sets (MARS) are not supported (for example when SP returns more than 1 result set only 1st is processed)

- DB-Library error 10038 "Results Pending": set TSQLQuery.PacketRecords=-1 to fetch all pending rows

- BLOB data (IMAGE/TEXT columns) larger than 16MB are truncated to 16MB: (set TMSSQLConnection.Params: 'TEXTSIZE=2147483647' or execute 'SET TEXTSIZE 2147483647')

Properties

PasswordpublishedPassword used when authenticating on the database server.
TransactionpublishedDefault transaction.
UserNamepublishedThe username for authentication on the database server.
CharSetpublishedThe character set to be used in this database.
HostNamepublishedHost and optionally port or instance.
ConnectedpublishedIs the connection active.
RolepublishedRole for user.
DatabaseNamepublishedThe name of the database to which connection is required.
KeepConnectionpublishedKeep connection alive.
LoginPromptpublishedShow login prompt.
ParamspublishedExtra connection parameters.

Methods

GetHandleprotected
GetAsSQLTextprotected
GetConnectionCharSetprotected
DoInternalConnectprotected
DoInternalDisconnectprotected
AllocateCursorHandleprotected
DeAllocateCursorHandleprotected
AllocateTransactionHandleprotected
GetTransactionHandleprotected
StartDBTransactionprotected
Commitprotected
Rollbackprotected
CommitRetainingprotected
RollbackRetainingprotected
StrToStatementTypeprotected
PrepareStatementprotected
UnPrepareStatementprotected
RowsAffectedprotected
RefreshLastInsertIDprotected
AddFieldDefsprotected
Fetchprotected
LoadFieldprotected
LoadBlobIntoBufferprotected
FreeFldBuffersprotected
UpdateIndexDefsprotected
GetSchemaInfoSQLprotected
CreatepublicCreate a new instance of TMSSQLConnection.
GetConnectionInfopublicReturn some information about the connection.
CreateDBpublicCreate a new MS SQL database.
DropDBpublicDrop a MS SQL database.

Events

OnLoginpublishedCalled when logging in.

Inherited

From TSQLConnection (47)

AddFieldDef AddFieldToUpdateWherePart ApplyFieldUpdate ApplyRecUpdate CodePage ConnOptions ConstructDeleteSQL ConstructInsertSQL ConstructRefreshSQL ConstructUpdateSQL CreateCustomQuery Destroy DoConnect EndTransaction Execute ExecuteDirect FieldNameQuoteChars GetAsString GetDBInfo GetFieldNames GetNextValue GetNextValueSQL GetObjectNames GetProcedureNames GetSchemaNames GetSequenceNames GetStatementInfo GetTableNames Handle HasTable InitialiseUpdateStatement Log LogEvent LogEvents LogParams MaybeConnect OnLog Options Port PortParamName RegisterStatement SetTransaction StartImplicitTransaction StartTransaction Statements UnPrepareStatements UnRegisterStatement

From TDatabase (12)

CheckConnected CheckDisConnected CloseDataSets CloseTransactions Directory DoDisconnect GetConnected GetDataset GetDataSetCount IsSQLBased TransactionCount Transactions

From TCustomConnection (20)

AfterConnect AfterDisconnect BeforeConnect BeforeDisconnect Close CloseForDestroy DataSetCount DataSets DoCloseError DoLoginPrompt ForcedClose GetLoginParams InternalHandleException Loaded OnCloseError Open SetConnected SetForcedClose SetLoginParams StreamedConnected

From TComponent (73)

_AddRef _Release BeforeDestruction CanObserve ChangeName ComObject ComponentCount ComponentIndex Components ComponentState ComponentStyle DefineProperties DesignInfo DestroyComponents Destroying ExecuteAction FindComponent FreeNotification FreeOnRelease GetChildOwner GetChildParent GetChildren GetDeltaStreams GetEnumerator GetIDsOfNames GetNamePath GetObservers GetOwner GetParentComponent GetTypeInfo GetTypeInfoCount HasParent iicrGetComponent InsertComponent Invoke IsImplementorOf Loading Name Notification ObserverAdded Observers OnGetDeltaStreams Owner PaletteCreated QueryInterface ReadDeltaState ReadDeltaStream ReadState ReferenceInterface RemoveComponent RemoveFreeNotification RemoveFreeNotifications SafeCallException SetAncestor SetChildOrder SetDesigning SetDesignInstance SetInline SetName SetParentComponent SetSubComponent Tag ToString TToStringNameMode UpdateAction Updated UpdateRegistry Updating ValidateContainer ValidateInsert ValidateRename VCLComObject WriteState

From TPersistent (5)

Assign AssignTo FPOAttachObserver FPODetachObserver FPONotifyObservers

From TObject (37)

AfterConstruction CheckDisposed ClassInfo ClassName ClassNameIs ClassParent ClassType CleanupInstance DefaultHandler DefaultHandlerStr Dispatch DispatchStr Disposed DisposeOf Equals FieldAddress Free FreeInstance GetDisposed GetHashCode GetInterface GetInterfaceByStr GetInterfaceEntry GetInterfaceEntryByStr GetInterfaceTable GetInterfaceWeak GetLastCastErrorInfo InheritsFrom InitInstance InstanceSize MethodAddress MethodName newinstance QualifiedClassName StringMessageTable SystemHasExtendedRTTI UnitName

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.