Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CursorAdapter into mySQL
Message
General information
Forum:
Visual FoxPro
Category:
Other
Title:
CursorAdapter into mySQL
Miscellaneous
Thread ID:
00878860
Message ID:
00878860
Views:
64
Hi,

I have a large amount of information from a 2.x fox database that I want
to scan & insert into a mysql database so that I have more control over
the results than through the sqldump. I also hoped to be able to use
the same process when bringing in daily activity.


The steps I have taken so far to bring me to the edge of my emotional cliff
1. I have brought in the data into a Fox Cursor in VFP8 SP1.
2. I have also created a CursorAdapter to the mySQL table which does display the existing data using the builder. The code generated in the init method follows:
local llReturn
do case
	case not pemstatus(This, '__VFPSetup', 5)
		This.AddProperty('__VFPSetup', 0)
	case This.__VFPSetup = 2
		This.__VFPSetup = 0
		return
endcase
llReturn = dodefault()
*** Setup code: DO NOT REMOVE
***<SelectCmd>
text to This.SelectCmd noshow
select lagency.* from lagency
endtext
***</SelectCmd>
***<KeyFieldList>
text to This.KeyFieldList noshow
AGENCYID
endtext
***</KeyFieldList>
***<UpdateNameList>
text to This.UpdateNameList noshow
AGENCYID lagency.AGENCYID, AGENCYNUMBER lagency.AGENCYNUMBER, AGENCYNAME lagency.AGENCYNAME, TRANDATE lagency.TRANDATE, ACTIVE lagency.ACTIVE, USERID lagency.USERID
endtext
***</UpdateNameList>
***<UpdatableFieldList>
text to This.UpdatableFieldList noshow
AGENCYNUMBER, AGENCYNAME, TRANDATE, ACTIVE, USERID
endtext
***</UpdatableFieldList>
*** End of Setup code: DO NOT REMOVE
if This.__VFPSetup = 1
	This.__VFPSetup = 2
endif
return llReturn
As I said the CursorAdapter cursor is displayed.
I then scan the Fox Cursor with the following code
USE lAgency
	SCAN
		INSERT INTO caAgency (AgencyNumber, ;
			AgencyName, ;
			TranDate, Active) ;
			VALUES (lAgency.AgencyNumber, ;
			lAgency.AgencyName, ;
			TTOD(lAgency.TranDate),1)
		SELECT lAgency
	ENDSCAN
The TranDate (Date) and Active (TinyInt fields are updated correctly but the Character fields agencyNumber & agencyname (VarChar) do not get updated.
The schema for the CA is as follows:
AGENCYID I, AGENCYNUMBER C(4), AGENCYNAME C(60), TRANDATE D, ACTIVE I, USERID I

I have tried changing the Character fields to different types (char, tinytext, medtext, text) with no change in the results.

If I look at the cursor for the CursorAdaptor I am allowed to enter values in the AgencyNumber and AgencyName fields but when I move out of the field the changes are lost. On the Trandate, Active and UserID fields my changes stick.

I honestly thought I might have trouble converting the date but text fields? Any ideas or code samples would be greatly appreciated.

Sincerely,

Michael
Send me an email when the shouting stops
Next
Reply
Map
View

Click here to load this message in the networking platform