Changeset 9195 for trunk/MagicSoft/Mars/msql
- Timestamp:
- 12/21/08 18:09:49 (16 years ago)
- Location:
- trunk/MagicSoft/Mars/msql
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/msql/MSQLMagic.cc
r9039 r9195 33 33 #include "MSQLMagic.h" 34 34 35 #include <stdlib.h> // atoi (Ubuntu 8.10) 36 35 37 #include <iostream> 36 38 -
trunk/MagicSoft/Mars/msql/MSQLServer.cc
r8996 r9195 1 1 /* ======================================================================== *\ 2 ! $Name: not supported by cvs2svn $:$Id: MSQLServer.cc,v 1.1 6 2008-07-05 18:57:35tbretz Exp $2 ! $Name: not supported by cvs2svn $:$Id: MSQLServer.cc,v 1.17 2008-12-21 18:09:49 tbretz Exp $ 3 3 ! -------------------------------------------------------------------------- 4 4 ! … … 58 58 #include <TBrowser.h> 59 59 60 #include <TObjString.h> 61 #include <TObjArray.h> 62 60 63 ClassImp(MSQLServer); 61 64 … … 781 784 // Return the name of the (first) column with a primary key 782 785 // 783 TString MSQLServer::GetPrimaryKey (const char *table)786 TString MSQLServer::GetPrimaryKeys(const char *table) 784 787 { 785 788 TSQLResult *res = GetColumns(table); … … 787 790 return ""; 788 791 789 TString rc; 792 TObjArray arr; 793 arr.SetOwner(); 790 794 791 795 TSQLRow *row = 0; … … 794 798 const TString key = (*row)[3]; 795 799 if (key=="PRI") 796 { 797 if (!rc.IsNull()) 798 rc += ", "; 799 rc += (*row)[0]; 800 } 800 arr.Add(new TObjString((*row)[0])); 801 801 delete row; 802 802 } 803 804 803 delete res; 804 805 arr.Sort(); 806 807 TString rc; 808 for (int i=0; i<arr.GetEntries(); i++) 809 { 810 if (i>0) 811 rc += ", "; 812 rc += arr[i]->GetName(); 813 } 805 814 return rc; 806 815 } … … 849 858 850 859 // Now get the primary key of the table to be joined 851 const TString prim = GetPrimaryKey (tab);860 const TString prim = GetPrimaryKeys(tab); 852 861 if (prim.IsNull()) 853 862 continue; -
trunk/MagicSoft/Mars/msql/MSQLServer.h
r8185 r9195 123 123 124 124 TString GetEntry(const char *where, const char *col=0, const char *table=0) const; 125 TString GetPrimaryKey (const char *table);125 TString GetPrimaryKeys(const char *table); 126 126 TString GetJoins(const char *table, const TString text); 127 127
Note:
See TracChangeset
for help on using the changeset viewer.