Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.clipper.visual-objects > #11279
| From | "Jamal" <noooospam@example.com> |
|---|---|
| Newsgroups | comp.lang.clipper.visual-objects |
| Subject | Re: Database ACCESS/ASSIGN with function |
| Date | 2018-01-09 13:19 -0500 |
| Organization | albasani.net |
| Message-ID | <p3312m$tab$1@news.albasani.net> (permalink) |
| References | <72d34f83-34d6-4050-9e2b-d148bbed72e9@googlegroups.com> |
Besides the other ideas and to reduce amount of generated code and instead
of creating assigns and accesses for all fields, I would subclass the
dbServer class and create my own FIELDGET() and FIELDPUT() methods.
For example:
CLASS MyNIPDBServer INHERIT DBServer
Method Init(.....) CLASS MyNIPDBServer
// init code
RETURN SELF
METHOD FieldGet(uField) CLASS MyNIPDBServer
RETURN DekodujNIP(SELF:FIELDGET(uField))
METHOD FieldPut(uField, uValue) CLASS MyNIPDBServer
RETURN SELF:FIELDPUT(uField, KodujNIP(uValue))
Jamal
"Grzegorz R." wrote in message
news:72d34f83-34d6-4050-9e2b-d148bbed72e9@googlegroups.com...
Hi Folks
I have a database field which has to be encoded/decoded each time it is
assigned/accessed (like cypher/decypher). I have both functions and use it
"within" database code like this (written by hand):
ACCESS NIP AS STRING PASCAL CLASS KLIENCI
RETURN DekodujNIP(SELF:FIELDGET(#NIP))
ASSIGN NIP(uValue AS STRING) AS STRING PASCAL CLASS KLIENCI
RETURN SELF:FIELDPUT(#NIP, KodujNIP(uValue))
My problem is that if I change a structure of database in IDE both functions
are reset to standard ie functions are removed:
ACCESS NIP AS STRING PASCAL CLASS KLIENCI
RETURN SELF:FIELDGET(#NIP)
ASSIGN NIP(uValue AS STRING) AS STRING PASCAL CLASS KLIENCI
RETURN SELF:FIELDPUT(#NIP, uValue)
Of course I can use both functions in each place as use field NIP but as far
as coding/decoding happens always it is wise to use it in deepest point ie
database.
IF I try to defice virtual access like
ACCESS GetNIP AS STRING PASCAL CLASS KLIENCI
RETURN DekodujNIP(SELF:FIELDGET(#NIP))
I get "insuficient data for diagnostics 52999"
method like
METHOD GetNIP() AS STRING PASCAL CLASS KLIENCI
RETURN DekodujNIP(SELF:FIELDGET(#NIP))
works ok and is not destroyed at database structure change but is not as
elegant as direct field operations.
Is there any way to get what I want?
Regards
Gregory
Back to comp.lang.clipper.visual-objects | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Database ACCESS/ASSIGN with function "Grzegorz R." <ramotny64@gmail.com> - 2018-01-09 08:01 -0800
Re: Database ACCESS/ASSIGN with function JohnMartens <martens@tennishulp.info> - 2018-01-09 17:11 +0100
Re: Database ACCESS/ASSIGN with function Karl Faller <mail_withoutthat_@_drei-f_andthat_.de> - 2018-01-09 17:56 +0100
Re: Database ACCESS/ASSIGN with function "Jamal" <noooospam@example.com> - 2018-01-09 13:19 -0500
Re: Database ACCESS/ASSIGN with function "Grzegorz R." <ramotny64@gmail.com> - 2018-01-09 23:23 -0800
Re: Database ACCESS/ASSIGN with function "Jamal" <noooospam@example.com> - 2018-01-10 10:29 -0500
Re: Database ACCESS/ASSIGN with function "Grzegorz R." <ramotny64@gmail.com> - 2018-01-21 03:25 -0800
csiph-web