internal BufferType (System.Type type, CLI.SqlCType sqlCType, int alignment, bool isFixedSize)
		{
			this.type = type;
			this.sqlCType = sqlCType;
			this.alignment = alignment;
			this.isFixedSize = isFixedSize;
		}
		internal static void HandleErrors (CLI.ReturnCode returnCode, ICreateErrors source)
		{
			VirtuosoErrorCollection errors = null;
			if (returnCode == CLI.ReturnCode.SQL_ERROR)
				errors = source.CreateErrors ();
			else
				errors = CreateErrors (returnCode);
			throw new VirtuosoException (returnCode, errors);
		}
Exemplo n.º 3
0
		internal DataType (
			string typeName,
			VirtDbType vdbType,
			System.Data.DbType dbType,
			CLI.SqlType sqlType,
			BufferType bufferType)
			: this (typeName, vdbType, dbType, sqlType, bufferType, false)
		{
		}
		internal static void HandleResult (
			CLI.ReturnCode returnCode,
			ICreateErrors source,
			IDbConnection connection)
		{
			if (returnCode == CLI.ReturnCode.SQL_SUCCESS_WITH_INFO)
				HandleWarnings (source, connection);
			else if (returnCode != CLI.ReturnCode.SQL_SUCCESS)
				HandleErrors (returnCode, source);
		}
Exemplo n.º 5
0
 static void Main(string[] args)
 {
     try
     {
         var cli = new CLI();
         cli.Run(args);
     }
     catch (Exception ex)
     {
         Console.WriteLine($"运行异常:{ex.Message}");
     }
 }
Exemplo n.º 6
0
        private static bool CheckAdminTasks()
        {
            if (CLI.IsCommandExist("dnschanger"))
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new DNSChangerForm());
                return(true);
            }

            return(false);
        }
Exemplo n.º 7
0
        public void Option_syntax_variants()
        {
            var sut = new CLI(new[] { "-noscreenshots" });

            Assert.False(sut.TakeScreenshots);

            sut = new CLI(new[] { "--noscreenshots" });
            Assert.False(sut.TakeScreenshots);

            sut = new CLI(new[] { "/noscreenshots" });
            Assert.False(sut.TakeScreenshots);
        }
Exemplo n.º 8
0
        private static void Run()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            DebugHelper.WriteLine(Title);
            DebugHelper.WriteLine("Build: " + Build);
            DebugHelper.WriteLine("Command line: " + Environment.CommandLine);

            if (!string.IsNullOrEmpty(PersonalPathDetectionMethod))
            {
                DebugHelper.WriteLine("Personal path detection method: " + PersonalPathDetectionMethod);
            }

            DebugHelper.WriteLine("Personal path: " + PersonalFolder);
            DebugHelper.WriteLine("Operating system: " + Helpers.GetWindowsProductName());

            SilentRun = CLI.IsCommandExist("silent", "s");

#if STEAM
            SteamFirstTimeConfig = CLI.IsCommandExist("SteamConfig");
#endif

            IgnoreHotkeyWarning = CLI.IsCommandExist("NoHotkeys");

            CheckPuushMode();
            DebugWriteFlags();
            CleanTempFiles();

            SettingManager.LoadInitialSettings();

            Uploader.UpdateServicePointManager();
            UpdateManager = new GitHubUpdateManager("ShareX", "ShareX", Dev, Portable);

            LanguageHelper.ChangeLanguage(Settings.Language);

            Helpers.TryFixHandCursor();
            DebugHelper.WriteLine("MainForm init started.");
            MainForm = new MainForm();
            DebugHelper.WriteLine("MainForm init finished.");

            Application.Run(MainForm);

            if (WatchFolderManager != null)
            {
                WatchFolderManager.Dispose();
            }
            SettingManager.SaveAllSettings();

            DebugHelper.Logger.AsyncWrite = false;
            DebugHelper.WriteLine("ShareX closing.");
        }
