Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Table for FlexiFields, Base table fields have been chang
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00891246
Message ID:
00891380
Vues:
29
Hi

Thanks for the code. I especially liked the LEN > 255 idea. What I would like to know is can I do a CREATE SQL VIEW ViewName AS SELECT * FROM TableName or do I *have to* specify FieldNames. I also have this remote database handling, I am using FireBird as the database. Then I can do a DBSETPROP for each field in this just created view?

>Here it is a ample (that code I use to change my LOCAL view programaticly):
>
>
>m_data = get_path + "ZaplData"
>OPEN DATABASE (m_data)
>SET DATABASE TO (m_data)
>
>DECLARE new_flds[1]
>STORE 0 TO fld_new
>SELECT Sel_Lang
>GO TOP
>depo_vhod = "SELECT Nu.egn, Rab.ime, Nu.izs, Rab.fl_depo, Nu.bgod, ScanZapl(Rab.Egn) AS OsZp, Rab.Key1, Struct.Text"
>SCAN
>   depo_vhod = depo_vhod + ",Rab.Ime"          + STRZERO(Kod,2)+", Struct.Text"+ STRZERO(Kod,2)
>   DECLARE new_fld[fld_new]
>   new_fld[fld_new] = STRZERO(Kod,2)
>ENDSCAN
>
>depo_vhod = depo_vhod + " FROM zapldata!nu INNER JOIN zapldata!rab ON  Nu.egn = Rab.egn INNER JOIN zapldata!Struct ON Rab.egn = Struct.egn WHERE Nu.kod = ?__nKod .AND. .NOT. Rab.NoZapl ORDER BY Rab.Ime"
>
>IF LEN(depo_vhod) > 255
>   depo_vhod = "CREATE SQL VIEW DepoVhod AS " + depo_vhod
>   m_file  = dloc + "ViewProg.PRG"
>   m_file1 = dloc + "ViewProg.FXP"
>   STRTOFILE(depo_vhod, m_file)
>   COMPILE (m_file)
>   DO (m_file1)
>   ERASE (m_file)
>   ERASE (m_file1)
>ELSE
>   CREATE SQL VIEW DepoVhod AS &depo_vhod
>ENDIF
>
>v_tables  = "ZaplData!Nu,ZaplData!Rab"
>
>SetPropView("DepoVhod", "__nKod, 'N'")
>
>DBSETPROP("DepoVhod.Egn"    , "Field", "KeyField"  , .t.)
>DBSETPROP("DepoVhod.Egn"    , "Field", "Updatable" , .t.)
>DBSETPROP("DepoVhod.Egn"    , "Field", "UpdateName", "ZaplData!Nu.Egn")
>DBSETPROP("DepoVhod.Egn"    , "Field", "DataType" , "C(10)")
>
>DBSETPROP("DepoVhod.bGod"   , "Field", "KeyField"  , .t.)
>DBSETPROP("DepoVhod.bGod"   , "Field", "Updatable" , .t.)
>DBSETPROP("DepoVhod.bGod"   , "Field", "UpdateName", "ZaplData!Nu.bGod")
>DBSETPROP("DepoVhod.bGod"   , "Field", "DataType"  , "N(4)")
>
>DBSETPROP("DepoVhod.Fl_Depo", "Field", "KeyField", .t.)
>DBSETPROP("DepoVhod.Fl_Depo", "Field", "Updatable", .t.)
>DBSETPROP("DepoVhod.Fl_Depo", "Field", "UpdateName", "ZaplData!Rab.Fl_Depo")
>DBSETPROP("DepoVhod.Fl_Depo", "Field", "DataType"  , "L(1)")
>
>DBSETPROP("DepoVhod.Ime", "Field", "KeyField", .t.)
>DBSETPROP("DepoVhod.Ime", "Field", "Updatable", .t.)
>DBSETPROP("DepoVhod.Ime", "Field", "UpdateName", "ZaplData!Rab.Ime")
>DBSETPROP("DepoVhod.Ime", "Field", "DataType"  , "C(40)")
>
>DBSETPROP("DepoVhod.Izs", 'Field', 'KeyField', .T.)
>DBSETPROP("DepoVhod.Izs", 'Field', 'Updatable', .T.)
>DBSETPROP("DepoVhod.Izs", 'Field', 'UpdateName', 'ZaplData!Nu.Izs')
>DBSETPROP("DepoVhod.Izs", 'Field', 'DataType', "N(12,2)")
>
>DBSETPROP("DepoVhod.Oszp", 'Field', 'KeyField', .F.)
>DBSETPROP("DepoVhod.Oszp", 'Field', 'Updatable', .F.)
>DBSETPROP("DepoVhod.Oszp", 'Field', 'UpdateName', '')
>DBSETPROP("DepoVhod.Oszp", 'Field', 'DataType', "N(13,2)")
>
>FOR asd = 1 TO fld_new
>    DBSETPROP("DepoVhod.Ime"+new_fld[asd], 'Field', 'KeyField', .T.)
>    DBSETPROP("DepoVhod.Ime"+new_fld[asd], 'Field', 'Updatable', .T.)
>    DBSETPROP("DepoVhod.Ime"+new_fld[asd], 'Field', 'UpdateName', 'zapldata!Rab.Ime'+new_fld[asd])
>    DBSETPROP("DepoVhod.Ime"+new_fld[asd], 'Field', 'DataType', "C(40)")
>
>    DBSETPROP("DepoVhod.Text"+new_fld[asd], 'Field', 'KeyField', .T.)
>    DBSETPROP("DepoVhod.Text"+new_fld[asd], 'Field', 'Updatable', .f.)
>    DBSETPROP("DepoVhod.Text"+new_fld[asd], 'Field', 'UpdateName', 'zapldata!Struct.Text'+new_fld[asd])
>    DBSETPROP("DepoVhod.Text"+new_fld[asd], 'Field', 'DataType', "C(60)")
>NEXT
>SET DATABASE TO
>CLOSE DATA ALL
>
>FUNCTION SetPropView(which_view, param_lst)
>
>DBSETPROP(which_view, 'View', 'UpdateType', 1)
>DBSETPROP(which_view, 'View', 'WhereType', 3)
>DBSETPROP(which_view, 'View', 'FetchMemo', .F.)
>DBSETPROP(which_view, 'View', 'SendUpdates', .T.)
>DBSETPROP(which_view, 'View', 'UseMemoSize', 255)
>DBSETPROP(which_view, 'View', 'FetchSize', 100)
>DBSETPROP(which_view, 'View', 'MaxRecords', -1)
>DBSETPROP(which_view, 'View', 'Tables', v_tables)
>DBSETPROP(which_view, 'View', 'Prepared', .F.)
>DBSETPROP(which_view, 'View', 'CompareMemo', .T.)
>DBSETPROP(which_view, 'View', 'FetchAsNeeded', .F.)
>DBSETPROP(which_view, 'View', 'FetchSize', 100)
>DBSETPROP(which_view, 'View', 'ParameterList', param_lst)
>DBSETPROP(which_view, 'View', 'Comment', "")
>DBSETPROP(which_view, 'View', 'BatchUpdateCount', 1)
>DBSETPROP(which_view, 'View', 'ShareConnection', .F.)
>
>RETURN
>
Regards
Bhavbhuti
___________________________________________
Softwares for Indian Businesses at:
http://venussoftop.tripod.com
___________________________________________
venussoftop@gmail.com
___________________________________________
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform