Alpha Video Training
Results 1 to 4 of 4

Thread: Multiple databases in different install paths pack tables issue

  1. #1
    Member
    Real Name
    Steven Greer
    Join Date
    Jun 2008
    Location
    Manchester,PA
    Posts
    379

    Default Multiple databases in different install paths pack tables issue

    I have 2 of the same databases installed in 2 different locations on the machine one is c:\housing and the other is c:\housing2 I use local tables to store data pulled from sql server so I run a script to delete old data and pack tables when a new record is pulled. I'm having a problem with pack tables when I have both of the databases open because they have the same name alpha wants to try and pack tables by reference name and I'm getting unable to pack because table is in use error. I kinda understand why this happens so I modified my code to try and pack just the tables for the database calling the script but still getting errors. Is there a way to work around this problem? My code is posted for review.

    Code:
    'Date Created: 03-Feb-2017 05:08:25 PM
    'Last Updated: 23-Oct-2018 12:58:17 AM
    'Created By  : Hubby
    'Updated By  : steve
    dim shared rtbl as p
    dim shared tname as c
    tname=a5.get_path() + chr(92)+"sqlclientd.dbf"
    rtbl = table.open(tname)
    dim shared tbl as P
    query.filter = ""
    query.order = "Recno()"
    qry_ca_cust = rtbl.query_create()
    'Delete all records in current query by omitting the optional filter expression
    if table.in_use(tname)=.F.
    rtbl.delete_range()
    rtbl.pack()
    rtbl.close()
    end if
    
    delete tname
    delete rtbl
    
    dim shared rtbl as p
    dim shared tname as c
    tname=a5.get_path() + chr(92)+"sqlmiti_notes.dbf"
    rtbl = table.open(tname)
    dim shared tbl as P
    query.filter = ""
    query.order = "Recno()"
    qry_ca_cust = rtbl.query_create()
    'Delete all records in current query by omitting the optional filter expression
    if table.in_use(tname)=.F.
    rtbl.delete_range()
    rtbl.pack()
    rtbl.close()
    end if
    delete tname
    delete rtbl
    
    dim shared rtbl as p
    dim shared tname as c
    tname=a5.get_path() + chr(92)+"sqlenrol_notes.dbf"
    rtbl = table.open(tname)
    dim shared tbl as P
    query.filter = ""
    query.order = "Recno()"
    qry_ca_cust = rtbl.query_create()
    'Delete all records in current query by omitting the optional filter expression
    if table.in_use(tname)=.F.
    rtbl.delete_range()
    rtbl.pack()
    rtbl.close()
    end if
    delete tname
    delete rtbl
    
    dim shared rtbl as p
    dim shared tname as c
    tname=a5.get_path() + chr(92)+"sqlenroll.dbf"
    rtbl = table.open(tname)
    dim shared tbl as P
    query.filter = ""
    query.order = "Recno()"
    qry_ca_cust = rtbl.query_create()
    'Delete all records in current query by omitting the optional filter expression
    if table.in_use(tname)=.F.
    rtbl.delete_range()
    rtbl.pack()
    rtbl.close()
    end if
    delete tname
    delete rtbl
    dim shared rtbl as p
    dim shared tname as c
    tname=a5.get_path() + chr(92)+"sqlfinance.dbf"
    rtbl = table.open(tname)
    dim shared tbl as P
    query.filter = ""
    query.order = "Recno()"
    qry_ca_cust = rtbl.query_create()
    'Delete all records in current query by omitting the optional filter expression
    if table.in_use(tname)=.F.
    rtbl.delete_range()
    rtbl.pack()
    rtbl.close()
    end if
    
    delete tname
    delete rtbl
    dim shared rtbl as p
    dim shared tname as c
    tname=a5.get_path() + chr(92)+"sqlccb_info.dbf"
    rtbl = table.open(tname)
    dim shared tbl as P
    query.filter = ""
    query.order = "Recno()"
    qry_ca_cust = rtbl.query_create()
    'Delete all records in current query by omitting the optional filter expression
    if table.in_use(tname)=.F.
    rtbl.delete_range()
    rtbl.pack()
    rtbl.close()
    end if
    
    delete tname
    delete rtbl
    dim shared rtbl as p
    dim shared tname as c
    tname=a5.get_path() + chr(92)+"sqldocs.dbf"
    rtbl = table.open(tname)
    dim shared tbl as P
    query.filter = ""
    query.order = "Recno()"
    qry_ca_cust = rtbl.query_create()
    'Delete all records in current query by omitting the optional filter expression
    if table.in_use(tname)=.F.
    rtbl.delete_range()
    rtbl.pack()
    rtbl.close()
    end if
    delete tname
    delete rtbl
    dim shared rtbl as p
    dim shared tname as c
    tname=a5.get_path() + chr(92)+"sqlintake.dbf"
    rtbl = table.open(tname)
    dim shared tbl as P
    query.filter = ""
    query.order = "Recno()"
    qry_ca_cust = rtbl.query_create()
    'Delete all records in current query by omitting the optional filter expression
    if table.in_use(tname)=.F.
    rtbl.delete_range()
    rtbl.pack()
    rtbl.close()
    end if
    delete tname
    delete rtbl 
    dim shared rtbl as p
    dim shared tname as c
    tname=a5.get_path() + chr(92)+"sqldeals.dbf"
    rtbl = table.open(tname)
    dim shared tbl as P
    query.filter = ""
    query.order = "Recno()"
    qry_ca_cust = rtbl.query_create()
    'Delete all records in current query by omitting the optional filter expression
    if table.in_use(tname)=.F.
    rtbl.delete_range()
    rtbl.pack()
    rtbl.close()
    end if
    delete tname
    delete rtbl 
    dim shared rtbl as p
    dim shared tname as c
    tname=a5.get_path() + chr(92)+"paytoday.dbf"
    rtbl = table.open(tname)
    dim shared tbl as P
    query.filter = ""
    query.order = "Recno()"
    qry_ca_cust = rtbl.query_create()
    'Delete all records in current query by omitting the optional filter expression
    if table.in_use(tname)=.F.
    rtbl.delete_range()
    rtbl.pack()
    rtbl.close()
    end if
    delete tname
    delete rtbl    
    dim shared rtbl as p
    dim shared tname as c
    tname=a5.get_path() + chr(92)+"master.dbf"
    rtbl = table.open(tname)
    dim shared tbl as P
    query.filter = ""
    query.order = "Recno()"
    qry_ca_cust = rtbl.query_create()
    'Delete all records in current query by omitting the optional filter expression
    if table.in_use(tname)=.F.
    rtbl.delete_range()
    rtbl.pack()
    rtbl.close()
    end if
    delete tname
    delete rtbl 
    delete tname
    delete rtbl    
    dim shared rtbl as p
    dim shared tname as c
    tname=a5.get_path() + chr(92)+"rep_payout.dbf"
    rtbl = table.open(tname)
    dim shared tbl as P
    query.filter = ""
    query.order = "Recno()"
    qry_ca_cust = rtbl.query_create()
    'Delete all records in current query by omitting the optional filter expression
    if table.in_use(tname)=.F.
    rtbl.delete_range()
    rtbl.pack()
    rtbl.close()
    end if

  2. #2
    Member
    Real Name
    Steven Greer
    Join Date
    Jun 2008
    Location
    Manchester,PA
    Posts
    379

    Default Re: Multiple databases in different install paths pack tables issue

    What I have tried since posting so far. I tried opening table in it's own session.. tried to just comment out the pack and just delete the records, however it deletes the data from both databases tables. I was reading about a_variables can't find the spot at the moment in help where I was.*edit* A_DB_CURRENT_PATH*** Found it There has to be something to identify the current app and assoc tables. The Branding Tool That was being used a few years back I'm beginning to wonder if that might be a way to go, since it runs and changes all the alpha paths and things that one would miss trying on my own.

  3. #3
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,683

    Default Re: Multiple databases in different install paths pack tables issue

    I think its your use of a5.get_path() which is always going to be the current path for the database you are working from. Perhaps you could hard code the paths to each file and put them into variables (patha, pathb) and then construct your pointers that way.
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

  4. #4
    Member
    Real Name
    Steven Greer
    Join Date
    Jun 2008
    Location
    Manchester,PA
    Posts
    379

    Default Re: Multiple databases in different install paths pack tables issue

    I tried several different way ended up just making some more tables to get the data the the 2nd database would use. No matter how I did it alpha wanted to delete records in both databases in separate folder.

Similar Threads

  1. Install A5v11 on server which install? Multiple domains?
    By techscout in forum Application Server Version 11 - Web/Browser Applications
    Replies: 3
    Last Post: 03-11-2012, 12:52 AM
  2. Multiple users with multiple databases
    By jbk in forum Alpha Five Version 9 - Desktop Applications
    Replies: 23
    Last Post: 02-26-2009, 08:41 AM
  3. Alpha won't let me duplicate tables as relative file paths
    By spain246 in forum Alpha Five Version 7
    Replies: 8
    Last Post: 11-06-2007, 03:37 PM
  4. multiple databases
    By tbrians in forum Alpha Five Version 4
    Replies: 3
    Last Post: 03-02-2001, 10:44 AM
  5. Multiple Databases
    By Arthur Casse in forum Alpha Five Version 4
    Replies: 2
    Last Post: 11-24-2000, 10:50 AM

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
  •