本文整理汇总了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);
}
}
示例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;
}
}
}
示例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);
}
}
示例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;
}
示例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;
}
示例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
{
//.........这里部分代码省略.........
示例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;
}