Exemplo n.º 9
0
        public void Interact(Action onCompletion)
        {
            try
            {
                CLI.DisplayLine("Welcome to the publishing interface!");
                CLI.DisplayLineDelimiter();

                if (!controller.HasSavedState())
                {
                    StartAsNewPublisher();
                }
                else
                {
                    controller.Start();
                }

                if (!controller.HasChain())
                {
                    RegisterAtNode();
                }

                CLI.DisplayLine("PublisherHandler ready. Enter " + UIConstants.abortionCode + " to quit.");
                CLI.DisplayLineDelimiter();

                var userInput = CLI.PromptUser(promptNextCommand);

                while (userInput != UIConstants.abortionCode)
                {
                    if (userCommands.ContainsKey(userInput))
                    {
                        userCommands[userInput]();
                    }
                    else
                    {
                        CLI.DisplayLine("Command not found. The following options are available:\n");
                        foreach (string key in userCommands.Keys)
                        {
                            CLI.DisplayLine(key);
                        }

                        CLI.DisplayLineDelimiter();
                    }

                    userInput = CLI.PromptUser(promptNextCommand);
                }
            }
            finally
            {
                controller.ShutDown();
                onCompletion();
            }
        }
Exemplo n.º 10
0
 public void CloseCursor(bool isExecuted)
 {
     if (!isExecuted)
     {
         return;
     }
     CLI.ReturnCode rc = (CLI.ReturnCode)CLI.SQLFreeStmt(hstmt, (ushort)CLI.FreeStmtOption.SQL_CLOSE);
     if (rc != CLI.ReturnCode.SQL_SUCCESS && rc != CLI.ReturnCode.SQL_NO_DATA)
     {
         Diagnostics.HandleResult(rc, this, outerCommand.Connection);
     }
     GC.KeepAlive(this);
 }
Exemplo n.º 11
0
 private void CloseFinalizedCommands()
 {
     for (int i = 0; i < list.Count; i++)
     {
         Item item = (Item)list[i];
         if (item.weakCommand != null && item.weakCommand.Target == null)
         {
             IntPtr hstmt = item.hstmt;
             list.RemoveAt(i);
             CLI.SQLFreeHandle((short)CLI.HandleType.SQL_HANDLE_STMT, hstmt);
         }
     }
 }
Exemplo n.º 12
0
 public void SetTimeout(int timeout)
 {
     CLI.ReturnCode rc = (CLI.ReturnCode)CLI.SQLSetStmtAttr(
         hstmt,
         (int)CLI.StatementAttribute.SQL_ATTR_QUERY_TIMEOUT,
         (IntPtr)timeout,
         (int)CLI.LengthCode.SQL_IS_SMALLINT);
     if (rc != CLI.ReturnCode.SQL_SUCCESS)
     {
         Diagnostics.HandleResult(rc, this, outerCommand.Connection);
     }
     GC.KeepAlive(this);
 }
Exemplo n.º 13
0
        public Boolean CreateBooking()
        {
            Person cust = CLI.ChooseCustomer(customers);
            Event  e    = CLI.ChooseEvent(events);

            if (e.MakeReservation(cust))
            {
                //Console.WriteLine("Booking done");
                return(true);
            }
            //Console.WriteLine("Cannot make booking");
            return(false);
        }
Exemplo n.º 14
0
        private void ValidateChain()
        {
            CLI.DisplayLineDelimiter();
            CLI.DisplayLine("Validating chain");
            CLI.DisplayLineDelimiter();

            var validity = controller.ValidateChain();
            var display  = "Current chain status: " + (validity ? "valid" : "not valid");

            CLI.DisplayLine(display);

            CLI.DisplayLineDelimiter();
        }
Exemplo n.º 15
0
        private int GetResultColumns()
        {
            short count;

            CLI.ReturnCode rc = (CLI.ReturnCode)CLI.SQLNumResultCols(hstmt, out count);
            if (rc != CLI.ReturnCode.SQL_SUCCESS)
            {
                Diagnostics.HandleResult(rc, this, outerCommand.Connection);
            }

            GC.KeepAlive(this);
            return(count);
        }
Exemplo n.º 16
0
        public int GetRowCount()
        {
            IntPtr count;

            CLI.ReturnCode rc = (CLI.ReturnCode)CLI.SQLRowCount(hstmt, out count);
            if (rc != CLI.ReturnCode.SQL_SUCCESS)
            {
                Diagnostics.HandleResult(rc, this, outerCommand.Connection);
            }

            GC.KeepAlive(this);
            return((int)count);
        }
