Exemple #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");
Exemple #2
0
        public static void Main()
        {
            SQLRConnection con = new SQLRConnection("sqlrserver", 9000, "/tmp/example.socket", "user", "password", 0, 1);
            SQLRCursor     cur = new SQLRCursor(con);

            // column names will be forced to upper case
            cur.upperCaseColumnNames();
            cur.sendQuery("select * from my_table");
            con.endSession();

            for (UInt32 i = 0; i< cur.colCount(); i++)
            {
                Console.Write("Name:          ");
                Console.WriteLine(getColumnName(i));
                Console.Write("\n");
            }

            // column names will be forced to lower case
            cur.lowerCaseColumnNames();
            cur.sendQuery("select * from my_table");
            con.endSession();

            for (UInt32 i = 0; i< cur.colCount(); i++)
            {
                Console.Write("Name:          ");
                Console.WriteLine(cur.getColumnName(i));
                Console.Write("\n");
            }

            // column names will be the same as they are in the database
            cur.mixedCaseColumnNames();
            cur.sendQuery("select * from my_table");
            con.endSession();

            for (UInt32 i = 0; i< cur.colCount(); i++)
            {
                Console.Write("Name:          ");
                Console.WriteLine(cur.getColumnName(i));
                Console.Write("\n");
            }
        }
Exemple #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");
            }
        }
Exemple #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();
            }
        }
Exemple #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.sendQuery("select * from my_table");
            con.endSession();

            for (UInt32 i = 0; i&lt; cur.colCount(); i++)
            {
                Console.Write("Name:          ");
                Console.WriteLine(cur.getColumnName(i));
                Console.Write("Type:          ");
                Console.WriteLine(cur.getColumnType(i));
                Console.Write("Length:        ");
                Console.WriteLine(cur.getColumnLength(i));
                Console.Write("Precision:     ");
                Console.WriteLine(cur.getColumnPrecision(i));
                Console.Write("Scale:         ");
                Console.WriteLine(cur.getColumnScale(i));
                Console.Write("Longest Field: ");
                Console.WriteLine(cur.getLongest(i));
                Console.Write("Nullable:      ");
                Console.WriteLine(cur.getColumnIsNullable(i));
                Console.Write("Primary Key:   ");
                Console.WriteLine(cur.getColumnIsPrimaryKey(i));
                Console.Write("Unique:        ");
                Console.WriteLine(cur.getColumnIsUnique(i));
                Console.Write("Part of Key:   ");
                Console.WriteLine(cur.getColumnIsPartOfKey(i));
                Console.Write("Unsigned:      ");
                Console.WriteLine(cur.getColumnIsUnsigned(i));
                Console.Write("Zero Filled:   ");
                Console.WriteLine(cur.getColumnIsZeroFilled(i));
                Console.Write("Binary:        ");
                Console.WriteLine(cur.getColumnIsBinary(i));
                Console.Write("Auto Increment:");
                Console.WriteLine(cur.getColumnIsAutoIncrement(i));
                Console.Write("\n");
            }
        }
Exemple #6
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");
            }
        }