예제 #1
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");
            }
        }
예제 #2
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  select image into :image from images;  select description into :desc from images;  end;");
        		cur.defineOutputBindBlob("image");
        		cur.defineOutputBindClob("desc");
        		cur.executeQuery();

        		String image = cur.getOutputBindBlob("image");
        		UInt32 imagelength = cur.getOutputBindLength("image");

        		String desc = cur.getOutputBindClob("desc");
        		UInt32 desclength = cur.getOutputBindLength("desc");

        		con.endSession();
예제 #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");
            }
        }
예제 #4
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  :result1:=addTwoIntegers(:integer1,:integer2);  :result2=addTwoFloats(:float1,:float2);  :result3=convertToString(:integer3); end;");
        		cur.inputBind("integer1", 10);
        		cur.inputBind("integer2", 20);
        		cur.inputBind("float1", 1.1, 2, 1);
        		cur.inputBind("float2", 2.2, 2, 1);
        		cur.inputBind("integer3", 30);
        		cur.defineOutputBindInteger("result1");
        		cur.defineOutputBindDouble("result2");
        		cur.defineOutputBindString("result3", 100);
        		cur.executeQuery();
        		Int64 result1=cur.getOutputBindInteger("result1");
        		Double result2=cur.getOutputBindDouble("result2");
        		String result3=cur.getOutputBindString("result3");
        		con.endSession();
예제 #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< 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");
            }
        }