Exemplo n.º 1
0
 private void initDatabase(Utils.DBCon dbcon)
 {
     object o = dbcon.ExecuteScalar("SELECT name FROM sqlite_master WHERE type='table' AND name='preset'");
     if (o == null || o.GetType() == typeof(DBNull))
     {
         dbcon.ExecuteNonQuery("create table 'preset' (name text)");
     }
     o = dbcon.ExecuteScalar("SELECT name FROM sqlite_master WHERE type='table' AND name='forms'");
     if (o == null || o.GetType() == typeof(DBNull))
     {
         dbcon.ExecuteNonQuery("create table 'forms' (preset text, plugintype text, x integer, y integer, w integer, h integer, visible integer, customtag text)");
     }
     else if (!dbcon.ColumnExists("forms", "customtag"))
     {
         dbcon.ExecuteNonQuery("alter table 'forms' add customtag text");
     }
 }
Exemplo n.º 2
0
 private void initDatabase(Utils.DBCon dbcon)
 {
     object o = dbcon.ExecuteScalar("SELECT name FROM sqlite_master WHERE type='table' AND name='shortcut'");
     if (o == null || o.GetType() == typeof(DBNull))
     {
         dbcon.ExecuteNonQuery("create table 'shortcut' (plugintype text, action text, subaction text, keys integer, keystring text)");
     }
 }
Exemplo n.º 3
0
        public bool InitDatabase(Utils.DBCon dbcon)
        {
            /*
             * database:
             * areainfo -> id, parentid, level, name, minlat, minlon, maxlat, maxlon
             * poly -> id, areainfoid, position, lat, lon
             */
            bool result = false;
            try
            {
                object o = dbcon.ExecuteScalar("SELECT name FROM sqlite_master WHERE type='table' AND name='areainfo'");
                if (o == null || o.GetType() == typeof(DBNull))
                {
                    dbcon.ExecuteNonQuery("create table 'areainfo' (id integer, parentid integer, level integer, name text, minlat real, minlon real, maxlat real, maxlon real)");
                }

                o = dbcon.ExecuteScalar("SELECT name FROM sqlite_master WHERE type='table' AND name='poly'");
                if (o == null || o.GetType() == typeof(DBNull))
                {
                    dbcon.ExecuteNonQuery("create table 'poly' (id integer, areainfoid integer, position integer, lat real, lon real)");
                    dbcon.ExecuteNonQuery("create index idx_poly on poly (areainfoid)");
                }

                result = true;
            }
            catch
            {
            }
            return result;
        }
Exemplo n.º 4
0
 private void initDatabase(Utils.DBCon dbcon)
 {
     object o = dbcon.ExecuteScalar("SELECT name FROM sqlite_master WHERE type='table' AND name='groups'");
     if (o == null || o.GetType() == typeof(DBNull))
     {
         dbcon.ExecuteNonQuery("create table 'groups' (id integer, name text)");
     }
     o = dbcon.ExecuteScalar("SELECT name FROM sqlite_master WHERE type='table' AND name='images'");
     if (o == null || o.GetType() == typeof(DBNull))
     {
         dbcon.ExecuteNonQuery("create table 'images' (url text, imagedata blob)");
     }
     o = dbcon.ExecuteScalar("SELECT name FROM sqlite_master WHERE type='table' AND name='trackables'");
     if (o == null || o.GetType() == typeof(DBNull))
     {
         dbcon.ExecuteNonQuery("create table 'trackables' (groupid integer, AllowedToBeCollected integer, Archived integer, BugTypeID integer, Code text, CurrentGeocacheCode text, CurrentGoal text, DateCreated text, Description text, IconUrl text, Id integer, InCollection integer, Name text, TBTypeName text, Url text, WptTypeID integer, Owner text, HopCount integer, DiscoverCount integer, InCacheCount integer, DistanceKm real, Lat real, Lon real)");
         dbcon.ExecuteNonQuery("create index idx_trackablesgroup on trackables (groupid)");
         dbcon.ExecuteNonQuery("create index idx_trackablescode on trackables (code)");
     }
     o = dbcon.ExecuteScalar("SELECT name FROM sqlite_master WHERE type='table' AND name='travels'");
     if (o == null || o.GetType() == typeof(DBNull))
     {
         dbcon.ExecuteNonQuery("create table 'travels' (pos integer, TrackableCode text, GeocacheCode text, lat real, lon real, DateLogged text)");
         dbcon.ExecuteNonQuery("create index idx_travels on travels (TrackableCode)");
     }
     o = dbcon.ExecuteScalar("SELECT name FROM sqlite_master WHERE type='table' AND name='logs'");
     if (o == null || o.GetType() == typeof(DBNull))
     {
         dbcon.ExecuteNonQuery("create table 'logs' (TrackableCode text, ID integer, LogCode text, GeocacheCode text, IsArchived integer, LoggedBy text, LogGuid text, LogIsEncoded integer, LogText text, WptLogTypeId integer, Url text, UTCCreateDate text, VisitDate text)");
         dbcon.ExecuteNonQuery("create index idx_logstb on logs (TrackableCode)");
         dbcon.ExecuteNonQuery("create index idx_logsid on logs (ID)");
     }
 }
Exemplo n.º 5
0
 private void initDatabase(Utils.DBCon dbcon)
 {
     object o = dbcon.ExecuteScalar("SELECT name FROM sqlite_master WHERE type='table' AND name='processedpq'");
     if (o == null || o.GetType() == typeof(DBNull))
     {
         dbcon.ExecuteNonQuery("create table 'processedpq' (pqname text, processdate text)");
     }
 }