Corretta delete_row dei record array
git-svn-id: svn://10.65.10.50/trunk@2073 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									ea5f02c9cb
								
							
						
					
					
						commit
						cf9202b26f
					
				| @ -1,4 +1,4 @@ | ||||
| // $Id: relation.cpp,v 1.66 1995-10-25 09:43:48 guy Exp $
 | ||||
| // $Id: relation.cpp,v 1.67 1995-11-03 08:18:05 guy Exp $
 | ||||
| // relation.cpp
 | ||||
| // fv 12/8/93
 | ||||
| // relation class for isam files
 | ||||
| @ -1651,7 +1651,7 @@ TRectype& TRecord_array::row(int n, bool create) | ||||
|   { | ||||
|     r = (TRectype*)key().dup();                 // Crea nuovo record copiando la chiave
 | ||||
|     n = add(r, i) + _offset;                    // Riassegna n se era negativo!
 | ||||
|     char str[8]; sprintf(str, "%d", n); | ||||
|     char str[16]; sprintf(str, "%d", n); | ||||
|     r->renum_key(_num, str);                    // Aggiorna campo numero riga
 | ||||
|   } | ||||
|   CHECKD(r && n > 0, "Bad record number ", n);   | ||||
| @ -1707,15 +1707,22 @@ int TRecord_array::add_row(TRectype* r) | ||||
| } | ||||
| 
 | ||||
| bool TRecord_array::destroy_row(int r, bool pack) | ||||
| {                       | ||||
| {                        | ||||
|   CHECKD(r > _offset, "Can't destroy row ", r); | ||||
|   const int index = r - _offset; | ||||
|   const bool ok = destroy(index, pack); | ||||
|    | ||||
|   if (ok && pack) | ||||
|   { | ||||
|     for (int i = index; i < items(); i++) | ||||
|       row(i + _offset, FALSE).put(_num, i + _offset); | ||||
|     for (int i = size()-1; i > index; i--) | ||||
|     { | ||||
|       TRectype* r = (TRectype*)objptr(i); | ||||
|       if (r != NULL) | ||||
|       { | ||||
|         TString16 n; n << i+_offset; | ||||
|         r->renum_key(_num, n); | ||||
|       }   | ||||
|     }   | ||||
|   } | ||||
|   return ok; | ||||
| }  | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user