Erroneous conversion type ADO->boolean to xBrowse->logical

Erroneous conversion type ADO->boolean to xBrowse->logical

Postby JC » Wed Feb 04, 2009 1:15 pm

Dear Antonio,

I found a erroneous conversion type in ADO->boolean to xBrowse->logical
ADO returns for xHarbour, for boolean fields, a numeric type. With this, I can't use the setCheck() method on xBrowse.
Please, it's possible for you to solve this problem? I can do it by myself?

Thank you very much!
Last edited by JC on Wed Feb 04, 2009 5:59 pm, edited 2 times in total.
Peace and lighting!

Júlio César M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
User avatar
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil

Re: Erroneous type in ADO->boolean to xBrowse->logical

Postby JC » Wed Feb 04, 2009 2:38 pm

A little sample just for understanding

Into my object RecordSet... in this construction, I use the boolean type in :fields:append( "Active", adBoolean,, adFldUpdatable )... but, when the recordset is filled by any query into MySQL, the boolean field is interpreted like adTinyInt and this return 0 or 1 (not .T. or .F.)
Code: Select all  Expand view
WITH OBJECT oRecordSet

     :fields:append( "Code", adInteger, 5, adFldUpdatable )
     :fields:append( "name", adVarChar, 30, adFldUpdatable )
     :fields:append( "Active", adBoolean,, adFldUpdatable )
     :fields:append( "Reg Date", adDate,, adFldUpdatable )

     TRY

        :open()
       
        :addNew()
        :fields( "Code" ):value := 1
        :fields( "name" ):value := "JÚLIO CÉSAR M. FERREIRA"
        :fields( "Active" ):value := .T.
        :fields( "Reg Date" ):value := date()

        :addNew()
        :fields( "Code" ):value := 2
        :fields( "name" ):value := "NEW USER FOR TESTS"
        :fields( "Active" ):value := .F.
        :fields( "Reg Date" ):value := date()

        :addNew()
        :fields( "Code" ):value := 3
        :fields( "name" ):value := "ANOTHER NEW USER FOR TESTS"
        :fields( "Active" ):value := .F.
        :fields( "Reg Date" ):value := date()

        :addNew()
        :fields( "Code" ):value := 4
        :fields( "name" ):value := "MORE ONE USER"
        :fields( "Active" ):value := .T.
        :fields( "Reg Date" ):value := date()

        :moveFirst()

END


Into my object xBrowse
Code: Select all  Expand view
   WITH OBJECT oBrw

        :bClrRowFocus        := {|| { CLR_BLACK, nrgb( 228, 232, 224 ) } }
        :bClrSel             := {|| { , nrgb( 228, 232, 224 ) } }
        :nMarqueeStyle       := 4
        :nRowDividerStyle    := 4
        :nColDividerStyle    := 4
        :lColDividerComplete := .F.
        :nStretchCol         := STRETCHCOL_WIDEST

        :createFromCode()
        //:bLDblClick( {|| oRecordSet:fields( "Active" ):value := !oRecordSet:fields( "Active" ):value, oBrw:refresh() } )

        WITH OBJECT :aCols[3]

             :setCheck( { "GREEN", "RED" },  {|| msgInfo( oRecordSet:fields( "Active" ):value ) } )
             :setCheck( { "GREEN", "RED" }, {|o, v| ( oRecordSet:fields( "Active" ):value := v, msgInfo( oRecordSet:fields( "Active" ):value ) ) } )
             :bStrData        := {|| If( oRecordSet:fields( "Active" ):value, "Yes", "No" ) }
             :nDataStrAlign   := AL_RIGHT

        END

   END
Last edited by JC on Wed Feb 04, 2009 5:58 pm, edited 1 time in total.
Peace and lighting!

Júlio César M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
User avatar
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil

Re: Erroneous conversion type ADO->boolean to xBrowse->logical

Postby JC » Wed Feb 04, 2009 6:02 pm

Sorry,

