New call-to-action
Page 2 of 2 FirstFirst 12
Results 31 to 51 of 51

Thread: Extreme problem adding fields to a table.

  1. #31
    Member
    Real Name
    Craig Schumacker
    Join Date
    May 2000
    Posts
    729

    Default Re: Extreme problem adding fields to a table.

    To be clear, and I may be wrong, but I only concern myself with compacts on the developer's side. Not routinely on the user's autoexec side.

    Other than perhaps packing the tables, my gut feeling is that the compact cleans the DDD, DDM, and DDX files, where development takes place. The sem, set, and sex files, too, as well as the adb, alb, alm, and alx files.

    So, I run the DC before I move the files onto the client (Give them an update).

    I have had odd issues, mostly in form design, that disappear after a DC.

    I do not believe a DC does anything on the data side of the files. Anyone have any thoughts on that belief?

  2. #32
    Member preston2's Avatar
    Real Name
    Preston
    Join Date
    Nov 2011
    Posts
    764

    Default Re: Extreme problem adding fields to a table.

    Tom, Craig.

    Here is the problem. If compacting does resolve my initial issue then I will have to add code to compact on the customers side this time. If compacting works and I do not have it do it on all my customers DB then I will either have to fix all of them manually or use that copy and rename thing this time.

    Anyway, about to test it on my install of the app. Will let you know.

  3. #33
    Member preston2's Avatar
    Real Name
    Preston
    Join Date
    Nov 2011
    Posts
    764

    Default Re: Extreme problem adding fields to a table.

    Ok, compacting the DB did not fix the problem. The table still blows up when adding fields.

    Looks like it will be the copy and rename method to get this fixed.

  4. #34
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: Extreme problem adding fields to a table.

    Compacting updates the indexes as a necessary side effect of the packing. Many developed the habit of compacting the database as an easy way to keep the indexes refreshed.

    The table and set support files you mention are themselves table, index, and memo files where the information noted in ALPHA FIVE FILE TYPES is stored. Until a compact is performed those tables hold records for each change to field definitions, field rules, layouts, etc. The current state of affairs of each aspect is an "active" record. The prior stages are all in deleted records.

    Compacting the database removes those deleted records and rebuilds the support file indexes.
    There can be only one.

  5. #35
    Member preston2's Avatar
    Real Name
    Preston
    Join Date
    Nov 2011
    Posts
    764

    Default Re: Extreme problem adding fields to a table.

    Here is the thing Stan. On my development db I never delete any records in the first place. I have a couple of records in there for demo info only. If anyone adds and deletes a lot of records it would be my customers on their end.

    But as stated above, compacting the db did not fix the problem.

  6. #36
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: Extreme problem adding fields to a table.

    Should you want to explore support files converted to tables, see attachment.

    Should you want to try it on your own

    Copy the .ddd, .ddx, and .ddm files for one of your tables to a new directory. Do not use your live database files.
    Rename the .ddd to .dbf, the .ddx to .cdx, and the .ddm to .fpt. Do not use your live database files.
    Open Alpha and create a new database in the directory where you renamed the files.
    Use Add table/set and add the table you find.
    You can explore this table like any other.

    Opening the table causes Alpha to create support files for it like any other. do not copy them back to your original database directory. Delete everything in the new directory as soon as you are through investigating so as not to confuse them with your actual database files. Use these instructions at your own risk.

    adg.zip
    There can be only one.

  7. #37
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: Extreme problem adding fields to a table.

    I understand your aversion to the issues which can arise with compacting a database with a corrupt memo file. There are discussions elsewhere about moving all memo fields to a table containing only a linking field and memo fields and then creating a set with a one to one link to the "parent" table where the memos were originally. I don't know if anyone still does that but the benefit is that should there be memo corruption only the child table is involved, not the other.
    There can be only one.

  8. #38
    Member preston2's Avatar
    Real Name
    Preston
    Join Date
    Nov 2011
    Posts
    764

    Default Re: Extreme problem adding fields to a table.

    Well the copy table will not work on the wo_header.dbf either. It is like it cannot see fields that are there.

    Guess it manually fixing all the customers stuff time.

  9. #39
    "Certified" Alphaholic DaveM's Avatar
    Real Name
    Dave Mason
    Join Date
    Jul 2000
    Location
    Hudson, FL
    Posts
    6,044

    Default Re: Extreme problem adding fields to a table.

    I compact about 3 times a day on average with a very large app. as soon as stuff starts going a bit goofy and a bunch of changes - compact.
    Get a cup of coffee.
    Dave Mason
    dave@aldadesktop.com
    Skype is dave.mason46

  10. #40
    Member preston2's Avatar
    Real Name
    Preston
    Join Date
    Nov 2011
    Posts
    764

    Default Re: Extreme problem adding fields to a table.

    Quote Originally Posted by DaveM View Post
    Get a cup of coffee.
    Now that is some good advice. Off to make a new pot now.

  11. #41
    "Certified" Alphaholic
    Real Name
    Tom Cone Jr
    Join Date
    Apr 2000
    Location
    Florida
    Posts
    23,317

    Default Re: Extreme problem adding fields to a table.

    Preston,

    Your function adds a list of "new" fields to the table in one step.

    Most of us handle this differently.

    We create a list of the "existing" fields in the table.
    We create a list of the "new" fields we want to add, if they're not there already.

    We do it one "new" field at a time, like this:
    - step through the list of "new" fields and for each...
    - check to see if the current "new" field is already in the table, if so do nothing
    - if not, then add that one field to the table and loop back to the "next" entry in your "new" field list
    - repeat until all the "new" fields have been checked and added or skipped.

    Of course, this entire sequence must occur while the script has exclusive read/write access to the table, so checking if the table is in use first is a pre-requisite.

    Adding new fields one at a time makes it much easier to figure out what happened if an error occurs.

    Hope this helps.

    -- tom
    Last edited by Tom Cone Jr; 09-04-2015 at 06:45 PM.

  12. #42
    Member preston2's Avatar
    Real Name
    Preston
    Join Date
    Nov 2011
    Posts
    764

    Default Re: Extreme problem adding fields to a table.

    Tom, the function I use is based off the ones I got from Cal a few years back. I have never had a problem doing it this way.

    I also did try just adding one field and it still did not work right.

  13. #43
    "Certified" Alphaholic G Gabriel's Avatar
    Real Name
    G. Gabriel
    Join Date
    Oct 2004
    Posts
    7,204

    Default Re: Extreme problem adding fields to a table.

    I ran your script on my system and had no problem with it. There is/are other external factor(s), scripts before or after that is causing this to happen. Without seeing the entire scheme it would be impossible to figure out what is happening.
    As an alternatives, you might try:
    1-table_restructure()
    In which case, you gather the existing fields, add them to the new fields and restructure the table.
    Or,
    2-Duplicate the table structure. Just the structure. Then add the new fields to the new table, append all records to the new table, then rename it to the original table.
    Of course, you need to backup first.

  14. #44
    "Certified" Alphaholic DaveM's Avatar
    Real Name
    Dave Mason
    Join Date
    Jul 2000
    Location
    Hudson, FL
    Posts
    6,044

    Default Re: Extreme problem adding fields to a table.

    99% of the time with new fields in tables for a remote client:
    I use my installer to:
    backup the old application completely to another NEW folder.
    clear the install folder
    install the files - 1st adb/dbfs/fpt
    run the 1st adb that will append all data from the backup and do any other needed
    install the true adb and all support files for the tables and the sets. Basically everything but the dbf/fpt files

    Client should be good to go at that point because I have fully tested the install on several computers before the send.

    minor - one or 2 table updates can be handled similarly, but not such a big operation.
    Dave Mason
    dave@aldadesktop.com
    Skype is dave.mason46

  15. #45
    Member preston2's Avatar
    Real Name
    Preston
    Join Date
    Nov 2011
    Posts
    764

    Default Re: Extreme problem adding fields to a table.

    Tracked the problem down to at least 1 corrupt file out of 3. Rebuilt those files and all is well.

    So it turns out nothing was wrong with the code at all.

    And I am now compacting my dev database although I now keep extra backup copies instead of the normal 2 copies just in case.

  16. #46
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: Extreme problem adding fields to a table.

    Did you determine where the corruption existed? Memo field, field rule, bad data, etc?
    There can be only one.

  17. #47
    Member preston2's Avatar
    Real Name
    Preston
    Join Date
    Nov 2011
    Posts
    764

    Default Re: Extreme problem adding fields to a table.

    Quote Originally Posted by Stan Mathews View Post
    Did you determine where the corruption existed? Memo field, field rule, bad data, etc?
    It was in either the wo_header.ddd , wo_header.ddm or wo_header.ddx file

    I took an older copy of those files and included them in the update instead of the newer ones. During the update the fields where added to the wo_header.dbf without any problems. I then added the few field rules for the new fields.

    I then used these files in the next test update and everything worked. Fields where added, all field rules where there.

    I never did find out which one of those 3 was corrupted just enough to not allow any fields to be added using a function as you cannot just replace one at a time. If you do Alpha will not start and gives a missing field rule error so you have to change all 3 at the same time.

  18. #48
    "Certified" Alphaholic DaveM's Avatar
    Real Name
    Dave Mason
    Join Date
    Jul 2000
    Location
    Hudson, FL
    Posts
    6,044

    Default Re: Extreme problem adding fields to a table.

    I would bet the ddm, but that goes with my lack of knowledge of the 3 files. I always suspected ddm wa actually a memo, ddx as an index and ddd is the other stuff.

    Any body that knows better or can elaborate? I am all ears.
    Dave Mason
    dave@aldadesktop.com
    Skype is dave.mason46

  19. #49
    Volunteer Moderator
    Real Name
    Alan Buchholz
    Join Date
    Oct 2000
    Location
    Delavan, Wisconsin
    Posts
    9,662

    Default Re: Extreme problem adding fields to a table.

    One of the 'magic' tricks for structure corruption is to duplicate the table/set and choose all the options (data-fieldrules....)

    Then test on the duplicate and usually the problems disappear...

    Then get rid of the original and rename the new table to the original table name..

    This seems to work when a data dictionary compact doesn't work...

    And since you have a backup with the problem, you could test that theory and report back....
    Al Buchholz
    Bookwood Systems, LTD
    Weekly QReportBuilder Webinars Thursday 1 pm CST

    Occam's Razor - KISS
    Normalize till it hurts - De-normalize till it works.
    Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
    When we triage a problem it is much easier to read sample systems than to read a mind.

  20. #50
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: Extreme problem adding fields to a table.

    Quote Originally Posted by DaveM View Post
    I would bet the ddm, but that goes with my lack of knowledge of the 3 files. I always suspected ddm wa actually a memo, ddx as an index and ddd is the other stuff.

    Any body that knows better or can elaborate? I am all ears.
    See post 36, this thread.
    Last edited by Al Buchholz; 09-08-2015 at 03:33 PM.
    There can be only one.

  21. #51
    "Certified" Alphaholic DaveM's Avatar
    Real Name
    Dave Mason
    Join Date
    Jul 2000
    Location
    Hudson, FL
    Posts
    6,044

    Default Re: Extreme problem adding fields to a table.

    Thanks Stan.
    Answered my questions and confirmed what I thought.
    Dave Mason
    dave@aldadesktop.com
    Skype is dave.mason46

Similar Threads

  1. Adding Fields to Existing SQL Table
    By Mike Parks in forum Mobile & Browser Applications
    Replies: 6
    Last Post: 03-25-2014, 12:53 PM
  2. Problem adding fields to a table
    By draxx in forum Alpha Five Version 5
    Replies: 3
    Last Post: 01-02-2009, 05:50 PM
  3. Adding Table Fields
    By Walter in forum Alpha Five Version 6
    Replies: 9
    Last Post: 03-13-2006, 02:09 PM
  4. Adding fields corrupts table
    By deano in forum Alpha Five Version 4
    Replies: 7
    Last Post: 03-23-2002, 12:16 PM
  5. Adding fields to an existing table via script
    By Daniel Weiss in forum Alpha Five Version 4
    Replies: 4
    Last Post: 09-28-2000, 12:40 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •