beanbrain
Programmer
- Dec 31, 2001
- 170
I'm going to try posting this here though for all intents and purposes this is really a Paradox question. Unfortunately this deals with the latest release of Paradox (version 10) which does not seem to work quite as well as the version we are trying to replace (Paradox 7.0). This is about Sybase Adaptive server. The code I'm trying to execute is below. This works beautifully in 7.0 and bombs horribly in 10. Any hints would be greatly appreciated. Oh not many Paradox programmers get into this which is why I'm posting it here.
[tt]method run(var eventInfo Event)
var
q Query
s String
ar Array[] String
tbl Table
tc tCursor
dDb, myDb Database
s1 SQL
dbParmsDA DynArray[] AnyType
firstSes,
secondSes Session
endVar
disablePreviousError(Yes)
errorClear()
message("Updating SPersonnel"
tbl.attach(":busoff:SPersonnel"
if not tbl.empty() then
message("Unable to empty SPersonnel table."
return
endIf
tbl.unAttach()
q = Query
ANSWER: RIV:ANSWER.DB
SPersonnel.db | Last Name | First Name | SSN | Employee ID |
Insert | _join1 | _join2 | _join3 | _join4 |
SPersonnel.db | ISI Employment Start Date | ISI Employment End Date | Email |
| _join5 | _join6 | _join8 |
SPersonnel.db | Supervisor | Division Number | Staff Category |
| _join7 | _join9 | _join10 |
SPersonnel.db | Visitor Number |
| blank |
ersonnel:Entity.db | EmplNo | FirstName |
| _join4, not X.., not N.., not V.. | _join2 |
ersonnel:Entity.db | LastName | EmpStart | EmpTerm |
| _join1 | _join5 | _join6, blank or >=7/1/2002 |
ersonnel:Entity.db | SSN | StaffCat | Division | PrjLdr | Email |
| _join3 | _join10 | _join9 | _join7 | _join8 |
EndQuery
if not q.executeQBE() then
message("Unable to insert Records to SPersonnel."
return
endIf
q = Query
ANSWER: RIV:ANSWER.DB
SPersonnel.db | Last Name | First Name | SSN | Employee ID |
Insert | _join1 | _join2 | _join3 | blank |
SPersonnel.db | ISI Employment Start Date | ISI Employment End Date | Email |
| _join5 | _join6 | _join8 |
SPersonnel.db | Supervisor | Division Number | Staff Category |
| _join7 | _join9 | _join10 |
SPersonnel.db | Visitor Number |
| _join4 |
ersonnel:Entity.db | EmplNo | FirstName |
| _join4, V.., not X.., not N.. | _join2 |
ersonnel:Entity.db | LastName | EmpStart | EmpTerm |
| _join1 | _join5 | _join6, blank or >=7/1/2002 |
ersonnel:Entity.db | SSN | StaffCat | Division | PrjLdr | Email |
| _join3 | _join10 | _join9 | _join7 | _join8 |
EndQuery
if not q.executeQBE() then
message("Unable to insert Records to SPersonnel."
return
endIf
message("Updating SAccount"
tbl.attach(":busoff:SAccount"
if not tbl.empty() then
message("Unable to empty SAccount table."
return
endIf
tbl.unAttach()
; populate the intermediate table for Accounts
q = Query
ANSWER: RIV:ANSWER.DB
SAccount.DB | Account Number | Account Name | Burden Center | Award Number |
Insert | _join1 | _join2 | _join3 | _join4 |
SAccount.DB | Account Status ID | Account Start Date | Account End Date |
| _join5 | _join6 | _join7 |
SAccount.DB | Account Manager |
| _join8 |
:Contract:Chart.DB | AcctNo | AcctName | Location | StrtDate |
| _join1 | _join2 | _join3 | _join6 |
:Contract:Chart.DB | EndDate | ProjLdr | AwardNo | AcctStatus |
| _join7, >6/30/2002 | _join8 | _join4 | _join5 |
EndQuery
if not q.executeQBE() then
message("Unable to insert Records to SAccount."
return
endIf
; using tCursor scan SAccount for multiple ProjMgr names in field and truncate at "/".
message("Reducing Project Manager name."
tc.open(":busoff:SAccount.db"
tc.edit()
scan tc :
s = tc."Account Manager"
s.breakApart(ar,"/"
tc."Account Manager" = ar[1]
endScan
tc.endEdit()
tc.close()
if not exportASCIIVar ( "SPersonnel.db", "SPersonnel.txt", ",", "\"", False, True ) then
message("Error Export","Unable to Export SPersonnel.txt."
return
endIf
if not exportASCIIVar ( "SAccount.db", "SAccount.txt", ",", "\"", False, True ) then
message("Error Exporting","Unable to Export SAccount.txt."
return
endIf
message("Writing to SyBase P_Account."
removeAllPasswords()
firstSes.open()
;firstSes.addPassword("Paradox"
dbParmsDA"OPEN MODE" = "READ/WRITE"
dbParmsDA"Password" = "Paradox"
dbParmsDA"SQLPASSTHRU" = "SHARED AUTOCOMMIT"
if not dDb.open(":bo_personnel:",firstSes, dbParmsDA) then ; (remote is an alias defined elsewhere)
message("Unable to connect to :bo_personnel: database."
return
endIf
message("Writing to SQL SyBase P_Personnel."
s1.readFromFile("SPersonnel.sql"
if not executeSQL(dDb, s1) then
message("Unable to run SPersonnel SQL query."
firstSes.close()
return
endIf
message("Writing to SQL SyBase P_Account."
s1.readFromFile("SAccount.sql"
if not executeSQL(dDb, s1) then
message("Unable to run SAccount SQL query."
firstSes.close()
return
endIf
dDb.close()
message("Done..."
exit()
tc.open("LastMsgDate.db"
tc.edit()
tc."LastDirUpdateDate" = today()
tc.endEdit()
tc.close()
endMethod
[/tt]
[tt]method run(var eventInfo Event)
var
q Query
s String
ar Array[] String
tbl Table
tc tCursor
dDb, myDb Database
s1 SQL
dbParmsDA DynArray[] AnyType
firstSes,
secondSes Session
endVar
disablePreviousError(Yes)
errorClear()
message("Updating SPersonnel"
tbl.attach(":busoff:SPersonnel"
if not tbl.empty() then
message("Unable to empty SPersonnel table."
return
endIf
tbl.unAttach()
q = Query
ANSWER: RIV:ANSWER.DB
SPersonnel.db | Last Name | First Name | SSN | Employee ID |
Insert | _join1 | _join2 | _join3 | _join4 |
SPersonnel.db | ISI Employment Start Date | ISI Employment End Date | Email |
| _join5 | _join6 | _join8 |
SPersonnel.db | Supervisor | Division Number | Staff Category |
| _join7 | _join9 | _join10 |
SPersonnel.db | Visitor Number |
| blank |
ersonnel:Entity.db | EmplNo | FirstName |
| _join4, not X.., not N.., not V.. | _join2 |
ersonnel:Entity.db | LastName | EmpStart | EmpTerm |
| _join1 | _join5 | _join6, blank or >=7/1/2002 |
ersonnel:Entity.db | SSN | StaffCat | Division | PrjLdr | Email |
| _join3 | _join10 | _join9 | _join7 | _join8 |
EndQuery
if not q.executeQBE() then
message("Unable to insert Records to SPersonnel."
return
endIf
q = Query
ANSWER: RIV:ANSWER.DB
SPersonnel.db | Last Name | First Name | SSN | Employee ID |
Insert | _join1 | _join2 | _join3 | blank |
SPersonnel.db | ISI Employment Start Date | ISI Employment End Date | Email |
| _join5 | _join6 | _join8 |
SPersonnel.db | Supervisor | Division Number | Staff Category |
| _join7 | _join9 | _join10 |
SPersonnel.db | Visitor Number |
| _join4 |
ersonnel:Entity.db | EmplNo | FirstName |
| _join4, V.., not X.., not N.. | _join2 |
ersonnel:Entity.db | LastName | EmpStart | EmpTerm |
| _join1 | _join5 | _join6, blank or >=7/1/2002 |
ersonnel:Entity.db | SSN | StaffCat | Division | PrjLdr | Email |
| _join3 | _join10 | _join9 | _join7 | _join8 |
EndQuery
if not q.executeQBE() then
message("Unable to insert Records to SPersonnel."
return
endIf
message("Updating SAccount"
tbl.attach(":busoff:SAccount"
if not tbl.empty() then
message("Unable to empty SAccount table."
return
endIf
tbl.unAttach()
; populate the intermediate table for Accounts
q = Query
ANSWER: RIV:ANSWER.DB
SAccount.DB | Account Number | Account Name | Burden Center | Award Number |
Insert | _join1 | _join2 | _join3 | _join4 |
SAccount.DB | Account Status ID | Account Start Date | Account End Date |
| _join5 | _join6 | _join7 |
SAccount.DB | Account Manager |
| _join8 |
:Contract:Chart.DB | AcctNo | AcctName | Location | StrtDate |
| _join1 | _join2 | _join3 | _join6 |
:Contract:Chart.DB | EndDate | ProjLdr | AwardNo | AcctStatus |
| _join7, >6/30/2002 | _join8 | _join4 | _join5 |
EndQuery
if not q.executeQBE() then
message("Unable to insert Records to SAccount."
return
endIf
; using tCursor scan SAccount for multiple ProjMgr names in field and truncate at "/".
message("Reducing Project Manager name."
tc.open(":busoff:SAccount.db"
tc.edit()
scan tc :
s = tc."Account Manager"
s.breakApart(ar,"/"
tc."Account Manager" = ar[1]
endScan
tc.endEdit()
tc.close()
if not exportASCIIVar ( "SPersonnel.db", "SPersonnel.txt", ",", "\"", False, True ) then
message("Error Export","Unable to Export SPersonnel.txt."
return
endIf
if not exportASCIIVar ( "SAccount.db", "SAccount.txt", ",", "\"", False, True ) then
message("Error Exporting","Unable to Export SAccount.txt."
return
endIf
message("Writing to SyBase P_Account."
removeAllPasswords()
firstSes.open()
;firstSes.addPassword("Paradox"
dbParmsDA"OPEN MODE" = "READ/WRITE"
dbParmsDA"Password" = "Paradox"
dbParmsDA"SQLPASSTHRU" = "SHARED AUTOCOMMIT"
if not dDb.open(":bo_personnel:",firstSes, dbParmsDA) then ; (remote is an alias defined elsewhere)
message("Unable to connect to :bo_personnel: database."
return
endIf
message("Writing to SQL SyBase P_Personnel."
s1.readFromFile("SPersonnel.sql"
if not executeSQL(dDb, s1) then
message("Unable to run SPersonnel SQL query."
firstSes.close()
return
endIf
message("Writing to SQL SyBase P_Account."
s1.readFromFile("SAccount.sql"
if not executeSQL(dDb, s1) then
message("Unable to run SAccount SQL query."
firstSes.close()
return
endIf
dDb.close()
message("Done..."
exit()
tc.open("LastMsgDate.db"
tc.edit()
tc."LastDirUpdateDate" = today()
tc.endEdit()
tc.close()
endMethod
[/tt]