예제 #1
0
        /*********************************************************************/
        /// <summary>
        /// Fügt ein paar Testdaten in die Tabelle ein
        /// </summary>
        private void createTestData()
        {
            clearDatabase();

            string sSQLCommand = "INSERT INTO " + CTableConstants.TABLE_ATTRIBUTES + " (id";

            for (int attribute = 0; attribute < CTableConstants.MAX_ATTRIBUTE_COUNT; attribute++)
            {
                sSQLCommand += ", ";
                sSQLCommand += CTableConstants.ATTR_X + attribute.ToString();
            }

            sSQLCommand += ") VALUES ";

            for (int entry = 0; entry < 50; entry++)
            {
                if (entry != 0)
                {
                    sSQLCommand += ", ";
                }

                sSQLCommand += "(NULL";
                for (int attribute = 0; attribute < CTableConstants.MAX_ATTRIBUTE_COUNT; attribute++)
                {
                    sSQLCommand += ", '" + entry.ToString() + " " + attribute.ToString() + "'";
                }
                sSQLCommand += ") ";
            }

            mConnection.sqlExecuteStatement(sSQLCommand);
        }
예제 #2
0
        /*********************************************************************/
        /// <summary>
        /// Bereitet die Datenbank zur Nutzung vor.
        /// </summary>
        public void setUpDatabase()
        {
            // zuerst die Datentabelle
            /////////////////////////////
            string sSQLCommand = "CREATE TABLE IF NOT EXISTS " + CTableConstants.TABLE_ATTRIBUTES + " (" +
                                 "id INTEGER PRIMARY KEY AUTOINCREMENT, ";

            for (int attribute = 0; attribute < CTableConstants.MAX_ATTRIBUTE_COUNT; attribute++)
            {
                sSQLCommand += CTableConstants.ATTR_X + attribute + " TEXT";
                if (attribute < CTableConstants.MAX_ATTRIBUTE_COUNT - 1)
                {
                    sSQLCommand += ", ";
                }
            }
            sSQLCommand += ")";
            mConnection.sqlExecuteStatement(sSQLCommand);


            // jetzt die Attributtypen vorbereiten
            mAttributeTypeList.Clear();
            for (int attributeIndex = 0; attributeIndex < CTableConstants.MAX_ATTRIBUTE_COUNT; attributeIndex++)
            {
                mAttributeTypeList.Add(new CAttributeType(attributeIndex));
            }

            #region AttributeTypeTabelle (Alt, aber vllt brauchen wir es doch nochmal)

            /*
             * // feststellen ob die Tabelle an und für sich existiert
             * sSQLCommand = "SELECT * FROM " + CTableConstants.TABLE_ATTRIBUTE_TYPES;
             * bool bAttrTypeTableAvailabe = (mConnection.sqlExecuteStatement(sSQLCommand) == true);
             *
             * // dann die Attributtypen Tabelle
             * ////////////////////////////////////
             * sSQLCommand = "CREATE TABLE IF NOT EXISTS " + CTableConstants.TABLE_ATTRIBUTE_TYPES + " (" +
             *  "id INTEGER PRIMARY KEY AUTOINCREMENT, " +
             *  CTableConstants.ATTR_TYPES_NAME + " TEXT, " +
             *  CTableConstants.ATTR_TYPES_TYPE + " INTEGER, " +
             *  CTableConstants.ATTR_TYPES_INTERNAL_NAME + " TEXT, " +
             *  CTableConstants.ATTR_TYPES_USED + " INTEGER, " +
             *  CTableConstants.ATTR_TYPES_TARGET_ATTR + " INTEGER )";
             * mConnection.sqlExecuteStatement(sSQLCommand);
             *
             * // wenn die Tabelle noch nicht vorhanden war, dann müssen wir da die Attribute einfügen
             * if (bAttrTypeTableAvailabe == false)
             * {
             *  sSQLCommand = "INSERT INTO " + CTableConstants.TABLE_ATTRIBUTE_TYPES +
             *      "(" + CTableConstants.ATTR_TYPES_NAME + ", " + CTableConstants.ATTR_TYPES_TYPE + ", " + CTableConstants.ATTR_TYPES_INTERNAL_NAME + ", " + CTableConstants.ATTR_TYPES_USED + ", " + CTableConstants.ATTR_TYPES_TARGET_ATTR + ") " +
             *      "VALUES " +
             *      "('', 0, '" + CTableConstants.ATTR_X + "1', 0, 0), " +
             *      "('', 0, '" + CTableConstants.ATTR_X + "2', 0, 0), " +
             *      "('', 0, '" + CTableConstants.ATTR_X + "3', 0, 0), " +
             *      "('', 0, '" + CTableConstants.ATTR_X + "4', 0, 0), " +
             *      "('', 0, '" + CTableConstants.ATTR_X + "5', 0, 0), " +
             *      "('', 0, '" + CTableConstants.ATTR_X + "6', 0, 0), " +
             *      "('', 0, '" + CTableConstants.ATTR_X + "7', 0, 0), " +
             *      "('', 0, '" + CTableConstants.ATTR_X + "8', 0, 0), " +
             *      "('', 0, '" + CTableConstants.ATTR_X + "9', 0, 0), " +
             *      "('', 0, '" + CTableConstants.ATTR_X + "10', 0, 0), " +
             *      "('', 0, '" + CTableConstants.ATTR_X + "11', 0, 0), " +
             *      "('', 0, '" + CTableConstants.ATTR_X + "12', 0, 0), " +
             *      "('', 0, '" + CTableConstants.ATTR_X + "13', 0, 0), " +
             *      "('', 0, '" + CTableConstants.ATTR_X + "14', 0, 0), " +
             *      "('', 0, '" + CTableConstants.ATTR_X + "15', 0, 0), " +
             *      "('', 0, '" + CTableConstants.ATTR_X + "16', 0, 0) ";
             *  mConnection.sqlExecuteStatement(sSQLCommand);
             * }
             */
            #endregion
        }