FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour ADO and hb_serialize()
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
ADO and hb_serialize()
Posted: Fri Oct 09, 2015 02:21 PM
I'm trying to save an array with hb_serialize in a TEXT field ( MySql ) but I get an error.

The statement is:
Code (fw): Select all Collapse
 UPDATE OUTPUTS SET ACAMPOS = 'A       )NI       NI       NI       NI       NI       NI       NI       NI       NI          NI       
NI       NI       NI       
NI       NI       NI       NI       NI       NI       NI       NI       NI       NI       NI       NI       NI       NI       NI       NI       NI       NI       NI        NI       !NI       "NI       #NI       $NI       %NI       &NI       'NI       (NI       )' WHERE HBRECNO = 1


Anyone knows a solution ?
Regards

Antonio H Ferreira
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: ADO and hb_serialize()
Posted: Fri Oct 09, 2015 03:55 PM

Antionio,

Can you just use:

ASave( aArray ) --> cText

ARead( cText ) --> aArray

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
Re: ADO and hb_serialize()
Posted: Fri Oct 09, 2015 04:34 PM

James,

Thanks but its the same problem I cant save such a string.

Regards

Antonio H Ferreira
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: ADO and hb_serialize()
Posted: Fri Oct 09, 2015 04:47 PM

Do you mean it is too large? Something else?

I'm not sure what the example you posted is. It seems to be more than just a string of array data. I also see single quotes which will give problems with SQL. You have to replace single quotes with two single quotes (not a double quote).

I would suggest first testing with a simple array without any special characters.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
Re: ADO and hb_serialize()
Posted: Fri Oct 09, 2015 05:17 PM
James,

With Asave :

Code (fw): Select all Collapse
'UPDATE OUTPUTS SET ACAMPOS = 'AË * N 1N 2N 3N 4N 5N 6N 7N 8N 9N 10N 11N 12N 13N 14N 15N 16N 17N 18N 19N 20N 21N 22N 23N 24N 25N 26N 27N 28N 29N 30N 31N 32N 33N 34N 35N 36N 37N 38N 39N 40N 41N 42' WHERE HBRECNO = 72


Same problem it errors!

If I try ADO :Update() recordset becomes nuts.

Ill try fmimenc()
Regards

Antonio H Ferreira
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: ADO and hb_serialize()
Posted: Fri Oct 09, 2015 08:05 PM

I still see a special character in the second position. I don't know enough about SQL to know if that is an issue.

When I said something simple I meant REALLY simple. How about an array of three characters? E.G. A,B,C.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
Re: ADO and hb_serialize()
Posted: Sat Oct 10, 2015 01:15 PM

James,

I need to save an array of strings or numbers.

I tried convert it to base64 it saves but then I cant load it again.

Any ideas?

Regards

Antonio H Ferreira
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
Re: ADO and hb_serialize()
Posted: Sat Oct 10, 2015 03:09 PM
James,

This seems to work.

Code (fw): Select all Collapse
FUNCTION HB_SERIALIZE( aArray)
RETURN CMIMEENC( ASAVE( aArray ) )

FUNCTION HB_DESERIALIZE( xArray )
RETURN AREAD( CMIMEDEC(  xArray ) )
Regards

Antonio H Ferreira
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: ADO and hb_serialize()
Posted: Sat Oct 10, 2015 03:42 PM

Great news!

What does CHIMEDEC() do?

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
Re: ADO and hb_serialize()
Posted: Sat Oct 10, 2015 05:23 PM

James,

(De) / Encode a string to MIME.

Regards

Antonio H Ferreira
Posts: 408
Joined: Sun Nov 06, 2005 03:55 PM
Re: ADO and hb_serialize()
Posted: Mon Oct 19, 2015 03:52 AM

All,

There is a MimeClip.prg in my \fwh\source\function directory, seems to have two functions:

fMimeDec()
fMimeEnc()

Would this help?

Byron ...

Thanks,

Byron Hopp

Matrix Computer Services

Continue the discussion