Ejemplo n.º 1
0
 void Load(LParam _L)
 {
     foreach (Param p in _L)
     {
         if (p.IsZero())
         {
             break;
         }
         string SQL;
         if (p.val == null || p.val.Length == 0)
         {
             SQL = string.Format("insert into LST (path) values('{0}')", p.path);
         }
         else
         {
             SQL = string.Format("insert into LST values('{0}','{1}')", p.path, p.val);
         }
         using (SQLiteCommand cmd = new SQLiteCommand(SQL, connection))
         {
             if (cmd.ExecuteNonQuery() != 1)
             {
                 FN.fatal("Ошибка:" + SQL);
             }
         }
     }
 }
Ejemplo n.º 2
0
        private void CheckTables(string _schema)
        {
            Select S = new Select(string.Format("select count(*) as nn from INFORMATION_SCHEMA.TABLES where table_type='BASE TABLE' and TABLE_SCHEMA='{0}' and table_name='{1}'", _schema, table_name));

            if (!S.Read())
            {
                FN.fatal("SerialTreeSQL.CheckTables: " + S.SQL + " - не нашли записей");
            }
            int nn = (int)S[0];

            S.Dispose();
            if (nn != 1)
            {
                new ExecSQL(string.Format(
                                " CREATE TABLE {0}(" +
                                "	Unit [varchar](50) NOT NULL,"+
                                "	Val [varchar](max) NULL,"+
                                " CONSTRAINT PK_{1} PRIMARY KEY CLUSTERED" +
                                " (" +
                                "	Unit ASC"+
                                " )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]" +
                                " ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]", _schema + "." + table_name, table_name));
            }
        }