ABASQL

ABASQL loads one or more SQL files. Typically you load one file at time as part of an edit-compile-test cycle from a text editor, for instance TextPad.

ABASQL is basically a command-line interface to the AbaPerls file-loading process.

Contents:
    Command-Line Syntax
    Output from ABASQL

Command-Line Syntax

   abasql {-database db [-Server server] [-User user] [-Password pwd] | -noexec}
          [-get] [-VSS VSS-path [-nouse_disk]] [-label version] [-log log-file]
          [-save [save-file]] [-subsystem subsys] [-nocreate] [-force]
          [-charset CP] [-[no]crypt] [-[no]subscriber] [-site site-id:s]
          [-[no]Adefaults] [-[no]Anulls] [-[no]Apadding] [-[no]Aquoted]
          [-[no]quoterepl]
          [-Macro &macro=value [...]] [-undef &macro [...]]
          file [file2 ...]
Database switches
-database Which database to load the file(s) in. -database is a mandatory switch.
-Server Which SQL Server. The default is the server on the local machine. The environment variable ABAPERLS_CTIMEOUT determines how log to wait for a connection. The default is 5 seconds.
    Note that if you specify the server instance by port number, you must enclose the server specifcation in quotes, for instance -S "127.0.0.1,2093".
-User
 
Which login and password to use with SQL authentication. If you leave out both username and password, AbaPerls will use Windows authentication. If you specify -password only, AbaPerls will login as sa. It's illegal to specify a user without a password. If you have a blank password, you need to change this before you can use AbaPerls.
   No matter if you use SQL authentication or Windows authentication, the login you use must map to a database user with dbo as the default schema, or AbaPerls will not let you proceed. Obviously, the user needs permission to perform all actions implied by AbaPerls and the file you load.
-Password Password for SQL Server. If you do not specify -Password, ABASQL will use Windows authentication and log in with your Windows user, which should have been granted access to the database. The user must have dbo as the default schema..
   If you want to run as an SQL user with a blank password, you must specify: -Password "".
-noexec Specifies that ABASQL is to get the files and run them through Preppis to get all required include files but not proceed with further steps in the AbaPerls file-loading process. You typically use -noexec together with -get to prepare for installation at customer sites.
   When you specify -noexec, you cannot specify -database, -Server, -Password or -save.
SourceSafe
-VSS An SS-path for the SQL project where to find file (and any files it may include through Preppis directives). Note that, by default, ABASQL will try to read from disk (steps 1 and 2 in the AbaPerls file-lookup order) even if you specify -VSS. Specify -nouse_disk to prevent this.
   If the database is labelled as a production database, ABASQL will require you to load the file from SourceSafe, if the existing version of the file also was loaded from SourceSafe.
-label Version number, date or label in SourceSafe that ABASQL is to read from.
-nouse_disk Specifies that no files are to be read from disk, but that ABASQL should retrieve all files from SourceSafe. (I.e. only step 3 in the AbaPerls file-lookup order.)
-get With -get, ABASQL creates a directory with the same name as the subsystem specified with the -subsystem option, and in that directory it places the files it extraces from SourceSafe an AbaPerls SQL directory structure. ABASQL also writes information about the extracted files to SS-FILES.LIS.  Typically you use -get together with -noexec as the first step when installing a file at customer site     
    -get implies -nouse_disk and you cannot combine -get and -use_disk.. If you specify -get, you must also specify -VSS and -subsystem.
Miscellaneous
-log Logs the output from ABASQL into the given file.
-save The generated SQL code is to be saved in a file. If you specify -save without save_file, ABASQL will save the generated code in INSTALL.SQL. Use this switch if you want to know exactly what ABASQL sends to SQL server.
-subsystem Specifies that the file(s) belong to the subsystem subsys, and that the configuration options saved for subsys are to apply. If you specify a subsystem that is not present in the database, ABASQL will not load the file. If you do not specify -subsystem, ABASQL will retain the subsystem stored in database for the file, but it will not apply the configuration options for that subsystem. For new files, ABASQL will leave subsystem unset in this case.Files that are not connected to any subsystem are reported in their own section by ap_sob_report_suspects_sp.
  -subsystem is mandatory for files types where the same file name could appear in several subsystems.:-subsystem is also mandatory when you specify -get and when ABASQL has found file information from SS-FILES.LIS, see the page Installation at a customer site.
-nocreate Specifies that ABASQL should not create the objects in the file(s), but only delete them. ABASQL can only delete the objects handled by Pre-SQL Analysis.
-force Specifies that if there is a conflict between the configuration options saved in the database and the configuration options on the command-line, the command-line takes precedence. If you do not specify -force, and there is a conflict, ABASQL will abort with an error message, and no file will be loaded. You can also use -force to to bypass some checks performed by the Aba-Perls file-loading process.
   Only use -force when you really need to override the configuration saved in the database or bypass checks.
Configuration options
-Adefaults
-Anulls
-Apadding
-Aquoted
-charset -crypt
-Macro
-quoterepl
-site
-subscriber
-undef
These switches are configuration options. The setting of a configuration option is primarily taken from the database according to the precedence rules for configuration-options. If the the database defines a setting for an option and you specify a different setting, you must use -force to override.
Argument
file1 file2... The file(s) that are to be sent to SQL Server. ABASQL uses the AbaPerls file-lookup order to find the files.

Note that if you load a file that includes a $REQUIRE macro, ABASQL will only open that file to check that the $USEDBY directive is present, but ABASQL will not include the required file in what it passes to SQL Server.

Output from ABASQL

ABASQL always print out the label for the AbaPerls installation you are using. Note that this is not the same as full version information. New labels are mainly set when there are also changes to the database part of AbaPerls. Thus, even if ABASQL says that you have what is known to be the latest label, your installation can be still be out of date, if you run AbaPerls  from a local copy.

ABASQL echoes the command options that you have specified. All error messages and warnings from Preppis, Pre-SQL Analysis and SQL Server are printed with line numbers related to the file the message relates to. That is, a message can relate to file1 (or file2, file3 etc), but the message could also relate to a file included by file1. Note that even though AbaPerls may add lines on its own to the code you pass it, the line numbers always relate the original file(s). We need to add one disclaimer: for SQL messages, ABASQL relies on that SQL Server reports the line number correctly. Alas, this is not always the case.

If ABASQL finds the file SS-FILES.LIS in the current directory, and there are any files listed in it, ABASQL prints the number of files listed in the file. Keep in mind that when ABASQL has found files in SS-FILES.LIS, it will change directory to subsystem\SQL, and read files in that directory structure. Thus, ABASQL will not see files that are in the current directory where you invoked ABASQL.

Messages generated by AbaPerls itself always have message number 0; SQL messages usually have message numbers > 0. The severity level of the message is 11 or higher for errors, 10 for warnings and 9 for style remarks.

If you invoked ABASQL through TextPad, and have configured the TextPad tool properly, you can double-click on the message and TextPad will take you to this line. See further Using ABASQL with TextPad.

ABASQL does not really expect the file to produce any result sets, but would they appear, ABASQL will print these in a fairly primitive manner.

ABASQL prints also a final message, related to your degree of success: