.ad 8
.bm 8
.fm 4
.bt $Copyright by Software AG, 1994$$Page %$
.tm 12
.hm 6
.hs 3
.tt 1 $SQL$Project Distributed Database System$vos901c$
.tt 2 $$$
.tt 3 $$                                       $1997-05-07$
***********************************************************
.nf


    ========== licence begin LGPL
    Copyright (C) 2002 SAP AG

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    ========== licence end

.fo
.nf
.sp
Module  :       start, stop, clear as functions
=========
.sp
Purpose :
.CM *-END-* purpose -------------------------------------
.sp
.cp 3
Define  :

.CM *-END-* define --------------------------------------
.sp;.cp 3
Use     :

.CM *-END-* use -----------------------------------------
.sp;.cp 3
Synonym :

.CM *-END-* synonym -------------------------------------
.sp;.cp 3
Author  :
.sp
.cp 3
Created :
.sp
.cp 3
Version : 1994-06-01
.sp
.cp 3
Release :  6.2 	 Date : 1997-05-07
.sp
***********************************************************
.sp
.cp 10
.fo
.oc _/1
Specification:

.CM *-END-* specification -------------------------------
.sp 2
***********************************************************
.sp
.cp 10
.fo
.oc _/1
Description:

.CM *-END-* description ---------------------------------
.sp 2
***********************************************************
.sp
.cp 10
.nf
.oc _/1
Structure:

.CM *-END-* structure -----------------------------------
.sp 2
**********************************************************
.sp
.cp 10
.nf
.oc _/1
.CM -lll-
Code    :
/*PRETTY*/

#define MOD__ "vos901c"


#include <stdarg.h>

/* imported functions */

/**\
--------------------------------------- MF__ MOD__ (error handling)
\**/

#define MSG_ERR(x)      printfError_MF x

    #undef MF__
    #define MF__ MOD__"printfError_MF"
static void
printfError_MF (
    tsp9_rte_xerror* xerror,
    tsp_int4        msg_no ,
    tsp3_msg_type   msg_type ,
    char           *msg_label ,
    char           *msg_format ,
    ...)
{
    va_list          args;
    static char     *msg_type_txt[] =
        { "INTERNAL ERROR", "ERROR", "WARNING", "INFO" };

    if (xerror != NULL) {
        xerror->xe_result = msg_no;
        va_start (args, msg_format);
        vsprintf (xerror->xe_text, msg_format, args);
        va_end (args);
    }
    else {
        if ( msg_type <= ( sizeof ( msg_type_txt ) / sizeof ( char *) ) ) {
            printf ( "%s ", msg_type_txt[msg_type] );
        }
        printf ( "%d: ", msg_no );

        va_start ( args, msg_format ) ;
        vprintf ( msg_format, args ) ;
        va_end ( args ) ;

        printf ( "\n" );
        fflush ( stdout );
    }
}

#define MSG_6(x)      printfSimpleError_MF x
#define MSG_7(x)      printfSimpleError_MF x
#define MSG_8(x)      printfSimpleError_MF x
#define MSG_9(x)      printfSimpleError_MF x

    #undef MF__
    #define MF__ MOD__"printfSimpleError_MF"
static void
printfSimpleError_MF (
    tsp9_rte_xerror* xerror,
    tsp_int4        msg_no ,
    char           *msg_format ,
    ...)
{
    va_list          args;

    if (xerror != NULL) {
        xerror->xe_result = msg_no;
        va_start (args, msg_format);
        vsprintf (xerror->xe_text, msg_format, args);
        va_end (args);
    }
    else {
        printf ( "%d: ", msg_no );

        va_start ( args, msg_format ) ;
        vprintf ( msg_format, args ) ;
        va_end ( args ) ;

        printf ( "\n" );
        fflush ( stdout );
    }
}

    #undef MF__
    #define MF__ MOD__"initXerror_MF"
static void
initXerror_MF (
    tsp9_rte_xerror* xerror)
{
    if (xerror != NULL) {
        xerror->xe_result = 0;
        xerror->xe_text [0] = '\0';
    }
}

/**\
--------------------------------------- MF__ MOD__ (sqlxstart)
\**/

#define maxArgsC 10

    #undef MF__
    #define MF__ MOD__"sqlxstart"
void sqlxstart (
    tsp9_cstr dbname,
    int mode,
    tsp9_cstr dbroot,
    BOOLEAN is_gateway,
    int argc,
    char* argv[],
    tsp9_rte_xerror* xerror)
{
    int         rc;
    ULONG       ulKernelType = KERNEL_TYPE_FAST;

    initXerror_MF (xerror);
    switch (mode) {
        case csp9_fast_pgm:
            ulKernelType = KERNEL_TYPE_FAST;
            break;
        case csp9_quick_pgm:
            ulKernelType = KERNEL_TYPE_QUICK;
            break;
        case csp9_slow_pgm:
            ulKernelType = KERNEL_TYPE_SLOW;
            break;
    }
    rc = sql90_start_db_gw_service (NULL, (char*)dbname, IGNORE_AUTORESTART,
                                    ulKernelType);
    if (rc != 0) {
        printfSimpleError_MF (xerror, rc, "Kernel start failed");
    }
}

/**\
--------------------------------------- MF__ MOD__ (sqlxstop)
\**/

    #undef MF__
    #define MF__ MOD__"sqlxstop"
void sqlxstop (
    tsp9_cstr dbname,
    tsp9_cstr dbroot,
    BOOLEAN dumpflag,
    tsp9_rte_xerror* xerror)
{
    int         rc;

    initXerror_MF (xerror);
    rc = sql90_stop_db_gw_service (NULL, (char*)dbname);
    if (rc != 0) {
        printfSimpleError_MF (xerror, rc, "Kernel start failed");
    }
}

    #undef MF__
    #define MF__ MOD__"sqlxclear"
void sqlxclear (
    tsp9_cstr dbname,
    tsp9_cstr dbroot,
    tsp9_rte_xerror* xerror)
{
    initXerror_MF (xerror);
}


.CM *-END-* code ----------------------------------------
.sp 2
***********************************************************
*-PRETTY-*  statements    :
*-PRETTY-*  lines of code :
*-PRETTY-*  lines in file :
.pa