Still have error :(
Peace and lighting!

Júlio César M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
User avatar
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil

Re: Erroneous conversion type ADO->boolean to xBrowse->logical

Postby JC » Fri Feb 06, 2009 12:39 pm

Please, someone knows?
Peace and lighting!

Júlio César M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
User avatar
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil

Re: Erroneous conversion type ADO->boolean to xBrowse->logical

Postby Enrico Maria Giordano » Fri Feb 06, 2009 2:31 pm

Better starting with a reduced and self-contained sample of the problem. :wink:

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8582
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Erroneous conversion type ADO->boolean to xBrowse->logical

Postby JC » Fri Feb 06, 2009 6:46 pm

Enrico Maria Giordano wrote:Better starting with a reduced and self-contained sample of the problem. :wink:

EMG


I will provider it now!
Peace and lighting!

Júlio César M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
User avatar
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil

Re: Erroneous conversion type ADO->boolean to xBrowse->logical

Postby JC » Fri Feb 06, 2009 7:03 pm

The self-contained sample with source:

http://rapidshare.com/files/194811022/ADO.zip.html
Peace and lighting!

Júlio César M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
User avatar
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil

Re: Erroneous conversion type ADO->boolean to xBrowse->logical

Postby JC » Mon Feb 09, 2009 1:50 pm

Dear friends,

Please, somebody can help me with this?
Many weeks with this error... :(
Peace and lighting!

Júlio César M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
User avatar
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil

Re: Erroneous conversion type ADO->boolean to xBrowse->logical

Postby Armando » Mon Feb 09, 2009 3:08 pm

Julio:

I use the traditional code (I do not use PPO) and I have no problems, here is a sample.

This is a field and it's propierties
Code: Select all  Expand view
"PRO_CAN BIT NOT NULL COMMENT 'Cancelado ?'," +;


Then I move all the fields from the record set to variables
Code: Select all  Expand view
oPro:CAN := oRsPro:Fields("PRO_CAN"):Value


And if I show the oPro:CAN variable I get the .T. or .F. value
Code: Select all  Expand view
MsgInfo(oPro:CAN)


Regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3184
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: Erroneous conversion type ADO->boolean to xBrowse->logical

Postby JC » Mon Feb 09, 2009 5:06 pm

This value field oRsPro:Fields("PRO_CAN"):Value is from the MySQL boolean type?

Into MySQL, the boolean type is tinyint (a numeric value, it can be 0 or 1 ) and when it's access via xHarbour... it's returns a numeric type, not a logical type.
Peace and lighting!

Júlio César M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
User avatar
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil

Re: Erroneous conversion type ADO->boolean to xBrowse->logical

Postby Armando » Mon Feb 09, 2009 6:14 pm

Julio:

No, is BIT type, this is the definition

"PRO_CAN BIT NOT NULL COMMENT 'Cancelado ?'," +;

Regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3184
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: Erroneous conversion type ADO->boolean to xBrowse->logical

Postby JC » Mon Feb 09, 2009 6:24 pm

In MySQL definition:
Code: Select all  Expand view
CREATE TABLE test(
   active_register tinyint(1) NOT NULL default 0
);

If you put in this format, the MySQL convert to tinyint again :(
Code: Select all  Expand view
CREATE TABLE test(
   active_register boolean NOT NULL default 0
);


When we get this value from ADO, it's is numeric!!
Peace and lighting!

Júlio César M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
User avatar
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil

Re: Erroneous conversion type ADO->boolean to xBrowse->logical

Postby Armando » Mon Feb 09, 2009 6:50 pm

Julio:

Please try this way

Code: Select all  Expand view
CREATE TABLE test(
   active_register bit NOT NULL default 0  //  .F.
);


Regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3184
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: Erroneous conversion type ADO->boolean to xBrowse->logical

Postby JC » Mon Feb 09, 2009 7:30 pm

Armando wrote:Julio:

Please try this way

Code: Select all  Expand view
CREATE TABLE test(
   active_register bit NOT NULL default 0  //  .F.
);


Regards


Dear Armando,

This is really very beautiful!
Now it's work perfectly!!

The field must be BIT and no boolean(tinyint)

Thank you for your attention with my problem! ;)
Peace and lighting!

Júlio César M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
User avatar
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil

Re: Erroneous conversion type ADO->boolean to xBrowse->logical

Postby JC » Mon Feb 09, 2009 7:50 pm

Armando,

I have another doubt!

With fields type timestamp, the xHarbour returns DATE type field...
Code: Select all  Expand view
CREATE TABLE test(
    date_recognize timestamp not null default current_timestamp
);

I resolve this using like this:
Code: Select all  Expand view
SELECT date_recognize FROM test;
R=2009-12-24

SELECT CAST( date_recognize AS CHARACTER ) as date_recognize FROM test;
R='2009-12-24 12:12:41'


Exists another way to do?
Peace and lighting!

Júlio César M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
User avatar
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 41 guests