Exemplo n.º 17
0
        public void Run(string[] args)
        {
            CLI.ColorfulWriteLine("New todo:", CLI.ConsoleColors["input"]);
            string   title       = CLI.GetConsoleInput(" Title: ");
            string   description = CLI.GetConsoleInput(" Description: ");
            DateTime deadline    = CLI.GetDateTimeFromInput(" Deadline (as `dd.mm.yyyy`): ");

            string[] tags = CLI.GetConsoleInput(" Tags: ").Trim().Split();

            CLI.CurrentTodoList.Todos.Add(new Todo(title, description, deadline, tags.ToList()));

            CLI.ColorfulWriteLine("Successfully added new todo!", CLI.ConsoleColors["success"]);
        }
Exemplo n.º 18
0
 public override void Execute(string line, string[] args)
 {
     TextGraphics.Clear(CLI.BackColor);
     Shell.DrawTitleBar();
     if (Shell.TitleBarVisible)
     {
         CLI.SetCursorPos(0, 2);
     }
     else
     {
         CLI.SetCursorPos(0, 0);
     }
 }
Exemplo n.º 19
0
 public void Execute()
 {
     CLI.ReturnCode rc = (CLI.ReturnCode)CLI.SQLExecute(hstmt);
     if (rc != CLI.ReturnCode.SQL_SUCCESS)
     {
         if (rc != CLI.ReturnCode.SQL_SUCCESS_WITH_INFO)
         {
             DisposeParameters();
         }
         Diagnostics.HandleResult(rc, this, outerCommand.Connection);
     }
     GC.KeepAlive(this);
 }
Exemplo n.º 20
0
    // Use this for initialization
    void Start()
    {
        AppSoftware     = GameObject.Find("Applications");
        HackingSoftware = GameObject.Find("Hacking");
        SysSoftware     = GameObject.Find("System");
        //Computer = GameObject.Find("Computer");

        //System
        clk    = SysSoftware.GetComponent <Clock>();
        defalt = SysSoftware.GetComponent <Defalt>();
        am     = SysSoftware.GetComponent <AppMenu>();
        cmd    = SysSoftware.GetComponent <CLI>();
        com    = SysSoftware.GetComponent <Computer>();
        sc     = SysSoftware.GetComponent <SoundControl>();
        appman = SysSoftware.GetComponent <AppMan>();
        boot   = SysSoftware.GetComponent <Boot>();
        post   = SysSoftware.GetComponent <POST>();
        os     = SysSoftware.GetComponent <OS>();
        mouse  = SysSoftware.GetComponent <Mouse>();
        desk   = SysSoftware.GetComponent <Desktop>();

        //Applications
        al = AppSoftware.GetComponent <AccLog>();
        sm = AppSoftware.GetComponent <SystemMap>();
        ib = AppSoftware.GetComponent <InternetBrowser>();

        //Hacking
        prog  = HackingSoftware.GetComponent <Progtive>();
        trace = HackingSoftware.GetComponent <Tracer>();
        cy    = HackingSoftware.GetComponent <Descy>();
        ds    = HackingSoftware.GetComponent <DirSearch>();

        mb    = GetComponent <MissionBrow>();
        cc    = GetComponent <CurContracts>();
        sl    = GetComponent <SiteList>();
        note  = GetComponent <Notepad>();
        fav   = GetComponent <Favs>();
        tv    = GetComponent <TreeView>();
        mPass = GetComponent <MonitorBypass>();
        wsv   = GetComponent <WebSecViewer>();
        sdp   = GetComponent <ShutdownProm>();
        Audio = GetComponent <AudioSource>();

        windowRect.x = Customize.cust.windowx[windowID];
        windowRect.y = Customize.cust.windowy[windowID];

        Audio.volume = Customize.cust.Volume;

        DesktopY  = 75;
        StartTime = 0.030f;
    }
