11using System ;
22using System . Collections . Generic ;
3- using SQLiteCLIENT ;
3+ using ServQLClient ;
44
55namespace ServQLTerminal
66{
@@ -53,9 +53,18 @@ static void Main(string[] args)
5353
5454 String username = string . Empty ;
5555 string password = string . Empty ;
56+ bool repeat = true ;
5657 while ( ! client . isLoged )
5758 {
58- connection . Open ( ) ;
59+ try
60+ {
61+
62+ connection . Open ( ) ;
63+ } catch ( Exception e )
64+ {
65+ Console . WriteLine ( "Error connecting " ) ;
66+ System . Environment . Exit ( 1 ) ;
67+ }
5968 Console . Write ( "Username: " ) ;
6069 username = Console . ReadLine ( ) ;
6170 Console . Write ( "Password: " ) ;
@@ -72,7 +81,7 @@ static void Main(string[] args)
7281 string command ;
7382 string cArgs ;
7483 string [ ] commandSplited ;
75- Client . Package . Response response ;
84+ Package . Response response ;
7685 string prefix = "" ;
7786 while ( true )
7887 {
@@ -82,6 +91,10 @@ static void Main(string[] args)
8291 {
8392 prefix = "exec" ;
8493 }
94+ else if ( command == "clear" )
95+ {
96+ Console . Clear ( ) ;
97+ }
8598 else if ( command == "exit" )
8699 {
87100 if ( prefix == "" ) break ;
@@ -103,10 +116,18 @@ static void Main(string[] args)
103116 command = prefix ;
104117 }
105118 response = client . sendCommand ( command , cArgs ) ;
106- if ( response ? . Result == "ERROR" || response == null ) Console . WriteLine ( "ERROR" ) ;
119+ if ( response ? . Result == "ERROR" || response == null ) Console . WriteLine ( $ "ERROR: { response . Message } ") ;
107120 else
108121 {
109- foreach ( string data in response . Data ) Console . WriteLine ( data ) ;
122+ foreach ( string [ ] data in response . Data )
123+ {
124+ foreach ( string d in data )
125+ {
126+
127+ Console . Write ( d + " , " ) ;
128+ }
129+ Console . WriteLine ( ) ;
130+ }
110131 }
111132
112133 }
0 commit comments