File tree Expand file tree Collapse file tree 1 file changed +2
-5
lines changed Expand file tree Collapse file tree 1 file changed +2
-5
lines changed Original file line number Diff line number Diff line change @@ -46,9 +46,9 @@ import (
4646)
4747
4848// Identifies the table name alias provided as 
49- // "\"users\" \"u\"" and "\"users\" u" and "\"users\"" . Gorm already handles 
49+ // "\"users\" \"u\"" and "\"users\" u". Gorm already handles 
5050// the other formats like "users u", "users AS u" etc. 
51- var  tableRegexp  =  regexp .MustCompile (`^"(\w+)"(?: \s+"?(\w+)"?) ?$` )
51+ var  tableRegexp  =  regexp .MustCompile (`^"(\w+)"\s+"?(\w+)"?$` )
5252
5353func  BeforeQuery (db  * gorm.DB ) {
5454	if  db  ==  nil  ||  db .Statement  ==  nil  ||  db .Statement .TableExpr  ==  nil  {
@@ -59,12 +59,9 @@ func BeforeQuery(db *gorm.DB) {
5959		if  results  :=  tableRegexp .FindStringSubmatch (name ); len (results ) ==  3  {
6060			if  results [2 ] !=  ""  {
6161				db .Statement .Table  =  results [2 ]
62- 			} else  {
63- 				db .Statement .Table  =  results [1 ]
6462			}
6563		}
6664	}
67- 	return 
6865}
6966
7067// MismatchedCaseHandler handles Oracle Case Insensitivity. 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments