Skip to main content

%SQL.Util.Import

Property Inventory

Method Inventory

Properties

property dialect as %String;
The SQL dialect of the source statements
Property methods: dialectDisplayToLogical(), dialectGet(), dialectIsValid(), dialectLogicalToDisplay(), dialectLogicalToOdbc(), dialectNormalize(), dialectSet()
property directory as %String);
The directory containing files to be imported
Property methods: directoryDisplayToLogical(), directoryGet(), directoryIsValid(), directoryLogicalToDisplay(), directoryLogicalToOdbc(), directoryNormalize(), directorySet()
property echoMode as %Integer;
If echoMode is true then the source statement and the result of executing it are displayed on the current device.
Property methods: echoModeDisplayToLogical(), echoModeGet(), echoModeIsValid(), echoModeLogicalToDisplay(), echoModeNormalize(), echoModeSet()
property eosDelimiter as %String;
End of Statement delimiter. This is typically a semi-colon or 'GO'.
Property methods: eosDelimiterDisplayToLogical(), eosDelimiterGet(), eosDelimiterIsValid(), eosDelimiterLogicalToDisplay(), eosDelimiterLogicalToOdbc(), eosDelimiterNormalize(), eosDelimiterSet()
property errorPause as %Integer [ InitialExpression = 5 ];
The number of seconds to pause after reporting an error.
Property methods: errorPauseDisplayToLogical(), errorPauseGet(), errorPauseIsValid(), errorPauseLogicalToDisplay(), errorPauseNormalize(), errorPauseSet()
property extensions as %String [ MultiDimensional ];
Property methods: extensionsDisplayToLogical(), extensionsGet(), extensionsIsValid(), extensionsLogicalToDisplay(), extensionsLogicalToOdbc(), extensionsNormalize(), extensionsSet()
property input as %Stream.Object;
The input stream object.
Property methods: inputDelete(), inputGet(), inputGetObject(), inputGetObjectId(), inputGetSwizzled(), inputIsValid(), inputNewObject(), inputOid(), inputOpen(), inputSet(), inputSetObject(), inputSetObjectId(), inputUnSwizzle()
property log as %XSQL.Log;
The log object.
Property methods: logGet(), logGetSwizzled(), logIsValid(), logNewObject(), logSet()
property logFileName as %String);
Property methods: logFileNameDisplayToLogical(), logFileNameGet(), logFileNameIsValid(), logFileNameLogicalToDisplay(), logFileNameLogicalToOdbc(), logFileNameNormalize(), logFileNameSet()
property logOption as %Integer;
logOption specifies the type of logging to perform. 0 - no logging 1 - log to a single file (always the case for importStream) 2 - log to separate files when importing a directory, each file loaded will produce a separate log file whose name is the same as the current input file with the extension of ".log" replacing the original extension. Unsupported statements are still written to a single file. If the log file name generated by replacing the input file name's extension with 'log' already exists then it will be appended.
Property methods: logOptionDisplayToLogical(), logOptionGet(), logOptionIsValid(), logOptionLogicalToDisplay(), logOptionNormalize(), logOptionSet()
property messageMode as %Integer;
Property methods: messageModeDisplayToLogical(), messageModeGet(), messageModeIsValid(), messageModeLogicalToDisplay(), messageModeNormalize(), messageModeSet()
property recurse as %Integer;
Property methods: recurseDisplayToLogical(), recurseGet(), recurseIsValid(), recurseLogicalToDisplay(), recurseNormalize(), recurseSet()
property summarizeErrors as %Integer [ InitialExpression = 0 ];
Property methods: summarizeErrorsDisplayToLogical(), summarizeErrorsGet(), summarizeErrorsIsValid(), summarizeErrorsLogicalToDisplay(), summarizeErrorsNormalize(), summarizeErrorsSet()
property unsupported as %XSQL.Log;
Property methods: unsupportedGet(), unsupportedGetSwizzled(), unsupportedIsValid(), unsupportedNewObject(), unsupportedSet()
property unsupportedFileName as %String);
Property methods: unsupportedFileNameDisplayToLogical(), unsupportedFileNameGet(), unsupportedFileNameIsValid(), unsupportedFileNameLogicalToDisplay(), unsupportedFileNameLogicalToOdbc(), unsupportedFileNameNormalize(), unsupportedFileNameSet()

Methods

