void BindParam(IDataParameter param) { NativeParameter nParam = (NativeParameter)param; if (nParam.Index == -1) { BindIndex(nParam); } int code = 0; switch (nParam.type) { case DbType.AnsiStringFixedLength: code = sqlite3_bind_text(Statement, nParam.Index, nParam.StringPtr, nParam.StringCount - 1, IntPtr.Zero); break; case DbType.UInt16: code = sqlite3_bind_int(Statement, nParam.Index, nParam.U16Value); break; case DbType.Byte: code = sqlite3_bind_int(Statement, nParam.Index, nParam.U8Value); break; case DbType.Boolean: code = sqlite3_bind_int(Statement, nParam.Index, nParam.BoolValue ? 1 : 0); break; } if (code > 0) { throw new NativeException(code); } }
public override IDataParameter CreateParam(string paramName, DbType type) { IDataParameter param = new NativeParameter(); param.ParameterName = paramName; param.DbType = type; return(param); }
void BindIndex(NativeParameter nParam) { byte[] name = NativeUtils.MakeUTF8(nParam.ParameterName); nParam.Index = sqlite3_bind_parameter_index(Statement, name); }