@@ -159,7 +159,7 @@ bool CntCheckDB(PGLOBAL g, PHC handler, const char *pathname)
159
159
bool CntInfo (PGLOBAL g, PTDB tp, PXF info)
160
160
{
161
161
if (tp) {
162
- bool b = ((PTDBASE)tp) ->GetFtype () == RECFM_NAF;
162
+ bool b = (tp ->GetFtype () == RECFM_NAF) ;
163
163
PTDBDOS tdbp = b ? NULL : (PTDBDOS)tp;
164
164
165
165
info->data_file_length = (b) ? 0 : (ulonglong)tdbp->GetFileLength (g);
@@ -331,9 +331,9 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2,
331
331
} // endfor colp
332
332
333
333
// Attach the updated columns list to the main table
334
- ((PTDBASE) tdbp) ->SetSetCols (utp->GetColumns ());
334
+ tdbp->SetSetCols (utp->GetColumns ());
335
335
} else if (tdbp && mode == MODE_INSERT)
336
- ((PTDBASE) tdbp) ->SetSetCols (tdbp->GetColumns ());
336
+ tdbp->SetSetCols (tdbp->GetColumns ());
337
337
338
338
// Now do open the physical table
339
339
if (trace)
@@ -342,7 +342,7 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2,
342
342
343
343
// tdbp->SetMode(mode);
344
344
345
- if (del/* && ((PTDBASE) tdbp) ->GetFtype() != RECFM_NAF*/ ) {
345
+ if (del/* && (tdbp->GetFtype() != RECFM_NAF*/ ) {
346
346
// To avoid erasing the table when doing a partial delete
347
347
// make a fake Next
348
348
// PDOSDEF ddp= new(g) DOSDEF;
@@ -435,7 +435,7 @@ RCODE CntReadNext(PGLOBAL g, PTDB tdbp)
435
435
436
436
if (!tdbp)
437
437
return RC_FX;
438
- else if (((PTDBASE) tdbp) ->GetKindex ()) {
438
+ else if (tdbp->GetKindex ()) {
439
439
// Reading sequencially an indexed table. This happens after the
440
440
// handler function records_in_range was called and MySQL decides
441
441
// to quit using the index (!!!) Drop the index.
@@ -482,7 +482,7 @@ RCODE CntWriteRow(PGLOBAL g, PTDB tdbp)
482
482
{
483
483
RCODE rc;
484
484
PCOL colp;
485
- PTDBASE tp= (PTDBASE)tdbp;
485
+ // PTDBASE tp= (PTDBASE)tdbp;
486
486
487
487
if (!tdbp)
488
488
return RC_FX;
@@ -500,13 +500,13 @@ RCODE CntWriteRow(PGLOBAL g, PTDB tdbp)
500
500
} // endif rc
501
501
502
502
// Store column values in table write buffer(s)
503
- for (colp= tp ->GetSetCols (); colp; colp= colp->GetNext ())
503
+ for (colp= tdbp ->GetSetCols (); colp; colp= colp->GetNext ())
504
504
if (!colp->GetColUse (U_VIRTUAL))
505
505
colp->WriteColumn (g);
506
506
507
- if (tp ->IsIndexed ())
507
+ if (tdbp ->IsIndexed ())
508
508
// Index values must be sorted before updating
509
- rc= (RCODE)((PTDBDOS)tp )->GetTxfp ()->StoreValues (g, true );
509
+ rc= (RCODE)((PTDBDOS)tdbp )->GetTxfp ()->StoreValues (g, true );
510
510
else
511
511
// Return result code from write operation
512
512
rc= (RCODE)tdbp->WriteDB (g);
@@ -534,24 +534,24 @@ RCODE CntUpdateRow(PGLOBAL g, PTDB tdbp)
534
534
RCODE CntDeleteRow (PGLOBAL g, PTDB tdbp, bool all)
535
535
{
536
536
RCODE rc;
537
- PTDBASE tp= (PTDBASE)tdbp;
537
+ // PTDBASE tp= (PTDBASE)tdbp;
538
538
539
539
if (!tdbp || tdbp->GetMode () != MODE_DELETE)
540
540
return RC_FX;
541
541
else if (tdbp->IsReadOnly ())
542
542
return RC_NF;
543
543
544
544
if (all) {
545
- if (((PTDBASE) tdbp) ->GetDef ()->Indexable ())
545
+ if (tdbp->GetDef ()->Indexable ())
546
546
((PTDBDOS)tdbp)->Cardinal = 0 ;
547
547
548
548
// Note: if all, this call will be done when closing the table
549
549
rc= (RCODE)tdbp->DeleteDB (g, RC_FX);
550
- // } else if (tp ->GetKindex() && !tp ->GetKindex()->IsSorted() &&
551
- // tp ->Txfp->GetAmType() != TYPE_AM_DBF) {
552
- } else if (tp ->IsIndexed ()) {
550
+ // } else if (tdbp ->GetKindex() && !((PTDBASE)tdbp) ->GetKindex()->IsSorted() &&
551
+ // ((PTDBASE)tdbp) ->Txfp->GetAmType() != TYPE_AM_DBF) {
552
+ } else if (tdbp ->IsIndexed ()) {
553
553
// Index values must be sorted before updating
554
- rc= (RCODE)((PTDBDOS)tp )->GetTxfp ()->StoreValues (g, false );
554
+ rc= (RCODE)((PTDBDOS)tdbp )->GetTxfp ()->StoreValues (g, false );
555
555
} else // Return result code from delete operation
556
556
rc= (RCODE)tdbp->DeleteDB (g, RC_OK);
557
557
@@ -564,7 +564,7 @@ RCODE CntDeleteRow(PGLOBAL g, PTDB tdbp, bool all)
564
564
int CntCloseTable (PGLOBAL g, PTDB tdbp, bool nox, bool abort)
565
565
{
566
566
int rc= RC_OK;
567
- TDBASE *tbxp= (PTDBASE)tdbp;
567
+ // TDBASE *tbxp= (PTDBASE)tdbp;
568
568
569
569
if (!tdbp)
570
570
return rc; // Nothing to do
@@ -580,21 +580,21 @@ int CntCloseTable(PGLOBAL g, PTDB tdbp, bool nox, bool abort)
580
580
tdbp, tdbp->GetMode (), nox, abort);
581
581
582
582
if (tdbp->GetMode () == MODE_DELETE && tdbp->GetUse () == USE_OPEN) {
583
- if (tbxp ->IsIndexed ())
583
+ if (tdbp ->IsIndexed ())
584
584
rc= ((PTDBDOS)tdbp)->GetTxfp ()->DeleteSortedRows (g);
585
585
586
586
if (!rc)
587
587
rc= tdbp->DeleteDB (g, RC_EF); // Specific A.M. delete routine
588
588
589
- } else if (tbxp ->GetMode () == MODE_UPDATE && tbxp ->IsIndexed ())
589
+ } else if (tdbp ->GetMode () == MODE_UPDATE && tdbp ->IsIndexed ())
590
590
rc= ((PTDBDOX)tdbp)->Txfp ->UpdateSortedRows (g);
591
591
592
592
switch (rc) {
593
593
case RC_FX:
594
594
abort= true ;
595
595
break ;
596
596
case RC_INFO:
597
- PushWarning (g, tbxp );
597
+ PushWarning (g, tdbp );
598
598
break ;
599
599
} // endswitch rc
600
600
@@ -630,11 +630,13 @@ int CntCloseTable(PGLOBAL g, PTDB tdbp, bool nox, bool abort)
630
630
if (trace > 1 )
631
631
printf (" About to reset opt\n " );
632
632
633
- // Make all the eventual indexes
634
- tbxp= (TDBDOX*)tdbp;
635
- tbxp->ResetKindex (g, NULL );
636
- tbxp->SetKey_Col (NULL );
637
- rc= tbxp->ResetTableOpt (g, true , tbxp->GetDef ()->Indexable () == 1 );
633
+ if (!tdbp->IsRemote ()) {
634
+ // Make all the eventual indexes
635
+ PTDBDOX tbxp = (PTDBDOX)tdbp;
636
+ tbxp->ResetKindex (g, NULL );
637
+ tbxp->SetKey_Col (NULL );
638
+ rc = tbxp->ResetTableOpt (g, true , tbxp->GetDef ()->Indexable () == 1 );
639
+ } // endif remote
638
640
639
641
err:
640
642
if (trace > 1 )
@@ -656,10 +658,10 @@ int CntIndexInit(PGLOBAL g, PTDB ptdb, int id, bool sorted)
656
658
657
659
if (!ptdb)
658
660
return -1 ;
659
- else if (!((PTDBASE) ptdb) ->GetDef ()->Indexable ()) {
661
+ else if (!ptdb->GetDef ()->Indexable ()) {
660
662
sprintf (g->Message , MSG (TABLE_NO_INDEX), ptdb->GetName ());
661
663
return 0 ;
662
- } else if (((PTDBASE) ptdb) ->GetDef ()->Indexable () == 3 ) {
664
+ } else if (ptdb->GetDef ()->Indexable () == 3 ) {
663
665
return 1 ;
664
666
} else
665
667
tdbp= (PTDBDOX)ptdb;
@@ -744,7 +746,7 @@ RCODE CntIndexRead(PGLOBAL g, PTDB ptdb, OPVAL op,
744
746
if (!ptdb)
745
747
return RC_FX;
746
748
else
747
- x= ((PTDBASE) ptdb) ->GetDef ()->Indexable ();
749
+ x= ptdb->GetDef ()->Indexable ();
748
750
749
751
if (!x) {
750
752
sprintf (g->Message , MSG (TABLE_NO_INDEX), ptdb->GetName ());
@@ -874,7 +876,7 @@ int CntIndexRange(PGLOBAL g, PTDB ptdb, const uchar* *key, uint *len,
874
876
if (!ptdb)
875
877
return -1 ;
876
878
877
- x= ((PTDBASE) ptdb) ->GetDef ()->Indexable ();
879
+ x= ptdb->GetDef ()->Indexable ();
878
880
879
881
if (!x) {
880
882
sprintf (g->Message , MSG (TABLE_NO_INDEX), ptdb->GetName ());
0 commit comments