📄 sqlitedatareader.cs
字号:
SQLiteStatement stmt = null;
Label_0008:
if ((this._activeStatement != null) && (stmt == null))
{
this._activeStatement._sql.Reset(this._activeStatement);
if ((this._commandBehavior & CommandBehavior.SingleResult) != CommandBehavior.Default)
{
while (true)
{
stmt = this._command.GetStatement(this._activeStatementIndex + 1);
if (stmt == null)
{
return false;
}
this._activeStatementIndex++;
stmt._sql.Step(stmt);
if (stmt._sql.ColumnCount(stmt) == 0)
{
if (this._rowsAffected == -1)
{
this._rowsAffected = 0;
}
this._rowsAffected += stmt._sql.Changes;
}
stmt._sql.Reset(stmt);
}
}
}
stmt = this._command.GetStatement(this._activeStatementIndex + 1);
if (stmt == null)
{
return false;
}
if (this._readingState < 1)
{
this._readingState = 1;
}
this._activeStatementIndex++;
int num = stmt._sql.ColumnCount(stmt);
if (((this._commandBehavior & CommandBehavior.SchemaOnly) == CommandBehavior.Default) || (num == 0))
{
if (stmt._sql.Step(stmt))
{
this._readingState = -1;
}
else
{
if (num == 0)
{
if (this._rowsAffected == -1)
{
this._rowsAffected = 0;
}
this._rowsAffected += stmt._sql.Changes;
stmt._sql.Reset(stmt);
goto Label_0008;
}
this._readingState = 1;
}
}
this._activeStatement = stmt;
this._fieldCount = num;
this._fieldTypeArray = null;
return true;
}
public bool Read()
{
this.CheckClosed();
if (this._readingState == -1)
{
this._readingState = 0;
return true;
}
if (this._readingState == 0)
{
if (this._activeStatement._sql.Step(this._activeStatement))
{
return true;
}
this._readingState = 1;
}
return false;
}
private TypeAffinity VerifyType(int i, DbType typ)
{
this.CheckClosed();
this.CheckValidRow();
TypeAffinity affinity = this._activeStatement._sql.ColumnAffinity(this._activeStatement, i);
switch (affinity)
{
case TypeAffinity.Int64:
if (typ != DbType.Int16)
{
if (typ != DbType.Int32)
{
if (typ == DbType.Int64)
{
return affinity;
}
if (typ == DbType.Boolean)
{
return affinity;
}
if (typ == DbType.Byte)
{
return affinity;
}
if ((typ == DbType.DateTime) && (this._command.Connection._sql._datetimeFormat == SQLiteDateFormats.Ticks))
{
return affinity;
}
if (typ == DbType.Single)
{
return affinity;
}
if (typ == DbType.Double)
{
return affinity;
}
if (typ != DbType.Decimal)
{
break;
}
}
return affinity;
}
return affinity;
case TypeAffinity.Double:
if (typ != DbType.Single)
{
if ((typ != DbType.Double) && (typ != DbType.Decimal))
{
break;
}
return affinity;
}
return affinity;
case TypeAffinity.Text:
if (typ != DbType.SByte)
{
if (typ != DbType.String)
{
if (typ == DbType.SByte)
{
return affinity;
}
if (typ == DbType.Guid)
{
return affinity;
}
if (typ != DbType.DateTime)
{
break;
}
}
return affinity;
}
return affinity;
case TypeAffinity.Blob:
if (typ != DbType.Guid)
{
if (typ == DbType.String)
{
return affinity;
}
if (typ == DbType.Binary)
{
return affinity;
}
break;
}
return affinity;
}
throw new InvalidCastException();
}
public int Depth
{
get
{
this.CheckClosed();
return 0;
}
}
public int FieldCount
{
get
{
this.CheckClosed();
return this._fieldCount;
}
}
public bool HasRows
{
get
{
this.CheckClosed();
return (this._readingState != 1);
}
}
public bool IsClosed
{
get
{
return (this._command == null);
}
}
public object this[string name]
{
get
{
return this.GetValue(this.GetOrdinal(name));
}
}
public object this[int i]
{
get
{
return this.GetValue(i);
}
}
public int RecordsAffected
{
get
{
return this._rowsAffected;
}
}
public int VisibleFieldCount
{
get
{
this.CheckClosed();
return this._fieldCount;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -