コード例 #1
0
        public void Insert(SCAN_DATA data)
        {
            if (data.wafer_id == "" || data.points_cnt == 0)
            {
                throw new AvvaDBException("DB Exception: Insert Wafer data incomplete");
            }

            SqliteCommand sql_cmd = conn.CreateCommand();

            try
            {
                sql_cmd.CommandText = "INSERT INTO main.scan_data (wafer_id, points_cnt, row1, col1, row2, col2, notch_way, scan_type, scan_ok) VALUES ('"
                                      + data.wafer_id + "',"
                                      + data.points_cnt.ToString() + ","
                                      + data.row1.ToString() + ","
                                      + data.col1.ToString() + ","
                                      + data.row2.ToString() + ","
                                      + data.col2.ToString() + ","
                                      + data.notch_way.ToString() + ","
                                      + data.scan_type.ToString() + ","
                                      + data.scan_ok.ToString()
                                      + ");";
                sql_cmd.ExecuteNonQuery();
            }
            catch (SqliteException ex)
            {
                throw new AvvaDBException("DB Insert", ex);
            }
        }
コード例 #2
0
        public void Query(string wafer_id, ref SCAN_DATA data)
        {
            if (wafer_id == "")
            {
                throw new AvvaDBException("DB Exception: Wafer ID Not Found");
            }

            SqliteCommand sql_cmd = conn.CreateCommand();

            sql_cmd.CommandText = "SELECT * FROM main.scan_data WHERE wafer_id = '"
                                  + wafer_id + "' AND scan_ok=1;";
            SqliteDataReader s_reader = sql_cmd.ExecuteReader();

            try
            {
                while (s_reader.Read())
                {
                    data.wafer_id   = wafer_id;
                    data.points_cnt = (int)s_reader["points_cnt"];
                    data.row1       = (int)s_reader["row1"];
                    data.col1       = (int)s_reader["col1"];
                    data.row2       = (int)s_reader["row2"];
                    data.col2       = (int)s_reader["col2"];
                    data.notch_way  = (int)s_reader["notch_way"];
                    data.scan_type  = (int)s_reader["scan_type"];
                    break;
                }
            }
            catch (SqliteException ex)
            {
                throw new AvvaDBException("DB Query", ex);
            }
            finally
            {
                s_reader.Close();
            }
        }