summaryrefslogtreecommitdiff
path: root/src/sql/xbset.cpp
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2022-12-07 13:17:14 +0100
committerJörg Frings-Fürst <debian@jff-webhosting.net>2022-12-07 13:17:14 +0100
commit4875a3dd9b183dcd2256e2abfc4ccf7484c233b4 (patch)
tree0abbea881ded030851014ffdd60fbf71fead8f65 /src/sql/xbset.cpp
parentdaf17154bf13139d9375f48525d19d6aaba08155 (diff)
New upstream version 4.0.2upstream/4.0.2
Diffstat (limited to 'src/sql/xbset.cpp')
-rwxr-xr-xsrc/sql/xbset.cpp91
1 files changed, 91 insertions, 0 deletions
diff --git a/src/sql/xbset.cpp b/src/sql/xbset.cpp
new file mode 100755
index 0000000..98de309
--- /dev/null
+++ b/src/sql/xbset.cpp
@@ -0,0 +1,91 @@
+/* xbset.cpp
+
+XBase64 Software Library
+
+Copyright (c) 1997,2003,2014,2022 Gary A Kunkel
+
+The xb64 software library is covered under the terms of the GPL Version 3, 2007 license.
+
+Email Contact:
+
+ XDB-devel@lists.sourceforge.net
+ XDB-users@lists.sourceforge.net
+
+*/
+
+#include "xbase.h"
+
+#ifdef XB_SQL_SUPPORT
+
+namespace xb{
+
+
+/***********************************************************************/
+xbInt16 xbSql::SqlSet( const xbString &sCmdLine ){
+
+ // std::cout << "SET [" << sCmdLine << "]\n";
+ // expected format:
+ // SET ATTRIBUTE = DATAVALUE
+ // SET ATTRIBUTE = ^ (to delete an entry)
+
+ xbInt16 iRc = 0;
+ xbInt16 iErrorStop = 0;
+ xbUInt32 ulPos;
+
+ try{
+
+ xbString sCmd = sCmdLine;
+ sCmd.Trim();
+ sCmd.ZapTrailingChar( ';' );
+ sCmd.Trim();
+
+ // drop off the first node "SET"
+ ulPos = sCmd.Pos( ' ' );
+ sCmd.Ltrunc( ulPos );
+ sCmd.Ltrim();
+
+ xbString sNode1 = sCmd;
+ sNode1.ToUpperCase();
+
+ if( sNode1 == "SET" ) {
+ uda.DumpUda();
+
+ } else {
+
+ xbString sKey;
+ sKey.ExtractElement( sCmd, '=', 1, 0 );
+ sKey.Trim();
+
+ xbString sToken;
+ sToken.ExtractElement( sCmd, '=', 2, 0 );
+ sToken.Trim();
+
+
+ if( sToken == '^' ){
+ if(( iRc = uda.DelTokenForKey( sKey )) != XB_NO_ERROR ){
+ iErrorStop = 10;
+ throw iRc;
+ }
+ } else {
+ if(( iRc = uda.UpdTokenForKey( sKey, sToken )) != XB_NO_ERROR ){
+ iErrorStop = 10;
+ throw iRc;
+ }
+ }
+ }
+
+ }
+ catch (xbInt16 iRc ){
+ xbString sMsg;
+ sMsg.Sprintf( "xbSql::SqlSet() Exception Caught. Error Stop = [%d] rc = [%d]", iErrorStop, iRc );
+ xbase->WriteLogMessage( sMsg.Str() );
+ xbase->WriteLogMessage( GetErrorMessage( iRc ));
+ }
+
+ return iRc;
+}
+
+/***********************************************************************/
+} /* namespace */
+#endif /* XB_SQL_SUPPORT */
+