Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Storing Object Reference into table
Message
De
23/04/1999 10:34:07
Nancy Folsom
Pixel Dust Industries
Washington, États-Unis
 
 
À
22/04/1999 18:08:16
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00211333
Message ID:
00211505
Vues:
19
Stefan:
Thanks! This was fun. :) Here's just a quick example of how you *might* go about it. (As Craig says, you can't directly do it since there is no object-field type.)
*!* This example program will create a textbox object and then create a table for "storing" the object. 
*!* This is only intended to be an example of the tools available to accomplish the task.
*!*
LOCAL loTextBox, laTextBox(1), lci, _val, lcType
CLEAR ALL

*!* Create an object to use as an example
loTextBox = CREATEOBJECT('textbox')

*!* Create an array of the object's properties
AMEMBERS( laTextBox, loTextBox )

*!* Create a structural cursor 
CREATE TABLE TextBoxStructure ( field_name C(128), ;
								field_type C(1), ;
								field_len  N(3,0),;
								field_dec  N(3,0) )

*!* Loop through the array of object properties, adding a record for each in the structural table
FOR EACH lci IN laTextBox
	_val = 'loTextBox .' + lci 
	lcType = TYPE( _val )
	DO CASE
	CASE lcType = 'C'
		INSERT INTO TextBoxStructure (field_name, field_type, field_len, field_dec) ;
			VALUES (lci, 'C', 128, 0)
	CASE lcType = 'L'
		INSERT INTO TextBoxStructure (field_name, field_type, field_len, field_dec) ;
			VALUES (lci, 'L', 1, 0)
	CASE lcType = 'N'
		INSERT INTO TextBoxStructure (field_name, field_type, field_len, field_dec) ;
			VALUES (lci, 'N', 12, 3)
	OTHERWISE
	ENDCASE
NEXT lci 

*!* Now, create a table that maps the object structure
CREATE TEXTBOX FROM TextBoxStructure

*!* Store the object in the table
APPEND BLANK
GATHER NAME loTextBox
HTH

>How do i store an object reference into a table?
>TIA
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform