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


C# SqliteDataReader.GetName方法代码示例

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


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

示例1: readRow

 JObject readRow(SqliteDataReader r, string sql)
 {
     try {
         lock (_lock) {
             if (!r.Read()) return null;
         }
         JObject row = new JObject();
         for (int i = 0; i < r.FieldCount; i++) {
             row.Add(Regex.Replace(r.GetName(i), @"^.*\.", ""), r[i].ToJToken());
         }
         return row;
     } catch (Exception ex) {
         throw new DatabaseException(ex, sql);
     }
 }
开发者ID:nikkilocke,项目名称:AccountServer,代码行数:15,代码来源:SQLiteDatabase.cs

示例2: Transfer

        /// <summary>
        /// Transfere dados do banco de dados atual para um banco de dados de destino.
        /// Conexão com o banco de destino precisa estar aberta.
        /// </summary>
        /// <returns>Número de linhas transferidas.</returns>
        /// <param name="p_query">Consulta SQL para buscar os dados no banco atual.</param>
        /// <param name="p_insert">Comando de inserção para inserir cada linha no banco de destino.</param>
        /// <param name="p_destdatabase">Conexão com o banco de destino.</param>
        public override uint Transfer(string p_query, Spartacus.Database.Command p_insert, Spartacus.Database.Generic p_destdatabase)
        {
            uint v_transfered = 0;

            try
            {
                this.v_cmd.CommandText = p_query;
                this.v_reader = this.v_cmd.ExecuteReader();

                while (v_reader.Read())
                {
                    for (int i = 0; i < v_reader.FieldCount; i++)
                        p_insert.SetValue(this.FixColumnName(v_reader.GetName(i)).ToLower(), v_reader[i].ToString());

                    p_destdatabase.Execute(p_insert.GetUpdatedText());
                    v_transfered++;
                }

                return v_transfered;
            }
            catch (Mono.Data.Sqlite.SqliteException e)
            {
                throw new Spartacus.Database.Exception(e);
            }
            finally
            {
                if (this.v_reader != null)
                {
                    this.v_reader.Close();
                    this.v_reader = null;
                }
            }
        }
开发者ID:lubota,项目名称:spartacus,代码行数:41,代码来源:Spartacus.Database.Memory.cs

示例3: ReadAllRows

        private void ReadAllRows (SqliteDataReader reader)
        {
            int ii, field_count = reader.FieldCount;

            /* Metadata */
            records_affected = reader.RecordsAffected;

            decltypes = new string[field_count];
            for (ii = 0; ii < field_count; ii++) {
                    decltypes[ii] = reader.GetDataTypeName (ii);
            }

            columns = new string[field_count];
            for (ii = 0; ii < field_count; ii++) {
                    string column_name = reader.GetName (ii);
                    columns[ii] = column_name;
                    column_names[column_name] = ii;
                    column_names[column_name.ToUpper ()] = ii;
            }

            /* Read all rows, store in this->rows */
            while (reader.Read ()) {
                object[] data_row = new object[field_count];
                for (ii = 0; ii < field_count; ii++) {
                        object value = reader.GetValue (ii);
                        if (Convert.IsDBNull (value))
                            value = null;
                        data_row[ii] = value;
                }

                rows.Add (data_row);
            }
        }
开发者ID:rubenv,项目名称:tripod,代码行数:33,代码来源:HyenaSqliteArrayDataReader.cs

示例4: LoadCrlRecord

        X509CrlRecord LoadCrlRecord(SqliteDataReader reader, X509CrlParser parser, ref byte[] buffer)
        {
            var record = new X509CrlRecord ();

            for (int i = 0; i < reader.FieldCount; i++) {
                switch (reader.GetName (i)) {
                case "CRL":
                    record.Crl = DecodeX509Crl (reader, parser, i, ref buffer);
                    break;
                case "THISUPDATE":
                    record.ThisUpdate = reader.GetDateTime (i);
                    break;
                case "NEXTUPDATE":
                    record.NextUpdate = reader.GetDateTime (i);
                    break;
                case "DELTA":
                    record.IsDelta = reader.GetBoolean (i);
                    break;
                case "ID":
                    record.Id = reader.GetInt32 (i);
                    break;
                }
            }

            return record;
        }
开发者ID:vdaron,项目名称:MimeKit,代码行数:26,代码来源:X509CertificateDatabase.cs

示例5: LoadCertificateRecord

        X509CertificateRecord LoadCertificateRecord(SqliteDataReader reader, X509CertificateParser parser, ref byte[] buffer)
        {
            var record = new X509CertificateRecord ();

            for (int i = 0; i < reader.FieldCount; i++) {
                switch (reader.GetName (i)) {
                case "CERTIFICATE":
                    record.Certificate = DecodeCertificate (reader, parser, i, ref buffer);
                    break;
                case "PRIVATEKEY":
                    record.PrivateKey = DecodePrivateKey (reader, i, ref buffer);
                    break;
                case "ALGORITHMS":
                    record.Algorithms = DecodeEncryptionAlgorithms (reader, i);
                    break;
                case "ALGORITHMSUPDATED":
                    record.AlgorithmsUpdated = reader.GetDateTime (i);
                    break;
                case "TRUSTED":
                    record.IsTrusted = reader.GetBoolean (i);
                    break;
                case "ID":
                    record.Id = reader.GetInt32 (i);
                    break;
                }
            }

            return record;
        }
