Ejemplo n.º 1
0
        internal override string ColumnType(SqliteStatement stmt, int index, out TypeAffinity nAffinity)
        {
            lock (dbLock) {
                string result = null;
                nAffinity = TypeAffinity.Text;

                if (stmt != null && stmt._sqlite_stmt != null)
                {
                    result    = stmt._sqlite_stmt.DataType(index).ToString();
                    nAffinity = SqliteConvert.TypeToAffinity(SqliteConvert.DbTypeToType(SqliteConvert.TypeNameToDbType(result)));
                }

                return(result);
            }
        }
Ejemplo n.º 2
0
        internal override TypeAffinity ColumnAffinity(SqliteStatement stmt, int index)
        {
            lock (dbLock) {
                TypeAffinity result = TypeAffinity.Text;

                if (stmt != null && stmt._sqlite_stmt != null)
                {
                    result = SqliteConvert.TypeToAffinity(
                        SqliteConvert.DbTypeToType(
                            SqliteConvert.TypeNameToDbType(
                                stmt._sqlite_stmt.DataType(index).ToString())));
                }

                return(result);
            }
        }
Ejemplo n.º 3
0
        internal override SQLitePCL.SQLiteResult Step(SqliteStatement stmt)
        {
            lock (dbLock) {
                var result = SQLitePCL.SQLiteResult.ERROR;

                if (stmt != null && stmt._sqlite_stmt != null)
                {
                    result = stmt._sqlite_stmt.Step();
                    if (!_okResultMessages.Contains(result))
                    {
                        _lastError          = SqliteConvert.ToResultText(result);
                        _lastErrorStatement = stmt._sqlStatement ?? "(none)";
                        throw new Exception(_lastError);
                    }
                }

                return(result);
            }
        }
Ejemplo n.º 4
0
        internal override Tuple <SQLitePCL.SQLiteResult, long> StepWithRowId(SqliteStatement stmt)
        {
            lock (dbLock) {
                long rowid  = -1;
                var  result = Tuple.Create <SQLitePCL.SQLiteResult, long>(SQLitePCL.SQLiteResult.ERROR, rowid);

                if (stmt != null && stmt._sqlite_stmt != null)
                {
                    SQLitePCL.SQLiteResult stmtResult = stmt._sqlite_stmt.Step();
                    if (!_okResultMessages.Contains(stmtResult))
                    {
                        _lastError          = SqliteConvert.ToResultText(stmtResult);
                        _lastErrorStatement = stmt._sqlStatement ?? "(none)";
                        throw new Exception(_lastError);
                    }
                    rowid  = stmt._sql.LastInsertRowIdNoThreadLock;
                    result = Tuple.Create(stmtResult, rowid);
                }

                return(result);
            }
        }