当前位置: 首页>>代码示例>>C#>>正文


C# SqliteCommand.Dispose方法代码示例

本文整理汇总了C#中SqliteCommand.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# SqliteCommand.Dispose方法的具体用法?C# SqliteCommand.Dispose怎么用?C# SqliteCommand.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SqliteCommand的用法示例。


在下文中一共展示了SqliteCommand.Dispose方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CloseCommand

 protected void CloseCommand(SqliteCommand cmd)
 {
     cmd.Connection.Close();
     cmd.Connection.Dispose();
     cmd.Dispose();
 }
开发者ID:BackupTheBerlios,项目名称:seleon,代码行数:6,代码来源:SQLiteFramework.cs

示例2: InsertWithOnConflict

        public override long InsertWithOnConflict (String table, String nullColumnHack, ContentValues initialValues, ConflictResolutionStrategy conflictResolutionStrategy)
        {
            if (!String.IsNullOrWhiteSpace(nullColumnHack)) {
                var e = new InvalidOperationException("{0} does not support the 'nullColumnHack'.".Fmt(Tag));
                Log.E(Tag, "Unsupported use of nullColumnHack", e);
                throw e;
            }

            var command = GetInsertCommand(table, initialValues, conflictResolutionStrategy);

            var lastInsertedId = -1L;
            try {
                command.ExecuteNonQuery();

                // Get the new row's id.
                // TODO.ZJG: This query should ultimately be replaced with a call to sqlite3_last_insert_rowid.
                var lastInsertedIndexCommand = new SqliteCommand("select last_insert_rowid()", Connection, currentTransaction);
                lastInsertedId = (Int64)lastInsertedIndexCommand.ExecuteScalar();
                lastInsertedIndexCommand.Dispose();
                if (lastInsertedId == -1L) {
                    Log.E(Tag, "Error inserting " + initialValues + " using " + command.CommandText);
                } else {
                    Log.V(Tag, "Inserting row " + lastInsertedId + " from " + initialValues + " using " + command.CommandText);
                }
            } catch (Exception ex) {
                Log.E(Tag, "Error inserting into table " + table, ex);
            } finally {
                command.Dispose();
            }
            return lastInsertedId;
        }
开发者ID:jonlipsky,项目名称:couchbase-lite-net,代码行数:31,代码来源:MonoSQLiteStorageEngine.cs

示例3: CheckToken

        public bool CheckToken(UUID principalID, string token, int lifetime)
        {
            if (System.Environment.TickCount - m_LastExpire > 30000)
                DoExpire();

            SqliteCommand cmd = new SqliteCommand("update tokens set validity = datetime('now', 'localtime', '+" + lifetime.ToString() + 
                " minutes') where UUID = '" + principalID.ToString() + "' and token = '" + token + "' and validity > datetime('now', 'localtime')");

            if (ExecuteNonQuery(cmd, m_Connection) > 0)
            {
                cmd.Dispose();
                return true;
            }

            cmd.Dispose();

            return false;
        }
开发者ID:NickyPerian,项目名称:Aurora,代码行数:18,代码来源:SQLiteAuthenticationData.cs

示例4: DoExpire

        private void DoExpire()
        {
            SqliteCommand cmd = new SqliteCommand("delete from tokens where validity < datetime('now', 'localtime')");
            ExecuteNonQuery(cmd, m_Connection);

            cmd.Dispose();

            m_LastExpire = System.Environment.TickCount;
        }
开发者ID:NickyPerian,项目名称:Aurora,代码行数:9,代码来源:SQLiteAuthenticationData.cs

示例5: SetToken

        public bool SetToken(UUID principalID, string token, int lifetime)
        {
            if (System.Environment.TickCount - m_LastExpire > 30000)
                DoExpire();

            SqliteCommand cmd = new SqliteCommand("insert into tokens (UUID, token, validity) values ('" + principalID.ToString() + 
                "', '" + token + "', datetime('now', 'localtime', '+" + lifetime.ToString() + " minutes'))");

            if (ExecuteNonQuery(cmd, m_Connection) > 0)
            {
                cmd.Dispose();
                return true;
            }

            cmd.Dispose();
            return false;
        }
开发者ID:NickyPerian,项目名称:Aurora,代码行数:17,代码来源:SQLiteAuthenticationData.cs


注:本文中的SqliteCommand.Dispose方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。