开发者ID:vdaron,项目名称:MimeKit,代码行数:29,代码来源:X509CertificateDatabase.cs

示例6: Transfer

        /// <summary>
        /// Transfere dados do banco de dados atual para um banco de dados de destino.
        /// Conexão com o banco de destino precisa estar aberta.
        /// Não pára a execução se der um problema num comando de inserção específico.
        /// </summary>
        /// <returns>Número de linhas transferidas.</returns>
        /// <param name="p_query">Consulta SQL para buscar os dados no banco atual.</param>
        /// <param name="p_insert">Comando de inserção para inserir cada linha no banco de destino.</param>
        /// <param name="p_destdatabase">Conexão com o banco de destino.</param>
        /// <param name="p_log">Log de inserção.</param>
        public override uint Transfer(string p_query, Spartacus.Database.Command p_insert, Spartacus.Database.Generic p_destdatabase, out string p_log)
        {
            uint v_transfered = 0;
            string v_insert;

            p_log = "";

            if (this.v_con == null)
            {
                try
                {
                    this.v_con = new Mono.Data.Sqlite.SqliteConnection(this.v_connectionstring);
                    this.v_con.Open();
                    this.v_cmd = new Mono.Data.Sqlite.SqliteCommand(p_query, this.v_con);
                    this.v_reader = this.v_cmd.ExecuteReader();

                    while (v_reader.Read())
                    {
                        for (int i = 0; i < v_reader.FieldCount; i++)
                            p_insert.SetValue(this.FixColumnName(v_reader.GetName(i)).ToLower(), v_reader[i].ToString());

                        v_insert = p_insert.GetUpdatedText();
                        try
                        {
                            p_destdatabase.Execute(v_insert);
                            v_transfered++;
                        }
                        catch (Spartacus.Database.Exception e)
                        {
                            p_log += v_insert + "\n" + e.v_message + "\n";
                        }
                    }

                    return v_transfered;
                }
                catch (Mono.Data.Sqlite.SqliteException e)
                {
                    throw new Spartacus.Database.Exception(e);
                }
                finally
                {
                    if (this.v_reader != null)
                    {
                        this.v_reader.Close();
                        this.v_reader = null;
                    }
                    if (this.v_cmd != null)
                    {
                        this.v_cmd.Dispose();
                        this.v_cmd = null;
                    }
                    if (this.v_con != null)
                    {
                        this.v_con.Close();
                        this.v_con = null;
                    }
                }
            }
            else
            {
                try
                {
                    this.v_cmd.CommandText = p_query;
                    this.v_reader = this.v_cmd.ExecuteReader();

                    while (v_reader.Read())
                    {
                        for (int i = 0; i < v_reader.FieldCount; i++)
                            p_insert.SetValue(this.FixColumnName(v_reader.GetName(i)).ToLower(), v_reader[i].ToString());

                        v_insert = p_insert.GetUpdatedText();
                        try
                        {
                            p_destdatabase.Execute(v_insert);
                            v_transfered++;
                        }
                        catch (Spartacus.Database.Exception e)
                        {
                            p_log += v_insert + "\n" + e.v_message + "\n";
                        }
                    }

                    return v_transfered;
                }
                catch (Mono.Data.Sqlite.SqliteException e)
                {
                    throw new Spartacus.Database.Exception(e);
                }
                finally
                {
//.........这里部分代码省略.........
开发者ID:lubota,项目名称:spartacus,代码行数:101,代码来源:Spartacus.Database.Sqlite.cs

示例7: ExecuteQuery

        /// <summary>
        /// Executes the query.
        /// </summary>
        /// <returns>The query.</returns>
        /// <param name="query">Query.</param>
        public DataTable ExecuteQuery(string query)
        {
            if (!canQuery) {
                HDebug.LogWarning ("Can't execute the query, verify DB origin file");
                return null;
            }

            if (!isConnectionOpen) {
                Open (pathDB);
            }

            #if !UNITY_WEBPLAYER
            if ((ConnectionState)dbconn.State != ConnectionState.Open) {
                HDebug.LogWarning ("Sqlite DB is not open");
                return null;
            }

            dbcmd.CommandText = query;
            try {
                reader = dbcmd.ExecuteReader ();
            } catch (Exception e) {
                HDebug.Log ("Query : " + query);
                HDebug.LogError (e.Message);
                return null;
            }
            #endif

            DataTable dataTable = new DataTable ();

            #if !UNITY_WEBPLAYER
            for (int i = 0; i < reader.FieldCount; i++) {
                dataTable.Columns.Add (reader.GetName (i));
            }

            while (reader.Read ()) {
                DataRow row = new DataRow ();
                for (int i = 0; i < reader.FieldCount; i++) {
                    row.Add (reader.GetName (i), reader.GetValue (i));
                }

                dataTable.Rows.Add (row);
            }
            #endif

            if (!isConnectionOpen) {
                Close ();
            }

            return dataTable;
        }
开发者ID:namseungngil,项目名称:HellgateFramework,代码行数:55,代码来源:Sqlite.cs


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