Exemplo n.º 21
0
        public void Run(string[] args)
        {
            string     title      = args.Length > 0 ? args[0] : CLI.GetConsoleInput(" Title of todo: ");
            string     status_str = args.Length > 1 ? args[1] : CLI.GetConsoleInput(" New status: ");
            TodoStatus status;

            switch (status_str)
            {
            case "active": status = TodoStatus.Active;
                break;

            case "fail":
            case "failure": status = TodoStatus.Failure;
                break;

            case "success": status = TodoStatus.Success;
                break;

            default:
                throw new TodoListException("Invalid status.");
            }

            var  suitableTodos = TodoList.SortTodos(CLI.CurrentTodoList.Todos.Where(todo => todo.Title == title && todo.Status != status).ToList()).ToList();
            Todo toChange;

            if (suitableTodos.Count == 0)
            {
                throw new TodoListException("No suitable todos.");
            }
            else if (suitableTodos.Count == 1)
            {
                toChange = suitableTodos[0];
            }
            else
            {
                int index;
                TodoList.PrintTodos(suitableTodos);
                if (int.TryParse(CLI.GetConsoleInput(" Choose the todo to change (type index): "), out index) &&
                    (index - 1) >= 0 && (index - 1) < suitableTodos.Count)
                {
                    toChange = suitableTodos[index - 1];
                }
                else
                {
                    throw new TodoListException("Indalid index");
                }
            }
            toChange.ChangeStatus(status);
            Console.WriteLine("Status changed.");
        }
Exemplo n.º 22
0
        private void RewindData(ColumnData[] columns)
        {
            CLI.ReturnCode rc = (CLI.ReturnCode)CLI.SQLSetPos(hstmt, 1, (ushort)CLI.SetPosOp.SQL_POSITION, (ushort)CLI.LockOption.SQL_LOCK_NO_CHANGE);
            if (rc != CLI.ReturnCode.SQL_SUCCESS)
            {
                Diagnostics.HandleResult(rc, this, outerCommand.Connection);
            }
            GC.KeepAlive(this);

            for (int i = 0; i < columns.Length; i++)
            {
                columns[i].lobOffset = 0;
            }
        }
Exemplo n.º 23
0
        public static async Task <int> Main(string[] args)
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

            try {
                return(await CLI.Run(args));
            } catch (CommandParserException ex) {
                Console.Error.WriteLine($"\nError: {ex.Message}\n");
                return(1);
            } catch (FatCatException ex) {
                Console.Error.WriteLine($"\nError: {ex.Message}\n");
                return(1);
            }
        }
Exemplo n.º 24
0
        private void ListNodes()
        {
            CLI.DisplayLineDelimiter();
            CLI.DisplayLine("Listing known nodes");
            CLI.DisplayLineDelimiter();
            var knownNodes = controller.GetKnownNodes();

            foreach (var n in knownNodes)
            {
                CLI.DisplayLine(n.FullAddress);
            }

            CLI.DisplayLineDelimiter();
        }
