Page 1 of 2

ADS NOT SUPPORT DECRYPT AND ENCRYPT FROM FIVEWIN

PostPosted: Tue Oct 09, 2012 6:19 am
by kok joek hoa
Dear All,

Can someone help me?
I'm trying to convert all my program to ADS.

how to use function encrypt and decrypt from fivewin for indexing in ADS.


Code: Select all  Expand view
#INCLUDE "FiveWin.ch"
#include "Directry.ch"
#INCLUDE "ORD.CH"
#include "ads.ch"

extern dbfcdx
REQUEST     ADS             ,;
            ADSKeyno        ,;
            ADSKeycount     ,;
            AdsGetRelKeyPos ,;
            AdsSetRelKeyPos
           
           
static oWnd

*-- FUNCTION -----------------------------------------------------------------
* Name........: Main
* Description.:
* Parameters..:
* Return value: nil
* Author......:
*-----------------------------------------------------------------------------
function Main()
       
       SET(_SET_OPTIMIZE,.T.)
       request DBFCDX
       //-----setting ads
       Rddsetdefault("ADS")
       ADSSETSERVERTYPE(7)
       ADSSETFILETYPE(ADS_CDX )
       AdsSetDateFormat("DD/MM/YYYY")
       AdsSetEpoch("01/01/2000")
       ADSRightsCheck(.F.)
       ADSLocking( .T. )
       
   
      use customer new via 'ADS'
      index on ENCRYPT(first,'TEST')  tag FI TO CUSTOMER
      BROWSE()
return nil


 


thanks

kok

Re: ADS NOT SUPPORT DECRYPT AND ENCRYPT FROM FIVEWIN

PostPosted: Tue Oct 09, 2012 8:10 am
by richard-service
Hi Kok,

You mean it...
Code: Select all  Expand view

cAlias := GiveAlias ( cAlias )
USE (cFile) NEW SHARED ALIAS (cAlias) VIA "ADS"
AdsEnableEncryption( cWord )
cAlias := Alias()

      IF !File ( cCDX )
         IF (cAlias)->(FLock())
            INDEX ON FIELD->UNIT_NO   TAG UnitMsf1 TO ( cCDX ) FOR !Deleted()
            INDEX ON FIELD->UNIT_CNM  TAG UnitMsf2 TO ( cCDX ) FOR !Deleted()
            INDEX ON FIELD->UNIT_DES  TAG UnitMsf3 TO ( cCDX ) FOR !Deleted()
            INDEX ON FIELD->UNIT_ENM  TAG UnitMsf4 TO ( cCDX ) FOR !Deleted()
            (cAlias)->(DbUnLock())
         ENDIF
         SET INDEX TO ( cCDX )
      ENDIF

      SET ORDER TO "UnitMsf1"
      (cAlias)->( DBGoTop() )
 

Re: ADS NOT SUPPORT DECRYPT AND ENCRYPT FROM FIVEWIN

PostPosted: Tue Oct 09, 2012 8:19 am
by kok joek hoa
Hi Richard ,

Thank for your reply,
but I don't want use function from ADS , I must use function encrypt from fivewin.

regards,

kok

Re: ADS NOT SUPPORT DECRYPT AND ENCRYPT FROM FIVEWIN

PostPosted: Tue Oct 09, 2012 12:35 pm
by Marcelo Via Giglio
Hola,

I don´t know why you want to use encrypt function from FW, but if you really need it, I think you can create a extra field with encrypted data and create the index over this field

regards

Marcelo

Re: ADS NOT SUPPORT DECRYPT AND ENCRYPT FROM FIVEWIN

PostPosted: Tue Oct 09, 2012 1:11 pm
by kok joek hoa
Hi Marcelo,
All my new programs, I use function from ADS.
I need encrypt from fivewin for my old program that use this function for indexing.

Regards,
Kok

Re: ADS NOT SUPPORT DECRYPT AND ENCRYPT FROM FIVEWIN

PostPosted: Wed Oct 10, 2012 9:46 pm
by Patricio Avalos Aguirre
Hi

No esta permitido usar funciones de usuario en los indices
No this allowed using user's shows in index them

Re: ADS NOT SUPPORT DECRYPT AND ENCRYPT FROM FIVEWIN

PostPosted: Wed Oct 10, 2012 11:26 pm
by kok joek hoa
Hi Patricio,

But it works perfectly without ADS.
Regards

Kok

Re: ADS NOT SUPPORT DECRYPT AND ENCRYPT FROM FIVEWIN

PostPosted: Thu Oct 11, 2012 2:33 am
by Marcelo Via Giglio
kok,

because ADS RDD is related to ADS Server, you can't use other function not implemented in ADS, please read the ADS documentation, and you will see the allowed function list allowed.

The other way is how I mentioned previously, adding a field with the crypted data

regards

Marcelo

Re: ADS NOT SUPPORT DECRYPT AND ENCRYPT FROM FIVEWIN

PostPosted: Thu Oct 11, 2012 4:46 am
by kok joek hoa
Hi Marcelo,

Thank you for your reply.

If I write like this :

use customer new via 'DBFCDX'
index on ENCRYPT(first,'TEST') tag FI TO CUSTOMER

everything work fine in ADS .

yes, I Agree with you, It's about ADSCDX
I think need Antonio help to join this function Encrypt and decrypt

Regards,

Kok

