Changeset 8996 for trunk/MagicSoft/Mars/msql
- Timestamp:
- 07/05/08 20:01:55 (16 years ago)
- Location:
- trunk/MagicSoft/Mars/msql
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/msql/MSQLMagic.cc
r8987 r8996 187 187 } 188 188 189 Bool_t MSQLMagic::ExistStr(const char *column, const char *table, const char *test) 190 { 191 TString query(Form("SELECT %s FROM %s WHERE %s='%s'", column, table, column, test)); 189 // -------------------------------------------------------------------------- 190 // 191 // Check if the column of an entry in a table is existing and not null. 192 // The entry is defined by column=test (column name) and a optional 193 // WHERE statement. 194 // 195 Bool_t MSQLMagic::ExistStr(const char *column, const char *table, const char *test, const char *where) 196 { 197 TString query(Form("SELECT %s FROM %s WHERE %s='%s' %s %s", column, table, column, test, where?"AND":"", where?where:"")); 192 198 TSQLResult *res = Query(query); 193 199 if (!res) -
trunk/MagicSoft/Mars/msql/MSQLMagic.h
r8942 r8996 44 44 Int_t QueryKeyOfVal(const char *col, const char *val); 45 45 Int_t QueryKeyOf(const char *col, const char *ext, const char *val); 46 Bool_t ExistStr(const char *column, const char *table, const char *test );46 Bool_t ExistStr(const char *column, const char *table, const char *test, const char *where=0); 47 47 48 48 Int_t Insert(const char *table, const char *vars, const char *where=0); -
trunk/MagicSoft/Mars/msql/MSQLServer.cc
r8907 r8996 1 1 /* ======================================================================== *\ 2 ! $Name: not supported by cvs2svn $:$Id: MSQLServer.cc,v 1.1 5 2008-06-02 08:46:49tbretz Exp $2 ! $Name: not supported by cvs2svn $:$Id: MSQLServer.cc,v 1.16 2008-07-05 18:57:35 tbretz Exp $ 3 3 ! -------------------------------------------------------------------------- 4 4 ! … … 668 668 } 669 669 670 // -------------------------------------------------------------------------- 671 // 672 // Instantiate a dabase connection either by 673 // mysql://user:password@url/database 674 // or by a resource file (in teh given string doesn't contain mysql://) 675 // 670 676 MSQLServer::MSQLServer(const char *u) : fType(kIsZombie) /*FOLD00*/ 671 677 { 672 TString url(u); 673 TString user, pasw; 674 675 if (!Split(url, user, pasw)) 676 { 677 fType = kIsZombie; 678 return; 679 } 680 Init(url, user, pasw); 678 if (TString(u).Contains("mysql://", TString::kIgnoreCase)) 679 { 680 TString url(u); 681 TString user, pasw; 682 683 if (!Split(url, user, pasw)) 684 { 685 fType = kIsZombie; 686 return; 687 } 688 Init(url, user, pasw); 689 } 690 else 691 { 692 TEnv env(u); 693 InitEnv(env); 694 } 681 695 } 682 696 … … 781 795 if (key=="PRI") 782 796 { 783 rc = (*row)[0]; 784 break; 797 if (!rc.IsNull()) 798 rc += ", "; 799 rc += (*row)[0]; 785 800 } 786 801 delete row; … … 823 838 824 839 const TString tab = expr(0, expr.First('.')); 825 const TString var = expr(expr.First('.')+1, expr.Length());840 //const TString var = expr(expr.First('.')+1, expr.Length()); 826 841 827 842 // If the table found is the primary table itself skip it. … … 838 853 continue; 839 854 840 joins += Form("LEFT JOIN %s ON %s.%s=%s.%s ", tab.Data(), 841 table, prim.Data(), tab.Data(), prim.Data()); 855 joins += Form("LEFT JOIN %s USING (%s) ", tab.Data(), prim.Data()); 842 856 } 843 857
Note:
See TracChangeset
for help on using the changeset viewer.