예제 #1
0
        public static List <string> GetRecordsByBase(object conn, XMLRealiser.LexiconType lexiconType, string @base)
        {
            switch (lexiconType)
            {
            case XMLRealiser.LexiconType.NIHDB_HSQL:
                throw new NotImplementedException("HSQLdb disabled");
                string query = "SELECT lexRecord FROM LEX_RECORD where (base = '" + DbBase.FormatSqlStr(@base) +
                               "' and lastAction <> 3)";

            //Statement statement = ((Connection) conn).createStatement();
            //ResultSet rs = statement.executeQuery(query);
            //List<string> outs = new List<string>();
            //while (rs.next())

            //{
            //    string lexRecord = rs.getString("lexRecord");
            //    outs.Add(lexRecord);
            //}

            //rs.close();
            //statement.close();
            //return outs;

            case XMLRealiser.LexiconType.NIHDB_SQLITE:
                List <string> recordStringList = new List <string>();
                SQLiteCommand command          = new SQLiteCommand("SELECT lexRecord FROM LEX_RECORD where (base = @BaseForm and lastAction <> 3)", (SQLiteConnection)conn);
                command.Parameters.Add("@BaseForm", DbType.String).Value = @base;
                SqliteAccess.ProcessDataReader((SQLiteConnection)conn, command, reader => recordStringList.Add(reader["lexRecord"] as string));
                return(recordStringList);
            }

            return(null);
        }
예제 #2
0
        public static string GetRecordByEui(object conn, XMLRealiser.LexiconType lexiconType, string eui)
        {
            switch (lexiconType)
            {
            case XMLRealiser.LexiconType.NIHDB_HSQL:
                throw new NotImplementedException("HSQLdb disabled");
                string query = "SELECT lexRecord FROM LEX_RECORD WHERE (eui = '" + eui + "' AND lastAction <> 3)";

            //Statement statement = ((Connection)conn).createStatement();
            //ResultSet rs = statement.executeQuery(query);
            //string lexRecord = "";
            //while (rs.next())

            //{
            //    lexRecord = rs.getString("lexRecord");
            //}

            //rs.close();
            //statement.close();
            //return lexRecord;

            case XMLRealiser.LexiconType.NIHDB_SQLITE:
                List <string> recordStringList = new List <string>();
                SQLiteCommand command          = new SQLiteCommand("SELECT lexRecord FROM LEX_RECORD WHERE (eui = @ID AND lastAction <> 3)", (SQLiteConnection)conn);
                command.Parameters.AddWithValue("@ID", eui);
                SqliteAccess.ProcessDataReader((SQLiteConnection)conn, command, reader => recordStringList.Add(reader["lexRecord"] as string));
                return(recordStringList[0]);
            }

            return(null);
        }
예제 #3
0
        public static List <string> GetBasesByEui(object conn, XMLRealiser.LexiconType lexiconType, string eui)
        {
            switch (lexiconType)
            {
            case XMLRealiser.LexiconType.NIHDB_HSQL:
                throw new NotImplementedException("HSQLdb disabled");
            //string query = "SELECT inflVar FROM INFL_VARS where (eui = '" + eui + "' and inflection = 1)";
            //Statement statement = ((Connection) conn).createStatement();
            //ResultSet rs = statement.executeQuery(query);
            //List<string> outs = new List<string>();
            //while (rs.next())
            //{
            //    string @base = rs.getString("inflVar");
            //    outs.Add(@base);
            //}

            //rs.close();
            //statement.close();
            //return outs;
            case XMLRealiser.LexiconType.NIHDB_SQLITE:
                List <string> recordStringList = new List <string>();
                SQLiteCommand command          =
                    new SQLiteCommand("SELECT inflVar FROM INFL_VARS where (eui = @EUI and inflection = 1)",
                                      (SQLiteConnection)conn);
                command.Parameters.AddWithValue("@EUI", eui);
                SqliteAccess.ProcessDataReader((SQLiteConnection)conn, command,
                                               reader => recordStringList.Add(reader["inflVar"] as string));
                return(recordStringList);
            }

            return(null);
        }
예제 #4
0
        public static List <string> GetRecordsByCat(object conn, XMLRealiser.LexiconType lexiconType, long category)
        {
            string catCondition = GetCategoryCondition(category);
            string query        = "SELECT lexRecord FROM LEX_RECORD where ((lastAction <> 3)" + catCondition + ")";

            switch (lexiconType)
            {
            case XMLRealiser.LexiconType.NIHDB_HSQL:
                throw new NotImplementedException("HSQLdb disabled");
            //Statement statement = ((Connection)conn).createStatement();
            //ResultSet rs = statement.executeQuery(query);
            //List<string> outs = new List<string>();
            //while (rs.next())

            //{
            //    string lexRecord = rs.getString("lexRecord");
            //    outs.Add(lexRecord);
            //}

            //rs.close();
            //statement.close();
            //return outs;

            case XMLRealiser.LexiconType.NIHDB_SQLITE:
                List <string> recordStringList = new List <string>();
                SQLiteCommand command          = new SQLiteCommand(query);
                SqliteAccess.ProcessDataReader((SQLiteConnection)conn, command, reader => recordStringList.Add(reader["lexRecord"] as string));
                return(recordStringList);
            }

            return(null);
        }
예제 #5
0
        public static List <string> GetEuis(object conn, XMLRealiser.LexiconType lexiconType, string inflVar)
        {
            switch (lexiconType)
            {
            case XMLRealiser.LexiconType.NIHDB_HSQL:
                throw new NotImplementedException("HSQLdb disabled");
                string query = "SELECT eui FROM INFL_VARS where (inflVarLc = '" +
                               DbBase.FormatSqlStr(inflVar.ToLower()) + "')";
            //Statement statement = ((Connection) conn).createStatement();
            //ResultSet rs = statement.executeQuery(query);
            //List<string> outs = new List<string>();
            //while (rs.next())
            //{
            //    string eui = rs.getString("eui");
            //    outs.Add(eui);
            //}

            //rs.close();
            //statement.close();
            //return outs;
            case XMLRealiser.LexiconType.NIHDB_SQLITE:
                List <string> euis    = new List <string>();
                SQLiteCommand command = new SQLiteCommand("SELECT eui FROM INFL_VARS where (inflVarLc = @INFLVAR)",
                                                          (SQLiteConnection)conn);
                command.Parameters.AddWithValue("@INFLVAR", DbBase.FormatSqlStr(inflVar.ToLower()));
                SqliteAccess.ProcessDataReader((SQLiteConnection)conn, command,
                                               reader => euis.Add(reader["eui"] as string));
                return(euis);
            }

            return(null);
        }