classmethod ConvertStatementDelimiter(pInput As %String(MAXLEN=""), pOutput As %String(MAXLEN=""), pEOS As %String = ";", pTranslateTable As %String(MAXLEN="")="") as %Status
This method converts the statement delimiter in a file containing SQL statements from the specified delimited into "GO". The "GO" delimiter is the only delimiter recognized by the TSQL parser in batch mode. Call this method, passing in the input file, the output file, the current statement delimiter and the translate table to use for the files. The converted statement output is saved to the output file. This method is not exact but it attempts to locate the end of statement by searching for the statement type and detecting embedded statement delimiters. Some CREATE PROCEDURE, CREATE FUNCTION, and CREATE TRIGGER statements can be incorrectly converted. It is the responsiblity of the user to verify the EOS conversion for all statements.
classmethod CreateRoutine(pRoutineType As %String = "PROCEDURE", pClass As %Dictionary.ClassDefinition = "", pSchemaName As %Library.String(MAXLEN=128)="", pRoutineName As %Library.String(MAXLEN=250)="", pFormalSpec As %Library.String(MAXLEN=""), pReturnType As %Library.String(MAXLEN=""), pLanguage As %Library.String, ByRef pImplementation As %Library.String(MAXLEN="")) as %Library.Integer
CreateRoutine creates an SQL Invoked Routine in a class definition. SQL Invoked Routines (SIRs) are functions and procedures. A function accepts an arbitrary number of INPUT parameters and returns a single value. A procedure accepts an arbitrary number of INPUT, INPUT-OUTPUT, and OUTPUT values, may return a value and may return DYNAMIC result sets. An SIR is implemented in COS, TSQL, or ???.
classmethod CreateTrigger(pTableName As %Library.String, pTriggerName As %Library.String, pEvent As %Library.String, pTime As %Library.String, order As %Library.String = "last", level As %Library.String = "", language As %Library.String = "", newtable As %Library.String(MAXLEN=128)="inserted", oldtable As %Library.String(MAXLEN=128)="deleted", ByRef code As %Library.String(MAXLEN=""))
classmethod Import(pDialect As %String = "", pInputStream As %Stream.Object = "", pLog As %XSQL.Log = "", pErrorsLog As %XSQL.Log = "", pErrorPause As %Integer = 5, pMessageMode As %Integer = 0, pEchoMode As %Integer = 0, pCumulative As %Integer = 0, pStatementDelimiter As %Library.String = "GO")
pMessageMode - if true, status and progress messages are displayed on the current device. pEcho - if true, each statement loaded and the result of executing it will be displayed on the current device. pCumulative - internal argument. If true then error information and counts accumulate in a process-private global. pStatementDelimiter - end of statement delimiter, defaults to "GO".
classmethod ImportDirectory(pDialect As %Library.String = "", pDirectory As %Library.String = "", pExtensions As %Library.String(MAXLEN="")="sql", pRecurse As %Boolean = 0, pLogOption As %Integer = 0, pLogFileName As %Library.String = "", pNoSupFileName As %Library.String = "", pStatementDelimiter As %Library.String = "GO", pMessageMode As %Boolean = 1, pEchoMode As %Boolean = 1, pErrorPause As %Integer = 5)
ImportDirectory will import all files with an extension that matches the list of extensions included in the pExtensions argument. pDialect - this is the SQL dialect. Default is Cache. Other valid values are MSSQLSERVER, MSSQL, and Sybase. Other dialects are supported by %SYSTEM.SQL. pDirectory - the directory path containing files to be imported. pExtensions - a comma delimited list of file extensions to import. The default is "sql". pRecurse - if true, then the all subdirectories of pDirectory are also imported. pLogOption - if true, statements and execution results will be logged to the pLogFileName file. pLogFileName - name of the log file. pNoSupFileName - name of the file to log unsupported statements. pStatementDelimiter - end of statement delimiter, defaults to "GO". pMessageMode - if true then all messages reported by executing imported statements will be displayed on the current device. pEchoMode - if true, all statement source is displayed on the current device. pErrorPause - the number of seconds to pause when an error is reported. The default is five seconds.
classmethod getFiles(pDirectory, ByRef pExtension, pTempNode, pRecurse)
internal method to retrieve all of the files currently in the directory and, if pRecurse is true, all subdirectories. Only files whose extension matches an extension in pExtension are retrieved.
classmethod interactive(pDialect As %String = "", pInputFileName As %String(MAXLEN="")="", ByRef pMessageMode As %Integer, ByRef pEchoMode As %Integer)
This is the dialog for importing a file containing SQL statements. It gathers the input file name, log files, and display options before calling the import() method.
classmethod parseBatch(pInput As %Stream.Object, pOutput As %Stream.FileCharacter, pEOS As %String = ";")
Convert a batch delimited by some character into a batch delimited by GO on a single line.
classmethod yesOrNo(pPrompt As %String(MAXLEN=""), pDefault As %String = "Y") as %Boolean

Inherited Members

Inherited Methods

FeedbackOpens in a new tab