本文整理汇总了C#中Mono.Data.Sqlite.SqliteDataReader.GetInt32方法的典型用法代码示例。如果您正苦于以下问题:C# SqliteDataReader.GetInt32方法的具体用法?C# SqliteDataReader.GetInt32怎么用?C# SqliteDataReader.GetInt32使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.Data.Sqlite.SqliteDataReader
的用法示例。
在下文中一共展示了SqliteDataReader.GetInt32方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BlockData
public BlockData(SqliteDataReader reader)
{
ID = reader.GetInt32(0);
File = reader.GetString(1);
Width = reader.GetInt32(2);
Height = reader.GetInt32(3);
AvailableWidth = reader.GetInt32(4);
AvailableHeight = reader.GetInt32(5);
}
示例2: InitCards
private static void InitCards(SQLiteDataReader reader)
{
while (reader.Read())
{
int id = reader.GetInt32(0);
CardData card = new CardData(id)
{
AliasId = reader.GetInt32(1),
Type = reader.GetInt32(2),
Level = reader.GetInt32(3),
Race = reader.GetInt32(4),
Attribute = reader.GetInt32(5),
Atk = reader.GetInt32(6),
Def = reader.GetInt32(7),
Name = reader.GetString(8),
Description = reader.GetString(9)
};
m_cards.Add(id, card);
}
}
示例3: GetMonsterData
static public MonsterData GetMonsterData(int id)
{
string query = "SELECT * FROM MONSTER where id = " + id;
reader = ExecuteQuery(query);
MonsterData monster = new MonsterData();
if (reader.Read())
{
monster.id = reader.GetInt32(0);
monster.name = reader.GetString(1);
monster.hp = reader.GetFloat(2);
monster.attack = reader.GetFloat(3);
monster.defence = reader.GetFloat(4);
monster.gold = reader.GetInt32(5);
}
reader.Dispose();
return monster;
}
示例4: GetTaskCoreFromCursor
/// <summary>
/// Gets the taskcore object from the sqlite cursor
/// </summary>
/// <param name="cursor">
/// A <see cref="SqliteDataReader"/>. This won't be traversed, must be
/// called each time the cursor moves ahead
/// </param>
/// <returns>
/// A <see cref="TaskCore"/> - allocated and re-created
/// Returns null if reading failed
/// </returns>
public static TaskCore GetTaskCoreFromCursor(SqliteDataReader cursor)
{
// this assumes a single task exists
// the task to be extracted from the cursor
TaskCore task = new TaskCore ();
try {
task.Id = cursor.GetInt32 (cursor.GetOrdinal ("TaskId"));
task.Depends = cursor.GetInt32 (cursor.GetOrdinal ("Depends"));
task.Title = cursor.GetString (cursor.GetOrdinal ("Name"));
task.Description = cursor.GetString (cursor.GetOrdinal ("Description"));
task.Priority = cursor.GetInt32 (cursor.GetOrdinal ("Priority"));
task.DueDate = cursor.GetDateTime (cursor.GetOrdinal ("DueDate"));
task.CreateDate = cursor.GetDateTime (cursor.GetOrdinal ("CreateDate"));
} catch {
log.ERROR ("Reading from cursor failed");
return null;
}
// now, extract the comments.
SqliteCommand cmd = new SqliteCommand (conn);
cmd.CommandText = String.Format ("SELECT * FROM Comments WHERE (TaskId = {0});", task.Id);
log.WARN ("Trying to read comments with query - " + cmd.CommandText);
SqliteDataReader commentCursor = cmd.ExecuteReader ();
while (commentCursor.Read ()) {
CommentData comment = new CommentData ();
try {
comment.Id = commentCursor.GetInt32 (commentCursor.GetOrdinal ("CommentID"));
comment.TaskId = commentCursor.GetInt32 (commentCursor.GetOrdinal ("TaskId"));
comment.Title = commentCursor.GetString (commentCursor.GetOrdinal ("Subject"));
comment.Author = commentCursor.GetString (commentCursor.GetOrdinal ("Author"));
comment.Content = commentCursor.GetString (commentCursor.GetOrdinal ("Message"));
comment.PostDate = commentCursor.GetDateTime (commentCursor.GetOrdinal ("PostDate"));
log.DEBUG ("Extracted comment - " + comment.ToString ());
} catch {
log.ERROR ("Something went wrong while retrieving comment");
return null;
}
task.Comments.Add (comment);
}
log.DEBUG ("Extracted task as : " + task.ToString ());
return task;
}
示例5: Deserialize
public void Deserialize(SqliteDataReader reader)
{
this.FullName = reader.GetString (0) as String;
this.FileName = reader.GetString (1) as String;
this.LineNumber = reader.GetInt32 (2);
this.ItemType = (ParserItemType)reader.GetInt32 (3);
var docValue = reader.GetValue (4);
if (docValue.GetType () == typeof (String))
this.Documentation = (string)docValue;
var extraValue = reader.GetValue (5);
if (extraValue.GetType () == typeof (string))
this.Extra = (string)extraValue;
}
示例6: 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;
}
示例7: 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;
}
示例8: DataReturn
/// <summary>
/// 返回一個資料串
/// </summary>
public string DataReturn(SqliteDataReader data)
{
string database = "";
for (int i = 0; i < data.FieldCount; i++) {
// 資料是否為空
switch (data.IsDBNull(i)) {
case true:
switch (data.GetDataTypeName(i)){
case "TEXT":
database += "" + ",";
break;
case "INTEGER":
database += "" + 0 + ",";
break;
case "REAL":
database += "" + 0 + ",";
break;
default:
Debug.LogError("類型缺失");
return database;
}
break;
case false:
switch (data.GetDataTypeName(i)) {
case "TEXT":
database += data.GetString(i) + ",";
break;
case "INTEGER":
database += "" + data.GetInt32(i) + ",";
break;
case "REAL":
database += "" + data.GetFloat(i) + ",";
break;
default:
Debug.LogError("類型缺失");
return database;
}
break;
}
}
return database;
}
示例9: RecordFromReader
private static Record RecordFromReader(SqliteDataReader reader)
{
return new Record(
reader.GetString(RecordColumns.KEY_IDX),
reader.IsDBNull(RecordColumns.VALUE_IDX) ? null : reader.GetString(RecordColumns.VALUE_IDX),
reader.GetInt32(RecordColumns.SYNC_COUNT_IDX),
new DateTime(long.Parse(reader.GetString(RecordColumns.LAST_MODIFIED_TIMESTAMP_IDX), CultureInfo.InvariantCulture.NumberFormat), DateTimeKind.Utc),
reader.IsDBNull(RecordColumns.LAST_MODIFIED_BY_IDX) ? string.Empty : reader.GetString(RecordColumns.LAST_MODIFIED_BY_IDX),
new DateTime(long.Parse(reader.GetString(RecordColumns.DEVICE_LAST_MODIFIED_TIMESTAMP_IDX), CultureInfo.InvariantCulture.NumberFormat), DateTimeKind.Utc),
reader.GetInt32(RecordColumns.MODIFIED_IDX) == 1);
}
示例10: DatasetMetadataFromReader
private static DatasetMetadata DatasetMetadataFromReader(SqliteDataReader reader)
{
return new DatasetMetadata(
reader.GetString(DatasetColumns.DATASET_NAME_IDX) ?? string.Empty,
new DateTime(long.Parse(reader.GetString(DatasetColumns.CREATION_TIMESTAMP_IDX), CultureInfo.InvariantCulture.NumberFormat), DateTimeKind.Utc),
new DateTime(long.Parse(reader.GetString(DatasetColumns.LAST_MODIFIED_TIMESTAMP_IDX), CultureInfo.InvariantCulture.NumberFormat), DateTimeKind.Utc),
reader.IsDBNull(DatasetColumns.LAST_MODIFIED_BY_IDX) ? string.Empty : reader.GetString(DatasetColumns.LAST_MODIFIED_BY_IDX),
reader.GetInt32(DatasetColumns.STORAGE_SIZE_BYTES_IDX),
reader.GetInt32(DatasetColumns.RECORD_COUNT_IDX));
}
示例11: CheckUserLogin
public int CheckUserLogin(string username, string password)
{
string sql = "select password,uid,reg_time from user_info where username = '" + username+"'";
reader=ExecuteQuery(sql);
if (reader.HasRows)
{
if (reader.Read ()) {
string cryptopassword = reader.GetString (0);
int uid = reader.GetInt32 (1);
int reg_time = reader.GetInt32 (2);
if (cryptopassword == password && password !="") {
User.Instance().ResetUser();
User.Instance().InitUser(username,password,uid,reg_time);
return 1;
}
}
}
return -1;
}
示例12: GetUserDefineData
//.........这里部分代码省略.........
}
}
} else {
var temp = sql.Split(new String[]{"select"},StringSplitOptions.RemoveEmptyEntries);
var temp1 = temp [0];
var temp2 = temp1.Split (new String[]{"from"},StringSplitOptions.RemoveEmptyEntries);
var temp3 = temp2 [0].Split (',');
int leng_t3 = temp3.Length;
for (int c=0;c<leng_t3;c++){
tablehead [c] = temp3 [c];
}
}
}else{
//update of delete
if (sql.Contains ("update")) {
reader = ExecuteQuery (sql);
throw new Exception ("update affected "+reader.RecordsAffected+" rows");
} else if(sql.Contains("delete")){
reader = ExecuteQuery (sql);
throw new Exception ("delete affected "+ reader.RecordsAffected +" rows");
}else if (sql.Contains("insert")){
//insert
Exception e= null;
try{
ExecuteQuery(sql,false);
}catch(Exception e1){
e = e1;
throw e;
}finally{
if (e == null) {
throw new Exception ("insert success!");
}
}
}else if (sql.Contains("create")){
//create
Exception e = null;
try{
ExecuteQuery(sql,false);
}catch(Exception e2){
e = e2;
throw e;
}finally{
if (e == null) {
throw new Exception ("create new table success!");
}
}
}else if (sql.Contains("drop")){
Exception e = null;
try{
ExecuteQuery(sql,false);
}catch(Exception e3){
e = e3;
throw e;
}finally{
if(e == null){
throw new Exception ("drop table success!");
}
}
}
}
//get user self define data
getDbData = new Hashtable();
//table head
reader = ExecuteQuery (sql);
if (reader.HasRows){
int i = 0;
while(reader.Read()){
Hashtable temp = new Hashtable ();
for (int j =0;j<reader.FieldCount;j++){
Type t =reader.GetFieldType (j);
if(t == typeof(Int32)){
var val = reader.GetInt32 (j);
temp [j] = val;
}
if (t == typeof(Int64)) {
var val = reader.GetInt64 (j);
temp [j] = val;
}
if (t == typeof(Double)) {
var val = reader.GetFloat (j);
temp [j] = val;
}
if (t == typeof(String)) {
var val = reader.GetString (j);
temp [j] = val;
}
}
getDbData.Add (i, temp);
i++;
}
}
GameWorld.getInstance ().errorData.PushTextTable (tablehead);
return getDbData;
}
示例13: GetCountYearTypeData
public Hashtable GetCountYearTypeData(){
//get year type count
getDbData = new Hashtable();
string sql = "SELECT record_year,money_class,pay_type,sum(pay_value) from money_record WHERE uid = "+User.Instance().GetUid()+" GROUP BY record_year,money_class,pay_type ORDER BY record_year,money_class,pay_type";
//set table head
Hashtable tablehead = new Hashtable();
tablehead[0] = "year";
tablehead[1] = "money_class";
tablehead[2] = "pay_type";
tablehead[3] = "count_value";
GameWorld.getInstance().errorData.PushTextTable(tablehead);
reader = ExecuteQuery (sql);
if (reader.HasRows){
int i = 0;
while(reader.Read()){
Hashtable temp = new Hashtable ();
int year = reader.GetInt32 (0);
int money_class = reader.GetInt32 (1);
string money_class_str = GameWorld.getInstance().errorData.GetMoneyTypeStr(money_class);
int pay_type = reader.GetInt32 (2);
string pay_type_str = GameWorld.getInstance().errorData.GetPayTypeStr(pay_type);
float sum_pay = reader.GetFloat (3);
temp [0] = year;
temp [1] = money_class_str;
temp [2] = pay_type_str;
temp [3] = sum_pay;
getDbData.Add (i, temp);
i++;
}
}
return getDbData;
}
示例14: GetCurrentMoneyRecord
public Hashtable GetCurrentMoneyRecord(int uid){
//get current user money record
getDbData = new Hashtable();
string sql = "select id,record_year,record_month,record_day,money_class,pay_type,pay_value,msg,insert_time from money_record where uid = "+uid;
Hashtable tablehead = new Hashtable();
tablehead[0] = "seq";
tablehead[1] = "record_time";
tablehead[2] = "money_class";
tablehead[3] = "pay_type";
tablehead[4] = "pay_value";
tablehead[5] = "msg";
tablehead[6] = "datetime";
GameWorld.getInstance().errorData.PushTextTable(tablehead);
reader = ExecuteQuery (sql);
if (reader.HasRows) {
//has records
int i = 0;
while(reader.Read()){
int id = reader.GetInt32 (0);
int record_year = reader.GetInt32 (1);
int record_month = reader.GetInt32 (2);
int record_day = reader.GetInt32 (3);
int money_class = reader.GetInt32 (4);
string money_class_str = GameWorld.getInstance().errorData.GetMoneyTypeStr(money_class);
int pay_type = reader.GetInt32 (5);
string pay_type_str = GameWorld.getInstance().errorData.GetPayTypeStr(pay_type);
float pay_value = reader.GetFloat (6);
string msg = reader.GetString (7);
int insert_time = reader.GetInt32 (8);
string insert_time_str = Utils.GetTimeStr(insert_time).ToString();
string record_time = record_year + "/" + record_month + "/" + record_day;
Hashtable temp = new Hashtable();
temp[0] = id;
temp[1] = record_time;
temp[2] = money_class_str;
temp[3] = pay_type_str;
temp[4] = pay_value;
temp[5] = msg;
temp[6] = insert_time_str;
getDbData.Add(i, temp);
i++;
}
}
return getDbData;
}
示例15: GetItemData
static public ItemData GetItemData(int id)
{
string query = "SELECT * FROM ITEM where id = " + id;
reader = ExecuteQuery(query);
ItemData item = new ItemData();
if (reader.Read())
{
item.id = reader.GetInt32(0);
item.name = reader.GetString(1);
item.addHp = reader.GetFloat(2);
item.addAttack = reader.GetFloat(3);
item.addDefence = reader.GetFloat(4);
item.addGold = reader.GetInt32(5);
}
reader.Dispose();
return item;
}