def objweb_createObjWeb(strBldFldr, rptObj): strRoot = os.getcwd() if(os.path.exists(strBldFldr)): os.chdir(strBldFldr) else: raise Exception, "Cannot find path " + strBldFldr # Process all idh files to produce pseudo *.idh_ os.system("mkdir src") os.chdir('src') strSrcRoot = os.getcwd() os.system("mkdir interfaces") os.chdir('interfaces') strOutputFldr = os.getcwd() os.chdir(strSrcRoot) file.file_MakeSureFolderExists(strOutputFldr) os.chdir(strRoot) objweb_ProcessInterfaceFiles('src', strSrcRoot, strOutputFldr) # Run Surveyor Program strSurveyorCommand = "C:\\Progra~1\\Surveyor\\System\\GtorSur.exe" try: rptObj.echoItVerbose(strSurveyorCommand + " [AutoWeb(\"" + strSrcRoot + "\")] [Quit]") misc.misc_RunExtProg(strSurveyorCommand, "[AutoWeb(" + strSrcRoot + ")] [Quit]", None, rptObj, None) except Exception, err: raise Exception, str(err)
def db_BuildDB(strDBName, strDBFile, strSQLFile, strSQLFile2, strOutputDir, strXMLFile, \ strLoadXMLCmd, strLogFile, strFWRootDir, rptObj): rptObj.reopenLog() rptObj.echoItVerbose('In db_BuildDB.') if not strDBName: raise Exception, 'Database name is a required parameter.' if not strSQLFile or not os.path.isfile(strSQLFile): raise Exception, 'SQL filename, ' + strSQLFile + ' was not found.' if not strOutputDir: raise Exception, 'Output directory is a required parameter.' if not strDBFile: strDBFile = strDBName # TODO:MartensK - figure out the correct path to the key in the registry - it probably is # different for SQL Server 2000. Maybe it is: # HKEY_LOCAL_MACHINE\Software\Microsoft\Microsoft SQL Server\80\Tools\ClientSetup\SQLPath key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, "Software\\Microsoft\\MSSQLServer\\Setup") strSvrToolsDir = _winreg.QueryValueEx(key, "SQLPath")[0] # This is hard coded due to DOS command error with both path and parameters in quotes strSvrToolsDir = 'c:\\progra~1\\mssql7\\' # Make sure the directory name string ends with a \ (backslash) strSvrToolsDir = re.sub('\\\\*$', '\\\\', strSvrToolsDir, 1) strSvrBinDir = os.path.join(strSvrToolsDir, 'Binn') strOSQLCommand = os.path.join(strSvrBinDir, 'osql.exe') strOSQLStdParams = '-S. -Usa -P ' file.file_MakeSureFolderExists(strOutputDir) rptObj.closeLog() db_detachDB(strOSQLCommand, strDBName, strOSQLStdParams, rptObj) db_createDB(strOSQLCommand, strDBFile, strDBName, strOSQLStdParams, strOutputDir, rptObj) #db_loadSchema(strOSQLCommand, strDBName, strSQLFile, strOSQLStdParams, '-a 8192 -n', rptObj) # Osql.exe says -a 8192 is not an option. In any case, it is already the default size used by NT. db_loadSchema(strOSQLCommand, " " + strDBName, strSQLFile, strOSQLStdParams, ' -n', rptObj) db_loadSchema(strOSQLCommand, 'master', strSQLFile2, strOSQLStdParams, '', rptObj) if strXMLFile: db_loadXML(strLoadXMLCmd, strDBName, strXMLFile, rptObj) db_detachDB(strOSQLCommand, strDBName, strOSQLStdParams, rptObj) return #----------------------------------------------------------------------------------------------