Exemplo n.º 25
0
        public override void Execute(string line, string[] args)
        {
            if (args.Length == 1)
            {
                PMFAT.CurrentDirectory = @"0:\";
            }
            else
            {
                if (line.Length > 3)
                {
                    string path = line.Substring(3, line.Length - 3).ToLower();
                    if (path.EndsWith('\\'))
                    {
                        path = path.Remove(path.Length - 1, 1);
                    }
                    path += "\\";

                    if (PMFAT.FolderExists(path))
                    {
                        if (path.StartsWith(PMFAT.CurrentDirectory))
                        {
                            PMFAT.CurrentDirectory = path;
                        }
                        else if (path.StartsWith(@"0:\"))
                        {
                            PMFAT.CurrentDirectory = path;
                        }
                        else if (!path.StartsWith(PMFAT.CurrentDirectory) && !path.StartsWith(@"0:\"))
                        {
                            if (PMFAT.FolderExists(PMFAT.CurrentDirectory + path))
                            {
                                PMFAT.CurrentDirectory = PMFAT.CurrentDirectory + path;
                            }
                            else
                            {
                                CLI.WriteLine("Could not locate directory \"" + path + "\"", Color.Red);
                            }
                        }
                    }
                    else
                    {
                        CLI.WriteLine("Could not locate directory!", Color.Red);
                    }
                }
                else
                {
                    CLI.WriteLine("Invalid argument! Path expected.", Color.Red);
                }
            }
        }
Exemplo n.º 26
0
        public void FillsDefaultsAndBootstraps(string pathVal, string expectedPath)
        {
            var bs  = Mock.Of <IBootstrapper>();
            var cli = new CLI();

            cli.Bootstrapper = bs;

            cli.FillDefaultsAndBootstrap(new Options()
            {
                Path = pathVal
            });

            Mock.Get(bs).Verify(b => b.Bootstrap(It.Is <Options>(o => o.Path == expectedPath)), Times.Once);
        }
Exemplo n.º 27
0
        private static void Load()
        {
            // draw
            Draw();
            TextGraphics.DrawLineH(0, StartY, Width, ' ', Color.White, Color.Black);
            TextGraphics.DrawString(0, StartY, "FILENAME: ", Color.White, Color.Black);
            CLI.SetCursorPos(10, StartY);

            // get file
            string file = Console.ReadLine();

            // load file
            LoadFile(file);
        }
Exemplo n.º 28
0
        public static void Main(string[] args)
        {
            Environment.CurrentDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            bool useConsole = DetectConsole();

            if (useConsole)
            {
                CLI.RunCLI();
            }
            else
            {
                RunGUI();
            }
        }
		internal static VirtuosoErrorCollection CreateErrors (CLI.HandleType handleType, IntPtr handle)
		{
			VirtuosoErrorCollection errors = new VirtuosoErrorCollection ();

			MemoryHandle sqlState = null;
			MemoryHandle messageText = null;
			try
			{
				sqlState = new MemoryHandle ((CLI.SQL_SQLSTATE_SIZE + 1) * Platform.WideCharSize);
				messageText = new MemoryHandle ((CLI.SQL_MAX_MESSAGE_LEN + 1) * Platform.WideCharSize);

				for (short recNumber = 1; ;recNumber++)
				{
					int nativeError;
					short textLength;
					CLI.ReturnCode rc = (CLI.ReturnCode) CLI.SQLGetDiagRec (
						(short) handleType,
						handle,
						recNumber,
						sqlState.Handle,
						out nativeError,
						messageText.Handle,
						(short) (messageText.Length / Platform.WideCharSize),
						out textLength);
					if (rc != CLI.ReturnCode.SQL_SUCCESS && rc != CLI.ReturnCode.SQL_SUCCESS_WITH_INFO)
						break;

#if false
					//System.Console.WriteLine ("length: {0}", textLength);
					string sMessageText = Platform.WideCharsToString (messageText.Handle, textLength);
					string sSqlState = Platform.WideCharsToString (sqlState.Handle, CLI.SQL_SQLSTATE_SIZE);
#else
					string sMessageText = Marshal.PtrToStringAnsi (messageText.Handle, textLength);
					string sSqlState = Marshal.PtrToStringAnsi (sqlState.Handle, CLI.SQL_SQLSTATE_SIZE);
#endif
					VirtuosoError error = new VirtuosoError (sMessageText, sSqlState);
					errors.Add (error);
				}
			} 
			finally 
			{
				if (sqlState != null)
					sqlState.Dispose ();
				if (messageText != null)
					messageText.Dispose ();
			}

			return errors;
		}
Exemplo n.º 30
0
        private static void Run()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            DebugHelper.WriteLine(Title);
            DebugHelper.WriteLine("Build: " + Build);
            DebugHelper.WriteLine("Command line: " + Environment.CommandLine);
            DebugHelper.WriteLine("Personal path: " + PersonalFolder);
            DebugHelper.WriteLine("Operating system: " + Helpers.GetWindowsProductName());

            SilentRun = CLI.IsCommandExist("silent", "s");

#if STEAM
            SteamFirstTimeConfig = CLI.IsCommandExist("SteamConfig");
#endif

            IgnoreHotkeyWarning = CLI.IsCommandExist("NoHotkeys");

            CheckPuushMode();
            DebugWriteFlags();
            CleanTempFiles();
            LoadProgramSettings();

            UploaderSettingsResetEvent = new ManualResetEvent(false);
            HotkeySettingsResetEvent   = new ManualResetEvent(false);
            TaskEx.Run(LoadSettings);

            Uploader.UpdateServicePointManager();
            UpdateManager = new GitHubUpdateManager("ShareX", "ShareX", Beta, Portable);

            LanguageHelper.ChangeLanguage(Settings.Language);

            DebugHelper.WriteLine("MainForm init started");
            MainForm = new MainForm();
            DebugHelper.WriteLine("MainForm init finished");

            Application.Run(MainForm);

            if (WatchFolderManager != null)
            {
                WatchFolderManager.Dispose();
            }
            SaveAllSettings();
            BackupSettings();

            DebugHelper.Logger.Async = false;
            DebugHelper.WriteLine("ShareX closing");
        }
Exemplo n.º 31
0
        // convert string to byte
        public static int StringToInt(string val)
        {
            int output = 0;

            try
            {
                output = int.Parse(val);
            }
            catch (Exception ex)
            {
                CLI.Write("[ERROR] ", Color.Red); CLI.WriteLine("Could not convert value \"" + val + "\" to byte.");
                CLI.Write("[DEBUG INFO] ", Color.Yellow); CLI.WriteLine(ex.Message, Color.Gray);
            }
            return(output);
        }
Exemplo n.º 32
0
        // clear screen, draw title bar, set cursor pos
        public static void DrawFresh()
        {
            // clear screen
            TextGraphics.Clear(CLI.BackColor);

            // draw title bar
            if (TitleBarVisible)
            {
                DrawTitleBar(); CLI.SetCursorPos(0, 2);
            }
            else
            {
                CLI.SetCursorPos(0, 0);
            }
        }
Exemplo n.º 33
0
 // draw character to position on screen
 public static bool DrawChar(int x, int y, char c, Color fg, Color bg)
 {
     if (x >= 0 && x < CLI.Width && y >= 0 && y < CLI.Height)
     {
         int oldX = CLI.CursorX, oldY = CLI.CursorY;
         CLI.SetCursorPos(x, y);
         CLI.Write(c.ToString(), fg, bg);
         CLI.SetCursorPos(oldX, oldY);
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 34
0
        private void DisposeParameters()
        {
            CLI.ReturnCode rc = (CLI.ReturnCode)CLI.SQLFreeStmt(hstmt, (ushort)CLI.FreeStmtOption.SQL_RESET_PARAMS);
            if (rc != CLI.ReturnCode.SQL_SUCCESS && rc != CLI.ReturnCode.SQL_NO_DATA)
            {
                Diagnostics.HandleResult(rc, this, outerCommand.Connection);
            }
            GC.KeepAlive(this);

            if (parameterData != null)
            {
                parameterData.Dispose();
                parameterData = null;
            }
        }
Exemplo n.º 35
0
        public bool Execute()
        {
            var result = CLI.SaveHelper(this._fileName, this.TargetImage.ToBitmap());

            if (result == CLIExitCode.NothingToSave)
            {
                throw new NullReferenceException("Nothing to save");
            }
            if (result == CLIExitCode.JpegNotSupportedOnThisPlatform)
            {
                throw new InvalidOperationException("Jpeg not supported");
            }

            return(result == CLIExitCode.OK);
        }
Exemplo n.º 36
0
		internal DataType (
			string typeName,
			VirtDbType vdbType,
			System.Data.DbType dbType,
			CLI.SqlType sqlType,
			BufferType bufferType,
			bool isLong)
		{
			this.typeName = typeName;
			this.vdbType = vdbType;
			this.dbType = dbType;
			this.sqlType = sqlType;
			this.bufferType = bufferType;
			this.isLong = isLong;
		}
		private static VirtuosoErrorCollection CreateErrors (CLI.ReturnCode rc)
		{
			string message = null;
			switch (rc)
			{
			case CLI.ReturnCode.SQL_INVALID_HANDLE:
				message = "Invalid Handle";
				break;
			case CLI.ReturnCode.SQL_NEED_DATA:
				message = "Need Data";
				break;
			case CLI.ReturnCode.SQL_STILL_EXECUTING:
				message = "Still Executing";
				break;
			default:
				message = "Unexpected Return Code";
				break;
			}

			VirtuosoErrorCollection errors = new VirtuosoErrorCollection ();
			VirtuosoError error = new VirtuosoError (message, "");
			errors.Add (error);
			return errors;
		}
		internal VirtuosoException (CLI.ReturnCode returnCode, VirtuosoErrorCollection errors)
		{
			this.returnCode = returnCode;
			this.errors = errors;
		}
		internal BufferType (System.Type type, CLI.SqlCType sqlCType, int alignment)
			: this (type, sqlCType, alignment, false)
		{
		}
		// deprecated
		internal static void HandleErrors (
			CLI.ReturnCode returnCode,
			CLI.HandleType handleType,
			IntPtr handle)
		{
			VirtuosoErrorCollection errors = null;
			if (returnCode == CLI.ReturnCode.SQL_ERROR)
				errors = OdbcErrors.CreateErrors (handleType, handle);
			else
				errors = CreateErrors (returnCode);
			throw new VirtuosoException (returnCode, errors);
		}
Exemplo n.º 41
0
		internal DataTypeBinary (
			string typeName,
			VirtDbType vdbType,
			System.Data.DbType dbType,
			CLI.SqlType sqlType,
			bool isLong)
			: base (typeName, vdbType, dbType, sqlType, BufferTypes.Binary, isLong)
		{
		}
		// deprecated
		internal static void HandleWarnings (
			CLI.HandleType handleType,
			IntPtr handle,
			VirtuosoConnection connection)
		{
			VirtuosoInfoMessageEventArgs args = new VirtuosoInfoMessageEventArgs (OdbcErrors.CreateErrors (handleType, handle));
			connection.OnInfoMessage (args);
		}
Exemplo n.º 43
0
		internal DataTypeInt16 (
			string typeName,
			VirtDbType vdbType,
			System.Data.DbType dbType,
			CLI.SqlType sqlType)
			: base (typeName, vdbType, dbType, sqlType, BufferTypes.Short)
		{
		}
Exemplo n.º 44
0
		internal DataTypeSingle (
			string typeName,
			VirtDbType vdbType,
			System.Data.DbType dbType,
			CLI.SqlType sqlType)
			: base (typeName, vdbType, dbType, sqlType, BufferTypes.Float)
		{
		}
Exemplo n.º 45
0
		internal DataTypeDateTime (
			string typeName,
			VirtDbType vdbType,
			System.Data.DbType dbType,
			CLI.SqlType sqlType)
			: base (typeName, vdbType, dbType, sqlType, BufferTypes.DateTime)
		{
		}
Exemplo n.º 46
0
 //<- abstract class (RC)
 protected CliRunner(Program p)
 {
     program = p;
     options = p.Options; //could be changed and called via program
 }
		public override void BeginTransaction (CLI.IsolationLevel level)
		{
			autocommit = false;
			isolation = level;
		}
Exemplo n.º 48
0
		internal static DataType MapSqlType (CLI.SqlType type)
		{
			switch (type)
			{
			case CLI.SqlType.SQL_CHAR:		return Char;
			case CLI.SqlType.SQL_VARCHAR:		return VarChar;
			case CLI.SqlType.SQL_LONGVARCHAR:	return LongVarChar;
			case CLI.SqlType.SQL_WCHAR:		return NChar;
			case CLI.SqlType.SQL_WVARCHAR:		return NVarChar;
			case CLI.SqlType.SQL_WLONGVARCHAR:	return NLongVarChar;
			case CLI.SqlType.SQL_BINARY:		return Timestamp;
			case CLI.SqlType.SQL_VARBINARY:		return VarBinary;
			case CLI.SqlType.SQL_LONGVARBINARY:	return LongVarBinary;
			case CLI.SqlType.SQL_BIGINT:		return BigInt;
			case CLI.SqlType.SQL_INTEGER:		return Integer;
			case CLI.SqlType.SQL_SMALLINT:		return SmallInt;
			case CLI.SqlType.SQL_REAL:		return Real;
			case CLI.SqlType.SQL_FLOAT:		return Float;
			case CLI.SqlType.SQL_DOUBLE:		return Double;
			case CLI.SqlType.SQL_DECIMAL:		//return Decimal;
			case CLI.SqlType.SQL_NUMERIC:		return Numeric;
			case CLI.SqlType.SQL_DATE:
			case CLI.SqlType.SQL_TYPE_DATE:		return Date;
			case CLI.SqlType.SQL_TIME:
			case CLI.SqlType.SQL_TYPE_TIME:		return Time;
			case CLI.SqlType.SQL_TIMESTAMP:
			case CLI.SqlType.SQL_TYPE_TIMESTAMP:	return DateTime;
			}
			return null;
		}
Exemplo n.º 49
0
		internal DataTypeXml (
			string typeName,
			VirtDbType vdbType,
			System.Data.DbType dbType,
			CLI.SqlType sqlType)
			: base (typeName, vdbType, dbType, sqlType, BufferTypes.Xml, true)
		{
		}
Exemplo n.º 50
0
		internal DataTypeTimestamp (
			string typeName,
			VirtDbType vdbType,
			System.Data.DbType dbType,
			CLI.SqlType sqlType)
			: base (typeName, vdbType, dbType, sqlType, BufferTypes.Binary)
		{
		}
		internal BufferTypeFixed (System.Type type, CLI.SqlCType sqlCType, int alignment, int bufferSize)
			: base (type, sqlCType, alignment, true)
		{
			this.bufferSize = bufferSize;
		}
Exemplo n.º 52
0
		internal DataTypeChar (
			string typeName,
			VirtDbType vdbType,
			System.Data.DbType dbType,
			CLI.SqlType sqlType,
			bool isLong)
#if false
			: base (typeName, vdbType, dbType, sqlType, BufferTypes.Char, isLong)
#else
			: base (typeName, vdbType, dbType, sqlType, BufferTypes.WChar, isLong)
		public abstract void BeginTransaction (CLI.IsolationLevel level);
Exemplo n.º 54
0
		internal DataTypeNumeric (
			string typeName,
			VirtDbType vdbType,
			System.Data.DbType dbType,
			CLI.SqlType sqlType)
			: base (typeName, vdbType, dbType, sqlType, BufferTypes.Numeric)
		{
		}
 static void Main(string[] args)
 {
     var cli = new CLI();
       cli.Run(args);
 }
		// deprecated
		internal static void HandleResult (
			CLI.ReturnCode returnCode,
			CLI.HandleType handleType,
			IntPtr handle,
			VirtuosoConnection connection)
		{
			if (returnCode == CLI.ReturnCode.SQL_SUCCESS_WITH_INFO)
				HandleWarnings (handleType, handle, connection);
			else if (returnCode != CLI.ReturnCode.SQL_SUCCESS)
				HandleErrors (returnCode, handleType, handle);
		}
		public override void BeginTransaction (CLI.IsolationLevel level)
		{
			CLI.ReturnCode rc = (CLI.ReturnCode) CLI.SQLSetConnectAttr (
				hdbc,
				(int) CLI.ConnectionAttribute.SQL_ATTR_AUTOCOMMIT,
				(IntPtr) (int) CLI.AutoCommit.SQL_AUTOCOMMIT_OFF,
				(int) CLI.LengthCode.SQL_IS_UINTEGER);
			if (rc != CLI.ReturnCode.SQL_SUCCESS)
				HandleConnectionErrors (rc);
			rc = (CLI.ReturnCode) CLI.SQLSetConnectAttr (
				hdbc,
				(int) CLI.ConnectionAttribute.SQL_ATTR_TXN_ISOLATION,
				(IntPtr) (int) level,
				(int) CLI.LengthCode.SQL_IS_UINTEGER);
			if (rc != CLI.ReturnCode.SQL_SUCCESS)
			{
				if (rc == CLI.ReturnCode.SQL_SUCCESS_WITH_INFO)
					Diagnostics.HandleWarnings (this, OuterConnection);
				else
				{
					try
					{
						Diagnostics.HandleErrors (rc, CLI.HandleType.SQL_HANDLE_DBC, hdbc);
					}
					finally
					{
						CLI.SQLSetConnectAttr (
							hdbc,
							(int) CLI.ConnectionAttribute.SQL_ATTR_AUTOCOMMIT,
							(IntPtr) (int) CLI.AutoCommit.SQL_AUTOCOMMIT_ON,
							(int) CLI.LengthCode.SQL_IS_UINTEGER);
					}
				}
			}

			GC.KeepAlive (this);
		}
		internal void HandleConnectionErrors (CLI.ReturnCode rc)
		{
			Diagnostics.HandleResult (rc, this, OuterConnection);
		}