Re: ADS NOT SUPPORT DECRYPT AND ENCRYPT FROM FIVEWIN

PostPosted: Thu Oct 11, 2012 9:17 am
by Antonio Linares
Kok,

AFAIK ADS provides its own encryption functions, so you should use theirs

I am not used to them, but surely another ADS user may help on this

Re: ADS NOT SUPPORT DECRYPT AND ENCRYPT FROM FIVEWIN

PostPosted: Fri Oct 12, 2012 4:37 pm
by reinaldocrespo
In a 2-tier (true client-server) application, data is managed by the server. Index operations are performed on the server end. Without ADS, (that's when the server is only used as a shared drive) each record travels from the shared drive on the server to the workstation where decisions and operations are done before they are sent back to the server for a disk-write. With ADS data no longer travels to the workstation to then comeback to the server. Everything happens on the server end. That's one of the reasons ADS RDD is so much faster. The server take the index command from the client and "knows" what to do without sending each record to be "analyzed" by the client. The problem with your encrypt function is that it "lives" on the the client workstation while the server "knows" nothing about it. For this reason your user defined function on the workstation used to crete the index, is invalid on the server. Most regular clipper functions already exists on the ADS server (trim, left, right, ...), you can read the help file to see the list. FiveWin's encrypt and decrypt are not in the list as they are not even valid clipper functions.

As you guessed, you may continue to use DBFCDX RDD for certain tables, but you now loose all the benefits of a true client-server paradigm.

Hope that helps,

Reinaldo.

Re: ADS NOT SUPPORT DECRYPT AND ENCRYPT FROM FIVEWIN

PostPosted: Fri Oct 12, 2012 5:51 pm
by kok joek hoa
Dear Reinaldocrespo,

Thank you for the explanation.
I like client server from ADS, very fast.

yes,I do not have any option to use a power from ADS for my old program, except I change the structure of indexing.

Regards,

Kok

Re: ADS NOT SUPPORT DECRYPT AND ENCRYPT FROM FIVEWIN

PostPosted: Fri Oct 12, 2012 6:21 pm
by reinaldocrespo
BTW - since we are on this subject, I might as well add some more information. In a client-server paradigm (like any SQL including ADS SQL), index or table corruption is very unlikely. The reason tables and indexes get corrupted is because something happens that breaks or interrupts the communication between the shared drived and the workstation. When this happes, for whatever reason including network failures, and data was either being read or written to the shared drive, corruption occurs. In a 2-tier paradigm, this doesn't happen since read and writes are all managed by the server regardless of the workstation status.

Back when ADS was young, it was advertised as a tool to avoid corruption. The original developers didn't intend to write an SQL. All they did was mostly re-write the communications layer so that all Clipper dbf operation would be carried out by the server. These were Clipper and c programmers writing mobile code. Their .dbfs and ntxs used get corrupted all the time, so they decided to do something about it. That's how ADS was born.

An SQL company called iAnywhere got interested on their mobile code and patents and decided to buy them. The unintended consequence is that they also got ADS SQL. Then Sybase got interested on the mobile technology that was acquired by iAnywhere and thus, decided to buy them out. The unintended consequence is that they now also acquired two SQLs (iAnywhere and ADS). Sybase already owned ASE (adaptive server which is the parent of MS-SQL server) as well as AI. So now Sybase owned 4 SQLs. Recently SAP got interested on all this mobility technology and patents, and ended up purchasing Sybase for 8 billion dollars. So now, ADS belongs to SAP. In essence, with ADS there is more SQL know-how and expertise than at any other company.

Now days ADS is much more than just a means to avoid corruption. Now you get everything other "bigger" and more expensive SQLs have while also keeping the original clipper like syntax. The demands of more modern and complex ways to manage data, forces us each day to migrate more and more towards SQL and multi-tier paradigms. ADS -with its clipper like ISAM RDD -just makes it a little easier to get started. But once you have migrated to ADS REMOTE server, you need to start taking it a step further and learn SQL, triggers, Referential Integrity rules, Web Services + Mobile data access, data dictionary. It takes time. The good news is that you get to keep working with .dbf/fpt/cdx and .adt/adm/adi.


Reinaldo.

Re: ADS NOT SUPPORT DECRYPT AND ENCRYPT FROM FIVEWIN

PostPosted: Sat Oct 13, 2012 6:47 am
by kok joek hoa
Dear Reinaldo,

Thank you for this useful information.
Did you use ADS 11?
I wanna know about web-paltform from ADS 11.

Regards,

Kok

Re: ADS NOT SUPPORT DECRYPT AND ENCRYPT FROM FIVEWIN

PostPosted: Sat Oct 13, 2012 12:36 pm
by HunterEC
Reinaldo, kok joek hoa:

Very precise explanation of the client / server paradigm.

On encryption, commercial xHarbour supports a driver called SIX, which allows transparent record encryption. I'd used since the old Clipper 5.2e / DOS days and now with xHarbour without any trouble at all.

There's another way to get the speed benefits of client / server: Remote Desktop Connection. You connect via remote and everything happens at the host / server level. No need for data records to travel through the network back and forth. There are a couple of patches on the Web for Windows XP Professional, Vista & 7 that allows you to connect remotely, without disconnecting the user on the host / server. The patch also supports lots of users simultaneously. I've used on a 15 node network and works smoothly.

Also, this way, you got only a single point of failure, as in client / server, the server.