@@ -1879,6 +1879,7 @@ public void Test_run_return_set()
18791879 BasicSet dict = ( BasicSet ) db . run ( "set(1 3 5)" ) ;
18801880 Assert . AreEqual ( 3 , dict . rows ( ) ) ;
18811881 Assert . AreEqual ( 1 , dict . columns ( ) ) ;
1882+ //Console.WriteLine(dict.getString());
18821883 db . close ( ) ;
18831884 }
18841885
@@ -2085,6 +2086,80 @@ public void Test_upload_table()
20852086 db . close ( ) ;
20862087 }
20872088
2089+ [ TestMethod ]
2090+ public void Test_upload_table_any_null ( )
2091+ {
2092+ DBConnection db = new DBConnection ( ) ;
2093+ db . connect ( SERVER , PORT , USER , PASSWORD ) ;
2094+ BasicTable re1 = ( BasicTable ) db . run ( "re = table(100:0, `sex`name`eye, [STRING,ANY,ANY]);re" ) ;
2095+ Assert . AreEqual ( "sex name eye\n " +
2096+ "--- ---- ---\n " , re1 . getString ( ) ) ;
2097+ Dictionary < string , IEntity > upObj = new Dictionary < string , IEntity > ( ) ;
2098+ upObj . Add ( "table_uploaded" , ( IEntity ) re1 ) ;
2099+ db . upload ( upObj ) ;
2100+ BasicTable re2 = ( BasicTable ) db . run ( "select * from table_uploaded" ) ;
2101+ Assert . AreEqual ( re1 . getString ( ) , re2 . getString ( ) ) ;
2102+ db . close ( ) ;
2103+ }
2104+
2105+ [ TestMethod ]
2106+ public void Test_upload_table_any ( )
2107+ {
2108+ DBConnection db = new DBConnection ( ) ;
2109+ db . connect ( SERVER , PORT , USER , PASSWORD ) ;
2110+ BasicTable re1 = ( BasicTable ) db . run ( "re = table(100:0, `sex`name`eye, [STRING,ANY,ANY]);\n " +
2111+ "re.tableInsert(`f`m,([`jill],['tom' 'dick' 'harry' 'jack']), ([`gray],['blue' 'green' 'blue' 'blue']));" +
2112+ "select * from re;" ) ;
2113+ Assert . AreEqual ( "sex name eye \n " +
2114+ "--- -------------------------- ---------------------------\n " +
2115+ "f [jill] [gray] \n " +
2116+ "m ([tom, dick, harry, jack]) ([blue, green, blue, blue])\n " , re1 . getString ( ) ) ;
2117+
2118+ Dictionary < string , IEntity > upObj = new Dictionary < string , IEntity > ( ) ;
2119+ upObj . Add ( "table_uploaded" , ( IEntity ) re1 ) ;
2120+ db . upload ( upObj ) ;
2121+ BasicTable re2 = ( BasicTable ) db . run ( "select * from table_uploaded" ) ;
2122+ Assert . AreEqual ( re1 . getString ( ) , re2 . getString ( ) ) ;
2123+ db . close ( ) ;
2124+ }
2125+
2126+
2127+ [ TestMethod ]
2128+ public void Test_upload_table_any_all_dataform ( )
2129+ {
2130+ DBConnection db = new DBConnection ( ) ;
2131+ db . connect ( SERVER , PORT , USER , PASSWORD ) ;
2132+ BasicTable re1 = ( BasicTable ) db . run ( "ctime=take(2025.10.18T10:27:23.275..2025.10.10T10:27:23.275,7)\n " +
2133+ "cany=array(ANY,0).append!(1000).append!(`www`qqq).append!(matrix([1 2 3, 4 5 6])).append!(100:11).append!(table(`qa`ws`ed as id)).append!((100, `11)).append!( [[`1a,`a1]].setColumnarTuple!());" +
2134+ "t1 = table(ctime, cany); t1;" ) ;
2135+ Console . WriteLine ( re1 . getString ( ) ) ;
2136+
2137+ Dictionary < string , IEntity > upObj = new Dictionary < string , IEntity > ( ) ;
2138+ upObj . Add ( "table_uploaded" , ( IEntity ) re1 ) ;
2139+ db . upload ( upObj ) ;
2140+ BasicTable re2 = ( BasicTable ) db . run ( "select * from table_uploaded" ) ;
2141+ Assert . AreEqual ( re1 . getString ( ) , re2 . getString ( ) ) ;
2142+ Assert . AreEqual ( 7 , re1 . rows ( ) ) ;
2143+ db . close ( ) ;
2144+ }
2145+
2146+ //[TestMethod]
2147+ public void Test_upload_table_any_set_dict ( )
2148+ {
2149+ DBConnection db = new DBConnection ( ) ;
2150+ db . connect ( SERVER , PORT , USER , PASSWORD ) ;
2151+ BasicTable re1 = ( BasicTable ) db . run ( "ctime=take(2025.10.18T10:27:23.275..2025.10.10T10:27:23.275,2)\n " +
2152+ "cany=array(ANY,0).append!(set(1 2)).append!(dict(`aaa11`bbb22, [dict(`p1`p2, `1`2, true), dict(`p11`p22, `100`200, true)]));" +
2153+ "t1 = table(ctime, cany); t1;" ) ;
2154+ Console . WriteLine ( re1 . getString ( ) ) ;
2155+
2156+ Dictionary < string , IEntity > upObj = new Dictionary < string , IEntity > ( ) ;
2157+ upObj . Add ( "table_uploaded" , ( IEntity ) re1 ) ;
2158+ db . upload ( upObj ) ;
2159+ BasicTable re2 = ( BasicTable ) db . run ( "select * from table_uploaded" ) ;
2160+ Assert . AreEqual ( re1 . getString ( ) , re2 . getString ( ) ) ;
2161+ db . close ( ) ;
2162+ }
20882163
20892164 [ TestMethod ]
20902165 public void Test_dict_toDataTable ( )
@@ -3553,6 +3628,78 @@ public void test_python_false()
35533628
35543629 }
35553630
3631+ [ TestMethod ]
3632+ public void test_ParserType_notSet ( )
3633+ {
3634+ DBConnection conn = new DBConnection ( false , false , false , false ) ;
3635+ conn . connect ( SERVER , PORT , "admin" , "123456" ) ;
3636+ IEntity re = conn . run ( "1+1" ) ;
3637+ Console . WriteLine ( re . getString ( ) ) ;
3638+ Assert . AreEqual ( "2" , re . getString ( ) ) ;
3639+ conn . close ( ) ;
3640+ }
3641+
3642+ [ TestMethod ] //Default
3643+ public void test_ParserType_default ( )
3644+ {
3645+ DBConnection conn = new DBConnection ( false , false , false , false , false , ParserType . Default ) ;
3646+ conn . connect ( SERVER , PORT , "admin" , "123456" ) ;
3647+ IEntity re = conn . run ( "1+1" ) ;
3648+ Console . WriteLine ( re . getString ( ) ) ;
3649+ Assert . AreEqual ( "2" , re . getString ( ) ) ;
3650+ conn . close ( ) ;
3651+ }
3652+
3653+ [ TestMethod ] //DolphinDB
3654+ public void test_ParserType_DolphinDB ( )
3655+ {
3656+ DBConnection conn = new DBConnection ( false , false , false , false , false , ParserType . DolphinDB ) ;
3657+ conn . connect ( SERVER , PORT , "admin" , "123456" ) ;
3658+ IEntity re = conn . run ( "1+1" ) ;
3659+ Console . WriteLine ( re . getString ( ) ) ;
3660+ Assert . AreEqual ( "2" , re . getString ( ) ) ;
3661+ conn . close ( ) ;
3662+ }
3663+
3664+ [ TestMethod ] //python
3665+ public void test_ParserType_Python ( )
3666+ {
3667+ DBConnection db = new DBConnection ( ) ;
3668+ db . connect ( SERVER , PORT , "admin" , "123456" ) ;
3669+ DBConnection conn = new DBConnection ( false , false , false , true , false , ParserType . Python ) ;
3670+ conn . connect ( SERVER , PORT , "admin" , "123456" ) ;
3671+ BasicString version = ( BasicString ) db . run ( "version()" ) ;
3672+ if ( version . getString ( ) . Contains ( "3.00" ) )
3673+ {
3674+ conn . run ( "import pandas as pd" ) ;
3675+ }
3676+ else
3677+ {
3678+ Console . WriteLine ( "The current version does not support Python Parser, so this case is skipped" ) ;
3679+ }
3680+
3681+ conn . close ( ) ;
3682+ db . close ( ) ;
3683+ }
3684+
3685+ [ TestMethod ] //kdb
3686+ public void test_ParserType_KDB ( )
3687+ {
3688+ DBConnection conn = new DBConnection ( false , false , false , false , false , ParserType . KDB ) ;
3689+ conn . connect ( "192.168.0.54" , 8848 , "admin" , "123456" ) ;
3690+ IEntity re = conn . run ( "D:`q`w`e!(1 2;3 4;5 6)\n key D" ) ;
3691+ Console . WriteLine ( re . getString ( ) ) ;
3692+ Assert . AreEqual ( "[q, w, e]" , re . getString ( ) ) ;
3693+
3694+ IEntity re1 = conn . run ( "res:\" abcdef\" [1 4 3]\n res" ) ;
3695+ Assert . AreEqual ( "['b', 'e', 'd']" , re1 . getString ( ) ) ;
3696+
3697+ IEntity re2 = conn . run ( "txt:((\" Now\" ;\" is \" ;\" the\" ;\" time\" );(\" for\" ;\" all\" ;\" good\" ;\" folk\" ))\n txt" ) ;
3698+ Console . WriteLine ( re2 . getString ( ) ) ;
3699+ Assert . AreEqual ( "((['N', 'o', 'w'],[' ', 'i', 's', ' '],['t', 'h', 'e'],['t', 'i', 'm', 'e']),(['f', 'o', 'r'],['a', 'l', 'l'],['g', 'o', 'o', 'd'],['f', 'o', 'l', 'k']))" , re2 . getString ( ) ) ;
3700+ conn . close ( ) ;
3701+ }
3702+
35563703
35573704 [ TestMethod ]
35583705 public void test_close ( )
0 commit comments