DbiAsciiTablePreparer.cxx File Reference

#include <fstream>
#include <sstream>
#include "TString.h"
#include "TSystem.h"
#include "TUrl.h"
#include "TSocket.h"
#include "DatabaseInterface/DbiAsciiTablePreparer.h"
#include "MessageService/MsgService.h"
#include "LeakChecker/Lea.h"

Go to the source code of this file.

Functions

 CVSID ("$Id: DbiAsciiTablePreparer.cxx,v 1.4 2007/04/26 14:19:57 west Exp $")
TString Validate (const TString &str)

Function Documentation

CVSID ( "$Id: DbiAsciiTablePreparer.  cxx,
v 1.4 2007/04/26 14:19:57 west Exp $"   
)
TString Validate ( const TString &  str  ) 

Definition at line 37 of file DbiAsciiTablePreparer.cxx.

References exit(), and Nav::kBoth.

Referenced by DbiAsciiTablePreparer::Init().

00038 {
00039    // internal use static func.
00040    // 
00041    // - Does validation of string as coulmn names/types, very primitive so far.
00042    // - Returns corrected column string 
00043 
00044    TString ret = str.Strip(TString::kBoth);
00045    Int_t spidx = 0;
00046    const char* s = ret.Data();
00047    
00048    if(s[0]=='\"' || s[strlen(s)-1]=='\"' ) {
00049       TString quote('\"');
00050       ret.ReplaceAll(quote,"");
00051       goto exit;
00052    }
00053    if( ret.IsNull() ||
00054       ((ret.Length()==1) && !isalpha(s[0]) ) ) return "wrong format";
00055 
00056    for (Ssiz_t i = 0; i < ret.Length(); i++) {
00057       if( !isalnum(s[i]) && !isspace(s[i]) && 
00058          s[i]!=')' && s[i]!='(' && s[i]!=',' &&
00059          s[i]!='_' && s[i]!='-' ) {
00060          return "wrong format";
00061       }
00062       if(isspace(s[i])) spidx = i;
00063    }
00064    
00065 exit:
00066    if(!spidx) ret += " TEXT NOT NULL";  
00067    return ret;   
00068 }


Generated on 24 Jul 2018 for loon by  doxygen 1.6.1