Ejemplo n.º 1
0
        public static void Main()
        {
            SQLRConnection con = new SQLRConnection("sqlrserver", 9000, "/tmp/example.socket", "user", "password", 0, 1);
            SQLRCursor     cur = new SQLRCursor(con);

            cur.setResultSetBufferSize(5);

            cur.sendQuery("select * from my_table");

            Boolean done = false;
            UInt64  row  = 0;
            String  field;

            while (!done)
            {
                for (UInt32 col = 0; col< cur.colCount(); col++)
                {
                    field = cur.getField(row, col);
                    if (field != null)
                    {
                        Console.Write(field);
                        Console.Write(",");
                    }
                    else
                    {
                        done = true;
                    }
                }
                Console.Write("\n");
                row++;
            }

            cur.sendQuery("select * from my_other_table");
Ejemplo n.º 2
0
        public static void Main()
        {
            SQLRConnection con     = new SQLRConnection("sqlrserver", 9000, "/tmp/example.socket", "user", "password", 0, 1);
            SQLRCursor     cursor1 = new SQLRCursor(con);
            SQLRCursor     cursor2 = new SQLRCursor(con);

            cursor1.setResultSetBufferSize(10);
            cursor1.sendQuery("select * from my_huge_table");

            UInt64 index = 0;

            while (!cursor1.endOfResultSet())
            {
                cursor2.prepareQuery("insert into my_other_table values (:1,:2,:3)");
                cursor2.inputBind("1", cursor1.getField(index, 1));
                cursor2.inputBind("2", cursor1.getField(index, 2));
                cursor2.inputBind("3", cursor1.getField(index, 3));
                cursor2.executeQuery();
            }
        }
Ejemplo n.º 3
0
        public static void Main()
        {
            SQLRConnection con = new SQLRConnection("sqlrserver", 9000, "/tmp/example.socket", "user", "password", 0, 1);
            SQLRCursor     cur = new SQLRCursor(con);

            cur.sendQuery("select * from my_table");
            con.endSession();

            for (UInt64 row = 0; row< cur.rowCount(); row++)
            {
                for (UInt32 col = 0; col< cur.colCount(); col++)
                {
                    Console.Write(cur.getField(row, col));
                    Console.Write(",");
                }
                Console.Write("\n");
            }
        }
Ejemplo n.º 4
0
        public static void Main()
        {
            SQLRConnection sqlrcon = new SQLRConnection(
                "examplehost", 9000,
                "/tmp/example.socket",
                "exampleuser",
                "examplepassword",
                0, 1);
            SQLRCursor sqlrcur = new SQLRCursor(sqlrcon);

            sqlrcur.sendQuery("select * from exampletable");
            for (UInt64 row = 0; row < sqlrcur.rowCount(); row++)
            {
                for (UInt64 col = 0; col < sqlrcur.colCount(); col++)
                {
                    Console.WriteLine(sqlrcur.getField(row, col) + ",");
                }
                Console.WriteLine();
            }
        }
Ejemplo n.º 5
0
        public static void Main()
        {
            SQLRConnection con = new SQLRConnection("sqlrserver", 9000, "/tmp/example.socket", "user", "password", 0, 1);
            SQLRCursor     cur = new SQLRCursor(con);

            cur.prepareQuery("begin  :curs:=sp_mytable; end;");
            cur.defineOutputBindCursor("curs");
            cur.executeQuery();

            SQLRCursor bindcur = cur.getOutputBindCursor("curs");

            bindcur.fetchFromBindCursor();

            // print fields from table
            for (int i = 0; i&lt; bindcur.rowCount(); i++)
            {
                for (int j = 0; j&lt; bindcur.colCount(); j++)
                {
                    Console.Write(bindcur.getField(i, j));
                    Console.Write(", ");
                }
                Console.Write("\n");
            }
        }