summaryrefslogtreecommitdiff
path: root/src/sql/xbsql.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/sql/xbsql.cpp')
-rwxr-xr-xsrc/sql/xbsql.cpp62
1 files changed, 49 insertions, 13 deletions
diff --git a/src/sql/xbsql.cpp b/src/sql/xbsql.cpp
index 25cd2c8..5261b1a 100755
--- a/src/sql/xbsql.cpp
+++ b/src/sql/xbsql.cpp
@@ -57,7 +57,20 @@ xbInt16 xbSql::ExecuteNonQuery( const xbString &sCmdLine ) {
// std::cout << "node 1 = " << sNode1.Str() << std::endl;
- if( sNode1 == "CREATE" ){
+ if( sNode1 == "ALTER" ){
+ xbString sNode2;
+ sNode2.ExtractElement( sCmd.Str(), ' ', 2, 0 );
+ sNode2.ToUpperCase();
+ sNode2.Trim();
+
+ if( sNode2 == "TABLE" )
+ iRc = SqlAlterTable( sCmd );
+ else
+ iRc = XB_INVALID_FUNCTION;
+
+
+
+ } else if( sNode1 == "CREATE" ){
xbString sNode2;
sNode2.ExtractElement( sCmd.Str(), ' ', 2, 0 );
@@ -65,8 +78,11 @@ xbInt16 xbSql::ExecuteNonQuery( const xbString &sCmdLine ) {
sNode2.Trim();
if( sNode2 == "TABLE" )
iRc = SqlCreateTable( sCmd );
+
+ #ifdef XB_INDEX_SUPPORT
else if( sNode2 == "INDEX" || sNode2 == "UNIQUE" )
iRc = SqlCreateIndex( sCmd );
+ #endif // XB_INDEX_SUPPORT
else
iRc = XB_INVALID_FUNCTION;
@@ -81,22 +97,35 @@ xbInt16 xbSql::ExecuteNonQuery( const xbString &sCmdLine ) {
if( sNode2 == "TABLE" )
iRc = SqlDropTable( sCmd );
+ #ifdef XB_INDEX_SUPPORT
else if( sNode2 == "INDEX" )
iRc = SqlDropIndex( sCmd );
+ #endif // XB_INDEX_SUPPORT
+
+ else
+ iRc = XB_INVALID_FUNCTION;
+
+ } else if( sNode1 == "DELETE" || sNode1 == "UNDELETE" ){
+
+ iRc = SqlDelete( sCmd );
+
} else if( sNode1 == "HELP" )
SqlHelp();
else if( sNode1 == "INSERT" ){
-
iRc = SqlInsert( sCmd );
// else if( sNode1 == "UPDATE" )
// iRc = SqlUpdate( sCmd );
}
+
else if( sNode1 == "USE" )
iRc = SqlUse( sCmd );
+ else if( sNode1 == "SELECT" )
+ iRc = SqlSelect( sCmd );
+
else if( sNode1 == "SET" )
iRc = SqlSet( sCmd );
@@ -114,11 +143,23 @@ xbXBase *xbSql::GetXbasePtr() const {
/***********************************************************************/
void xbSql::SqlHelp() const {
- std::cout << "************************" << std::endl;
- std::cout << "Valid XBase SQL commands" << std::endl << std::endl;
- std::cout << "HELP" << std::endl;
- std::cout << "USE /dir/to/dbf/tables" << std::endl;
- std::cout << "CREATE TABLE" << std::endl << std::endl << std::endl;
+ std::cout << "************************" << std::endl;
+ std::cout << "Valid XBase SQL commands" << std::endl << std::endl;
+ std::cout << "HELP" << std::endl;
+
+ std::cout << "ALTER TABLE tablename.DBF RENAME TO newtablename.DBF" << std::endl;
+ std::cout << "CREATE INDEX ixname.NDX ON tablename.dbf ( EXPRESSION ) [ASSOCIATE]" << std::endl;
+ std::cout << "CREATE [UNIQUE] INDEX tagname ON tablename.dbf ( EXPRESSION ) [DESC] [FILTER .NOT. DELETED()]" << std::endl;
+ std::cout << "CREATE TABLE tablename.DBF (Field1 CHAR(10), INTFLD1 INTEGER, ... )" << std::endl;
+ std::cout << "DELETE FROM tablename.DBF [WHERE expression]" << std::endl;
+ std::cout << "DROP INDEX [IF EXISTS] ixname.NDX ON tablename.DBF" << std::endl;
+ std::cout << "DROP TABLE [IF EXISTS] tablename.DBF" << std::endl;
+ std::cout << "INSERT INTO tablename (field1, field2, field3,...) VALUES ( 'charval', numval, {MM/DD/YY})" << std::endl;
+ std::cout << "SELECT FIELD1,FIELD2... FROM TABLE.DBF [WHERE expression] [ORDER BY TAG TAGNAME" << std::endl;
+ std::cout << "SET ATTRIBUTE = DATAVALUE" << std::endl;
+ std::cout << "SET ATTRIBUTE = ^ (to delete an entry)" << std::endl;
+ std::cout << "USE /dir/to/dbf/tables" << std::endl;
+ std::cout << "CREATE TABLE" << std::endl << std::endl << std::endl;
}
/***********************************************************************/
@@ -133,11 +174,6 @@ xbInt16 xbSql::SqlUse( const xbString &sCmdLine ){
}
/***********************************************************************/
-/***********************************************************************/
-/***********************************************************************/
-/***********************************************************************/
-/***********************************************************************/
-
-/***********************************************************************/
} /* namespace */
#endif /* XB_SQL_SUPPORT */
+