コード例 #1
0
		public void IsqlScriptTest()
		{
			string fileName = ConfigurationSettings.AppSettings["IsqlScript"];
			if (System.IO.File.Exists(fileName))
			{
				FbScript isql = new FbScript(fileName);
				foreach (string command in isql.Results)
				{
					Console.WriteLine(command);
				}
			}
		}
コード例 #2
0
        public void InitCatalog()
        {
            //Create the database, replacing if it exists
            Hashtable parms = new Hashtable();
            parms["User"] = "******";
            parms["Password"] = "******";
            parms["Database"] = "mercury.fdb";
            parms["ServerType"] = 1;
            parms["Overwrite"] = true;
            parms["Dialect"] = 3;
            parms["Charset"] = "UNICODE_FSS";
            FbConnection.CreateDatabase(parms);

            //Open a connection to the new database, and populate it with the schema elements
            FbConnection conn = GetConnection();
            FbBatchExecution fbe = new FbBatchExecution(conn);
            Assembly asm = Assembly.GetExecutingAssembly();

            //Load and run the script to create the database
            TextReader tr = new StreamReader(asm.GetManifestResourceStream("Mercury.MercDb.sql"));
            FbScript fbs = new FbScript(tr);
            fbs.Parse();
            fbe.SqlStatements = fbs.Results;
            fbe.Execute();
            tr.Close();

            tr = new StreamReader(asm.GetManifestResourceStream("Mercury.MercDbProcs.sql"));
            fbs = new FbScript(tr);
            fbs.Parse();
            fbe.SqlStatements = fbs.Results;
            fbe.Execute();
            tr.Close();

            conn.Close();
        }
コード例 #3
0
		public FbBatchExecution(FbConnection sqlConnection, FbScript isqlScript)
		{
			if (sqlConnection == null)
			{
				this.sqlConnection	 = new FbConnection(); // do	not	specify	the	connection string
				this.connectionString = new FbConnectionStringBuilder();
			}
			else
			{
				this.sqlConnection	 = sqlConnection;
				this.connectionString = new FbConnectionStringBuilder(sqlConnection.ConnectionString);
			}

            if (isqlScript != null)
            {
                foreach (string sql in isqlScript.Results)
                {
                    this.SqlStatements.Add(sql);
                }
            }
		}