Exemplo n.º 1
0
        /**
         * Method declaration
         *
         *
         * @return
         *
         * @throws Exception
         */
        public Node getLeft()
        {
            if (Trace.ASSERT)
            {
                Trace.assert(iBalance != -2);
            }

            if (iLeft == 0)
            {
                return(nLeft);
            }

            // rData.iLastAccess=Row.iCurrentAccess++;
            return(rData.getNode(iLeft, iId));
        }
Exemplo n.º 2
0
        /**
         * Method declaration
         *
         *
         * @param s
         *
         * @throws Exception
         */
        public void setIndexRoots(string s)
        {
            // the user may try to set this; this is not only internal problem
            Trace.check(bCached, Trace.TABLE_NOT_FOUND);

            int j = 0;

            for (int i = 0; i < iIndexCount; i++)
            {
                int n = s.IndexOf(' ', j);
                int p = s.Substring(j, n).ToInt32();

                if (p != -1)
                {
                    Row  r = cCache.getRow(p, this);
                    Node f = r.getNode(i);

                    getIndex(i).setRoot(f);
                }

                j = n + 1;
            }

            iIdentityId = s.Substring(j).ToInt32();
        }
Exemplo n.º 3
0
        /**
         * Method declaration
         *
         *
         * @param pos
         * @param index
         *
         * @return
         *
         * @throws Exception
         */
        public Node getNode(int pos, int index)
        {
            // return getRow(pos).getNode(index);
            Row r = tTable.cCache.getRow(pos, tTable);

            r.iLastAccess = iCurrentAccess++;

            return(r.getNode(index));
        }
Exemplo n.º 4
0
        /**
         * Method declaration
         *
         *
         * @param row
         * @param c
         * @param log
         *
         * @throws Exception
         */
        public void insertNoCheck(object[] row, Channel c,
			bool log)
        {
            int i;

            if (iIdentityColumn != -1)
            {
                if (row[iIdentityColumn] == null)
                {
                    if (c != null)
                    {
                        c.setLastIdentity(iIdentityId);
                    }

                    row[iIdentityColumn] = iIdentityId++;
                }
                else
                {
                    i = (int) row[iIdentityColumn];

                    if (iIdentityId <= i)
                    {
                        if (c != null)
                        {
                            c.setLastIdentity(i);
                        }

                        iIdentityId = i + 1;
                    }
                }
            }

            for (i = 0; i < iColumnCount; i++)
            {
                if (row[i] == null &&!getColumn(i).isNullable())
                {
                    throw Trace.error(Trace.TRY_TO_INSERT_NULL);
                }
            }

            try
            {
                Row r = new Row(this, row);

                for (i = 0; i < iIndexCount; i++)
                {
                    Node n = r.getNode(i);

                    getIndex(i).insert(n);
                }
            }
            catch (Exception e)
            {    // rollback insert
                for (--i; i >= 0; i--)
                {
                    getIndex(i).delete(row, i == 0);
                }

                throw e;		      // and throw error again
            }

            if (c != null)
            {
                c.addTransactionInsert(this, row);
            }

            if (lLog != null)
            {
                lLog.write(c, getInsertStatement(row));
            }
        }
Exemplo n.º 5
0
        /**
         * Method declaration
         *
         *
         * @param row
         * @param c
         * @param log
         *
         * @throws Exception
         */
        public void insertNoCheck(object[] row, Channel c,
                                  bool log)
        {
            int i;

            if (iIdentityColumn != -1)
            {
                if (row[iIdentityColumn] == null)
                {
                    if (c != null)
                    {
                        c.setLastIdentity(iIdentityId);
                    }

                    row[iIdentityColumn] = iIdentityId++;
                }
                else
                {
                    i = (int)row[iIdentityColumn];

                    if (iIdentityId <= i)
                    {
                        if (c != null)
                        {
                            c.setLastIdentity(i);
                        }

                        iIdentityId = i + 1;
                    }
                }
            }

            for (i = 0; i < iColumnCount; i++)
            {
                if (row[i] == null && !getColumn(i).isNullable())
                {
                    throw Trace.error(Trace.TRY_TO_INSERT_NULL);
                }
            }

            try
            {
                Row r = new Row(this, row);

                for (i = 0; i < iIndexCount; i++)
                {
                    Node n = r.getNode(i);

                    getIndex(i).insert(n);
                }
            }
            catch (Exception e)
            {                // rollback insert
                for (--i; i >= 0; i--)
                {
                    getIndex(i).delete(row, i == 0);
                }

                throw e;                                      // and throw error again
            }

            if (c != null)
            {
                c.addTransactionInsert(this, row);
            }

            if (lLog != null)
            {
                lLog.write(c, getInsertStatement(row));
            }
        }