NO

Author Topic: Lenght of strings in Pelles C  (Read 3145 times)

jdonadob

  • Guest
Lenght of strings in Pelles C
« on: November 08, 2010, 04:43:50 PM »

Greetings !

I have a proyect with xHarbour, which compiles with Borland C.  I tried to compile it with Pelles C but showed error with the lenght of character strings;  indeed, I have some character strings a little long.

Does Pelles C have any problem with the lenght of character strings?

Thanks in advance

CommonTater

  • Guest
Re: Lenght of strings in Pelles C
« Reply #1 on: November 09, 2010, 12:00:33 AM »
I believe the maximum length is... 2147483647 characters.

Post the misbehaving code and lets see if we can figure it out...


jdonadob

  • Guest
Re: Lenght of strings in Pelles C
« Reply #2 on: November 09, 2010, 03:28:26 PM »
  I have a orsMes variable, which is a object of the class "Recordset".  With the "open" method, I send as first parameter a character string, which is the SQL query, but at the moment to compile, shows the error about long of string.

  orsMes    := CreateObject( "ADODB.Recordset" )
 
  orsMes:open( "SELECT *, (((BasePrima / DiasPromedio) * 30) * DiasPrimas_Cesantias) / 360 AS Prima " ;
          + ", (((BaseCesantias / DiasPromedio) * 30) * DiasPrimas_Cesantias) / 360 AS Cesantias " ;
          + ", (((((BaseCesantias / DiasPromedio) * 30) * DiasPrimas_Cesantias) / 360) * DiasPrimas_Cesantias * 0.12) / 360 AS InteresesCesantias " ;
          + ", (BaseVacaciones / DiasPromedio) * DiasPendientes AS Vacaciones " ;
        + "FROM " ;
        + "(" ;
        + "SELECT NMNTERCEROS.NMNIdentificadorUnoNomina AS Codigo, NMNTERCEROS.NMNIdentificadorDosNomina AS Cedula " ;
         + ", NMNTERCEROS.NMNSucursalNomina AS Sucursal " ;
         + ", NMNTERCEROS.NMNPrimerNombreNomina AS Nombre1, Case When NMNTERCEROS.NMNSegundoNombreNomina IS NULL Then '' Else NMNTERCEROS.NMNSegundoNombreNomina End AS Nombre2 " ;
         + ", NMNTERCEROS.NMNPrimerApellidoNomina AS Apellido1, Case When NMNTERCEROS.NMNSegundoApellidoNomina IS NULL Then '' Else NMNTERCEROS.NMNSegundoApellidoNomina End AS Apellido2 " ;
         + ", NMNTERCEROS.NMNCentroCostosNomina AS CentroCostos " ;
         + ", GTERCEROS.GBLFechaIngresoTerceros AS FechaIngreso, NMNTERCEROS.NMNValorHoraActualNomina*240 AS Basico " ;
         + ", BasePrima.BasePrima , BaseCesantias.BaseCesantias " ;
         + ", BaseVacaciones.BaseVacaciones, DiasPromedio.DiasPromedio " ;
         + ", Case When UtilOdin.dbo.DATEDIFF360(Cast(GTERCEROS.GBLFechaIngresoTerceros AS DateTime), '" + cFecha + "', 0)+1 > 360 Then " ;
         + "360 Else UtilOdin.dbo.DATEDIFF360(Cast(GTERCEROS.GBLFechaIngresoTerceros AS DateTime), '" + cFecha + "', 0)+1 End AS DiasPrimas_Cesantias " ;
         + ", ((UtilOdin.dbo.DATEDIFF360(Cast(GTERCEROS.GBLFechaIngresoTerceros AS DateTime), '" + cFecha + "', 0)+1)*15)/360 AS DiasVacaciones " ;
         + ", Case When DiasCancelados.Dias IS NULL Then 0 Else DiasCancelados.Dias End AS DiasCancelados " ;
         + ", (((UtilOdin.dbo.DATEDIFF360(Cast(GTERCEROS.GBLFechaIngresoTerceros AS DateTime), '" + cFecha + "', 0)+1)*15)/360) - " ;
         + "Case When DiasCancelados.Dias IS NULL Then 0 Else DiasCancelados.Dias End AS DiasPendientes " ;
        + "FROM NMNTERCEROS LEFT JOIN GTERCEROS ON NMNTERCEROS.NMNIdentificadorUnoNomina=GTERCEROS.GBLIdentificadorUnoTerceros " ;
         + "AND NMNTERCEROS.NMNSucursalNomina=GTERCEROS.GBLSucursalTerceros " ;
        + "LEFT JOIN " ;
        + "(SELECT P.NMNIdentificadorUnoPrestacional, P.NMNSucursalPrestacional, Sum(Case When C.NMNTipoConceptoConcepto='DD' Then -1*P.NMNValorPrestacional " ;
         + "Else P.NMNValorPrestacional End) AS BasePrima " ;
         + "FROM NMNPRESTACIONAL AS P LEFT JOIN NMNCONCEPTOS AS C ON P.NMNCodConceptoPrestacional=C.NMNCodConcepto " ;
        + "WHERE C.NMNIdBasePrimasConcepto=1 AND P.NMNAnoPrestacional=" + cAnio ;
         + "GROUP BY P.NMNIdentificadorUnoPrestacional " ;
        + ", P.NMNSucursalPrestacional) AS BasePrima " ;
        + "ON NMNTERCEROS.NMNIdentificadorUnoNomina=BasePrima.NMNIdentificadorUnoPrestacional " ;
         + "AND NMNTERCEROS.NMNSucursalNomina=BasePrima.NMNSucursalPrestacional " ;
        + "LEFT JOIN " ;
        + "(SELECT P.NMNIdentificadorUnoPrestacional, P.NMNSucursalPrestacional, Sum(Case When C.NMNTipoConceptoConcepto='DD' Then -1*P.NMNValorPrestacional " ;
         + "Else P.NMNValorPrestacional End) AS BaseCesantias " ;
        + "FROM NMNPRESTACIONAL AS P LEFT JOIN NMNCONCEPTOS AS C ON P.NMNCodConceptoPrestacional=C.NMNCodConcepto " ;
         + "WHERE C.NMNIdBaseCesantiasConcepto=1 AND P.NMNAnoPrestacional=" + cAnio ;
         + "GROUP BY P.NMNIdentificadorUnoPrestacional " ;
         + ", P.NMNSucursalPrestacional) AS BaseCesantias " ;
        + "ON NMNTERCEROS.NMNIdentificadorUnoNomina=BaseCesantias.NMNIdentificadorUnoPrestacional " ;
        + "AND NMNTERCEROS.NMNSucursalNomina=BaseCesantias.NMNSucursalPrestacional " ;
        + "LEFT JOIN " ;
        + "(SELECT P.NMNIdentificadorUnoPrestacional, P.NMNSucursalPrestacional, Sum(Case When C.NMNTipoConceptoConcepto='DD' Then -1*P.NMNValorPrestacional " ;
         + "Else P.NMNValorPrestacional End) AS BaseVacaciones " ;
         + "FROM NMNPRESTACIONAL AS P LEFT JOIN NMNCONCEPTOS AS C ON P.NMNCodConceptoPrestacional=C.NMNCodConcepto " ;
         + "WHERE C.NMNIdBaseVacacionesConcepto=1 AND P.NMNAnoPrestacional=" + cAnio ;
         + "GROUP BY P.NMNIdentificadorUnoPrestacional " ;
        + ", P.NMNSucursalPrestacional) AS BaseVacaciones " ;
        + "ON NMNTERCEROS.NMNIdentificadorUnoNomina=BaseVacaciones.NMNIdentificadorUnoPrestacional " ;
         + "AND NMNTERCEROS.NMNSucursalNomina=BaseVacaciones.NMNSucursalPrestacional " ;
        + "LEFT JOIN " ;
        + "(SELECT P.NMNIdentificadorUnoPrestacional, P.NMNSucursalPrestacional, SUM(P.NMNHorasPrestacional/8) AS DiasPromedio " ;
         + "FROM NMNPRESTACIONAL AS P LEFT JOIN NMNCONCEPTOS AS C ON P.NMNCodConceptoPrestacional=C.NMNCodConcepto " ;
         + "WHERE P.NMNAnoPrestacional=" + cAnio ;
         + "AND (P.NMNCodConceptoPrestacional='001' OR P.NMNCodConceptoPrestacional='004') GROUP BY P.NMNIdentificadorUnoPrestacional " ;
         + ", P.NMNSucursalPrestacional) AS DiasPromedio " ;
        + "ON NMNTERCEROS.NMNIdentificadorUnoNomina=DiasPromedio.NMNIdentificadorUnoPrestacional " ;
         + "AND NMNTERCEROS.NMNSucursalNomina=DiasPromedio.NMNSucursalPrestacional " ;
        + "LEFT JOIN " ;
        + "( " ;
        + "SELECT NMNIdentificadorUnoHistoriaPagoVacaciones AS Codigo, NMNSucursalHistoriaPagoVacaciones AS Sucursal " ;
         + ", Sum(NMNDiasHabilesHistoriaPagoVacaciones) AS Dias FROM NMNHISTORIAPAGOVACACIONES " ;
         + "GROUP BY NMNIdentificadorUnoHistoriaPagoVacaciones, NMNSucursalHistoriaPagoVacaciones " ;
        + ") AS DiasCancelados " ;
        + "ON NMNTERCEROS.NMNIdentificadorUnoNomina=DiasCancelados.Codigo AND NMNTERCEROS.NMNSucursalNomina=DiasCancelados.Sucursal " ;
        + "WHERE GTERCEROS.GBLFechaRetiroTerceros IS NULL " ;
         + "OR Cast(GTERCEROS.GBLFechaRetiroTerceros AS DateTime)>Cast('" + cFecha + "' AS DateTime) " ;
         + "AND (GTERCEROS.GBLFechaRetiroTerceros IS NULL OR Cast(GTERCEROS.GBLFechaRetiroTerceros AS DateTime)>='" + cFecha + "') " ;
        + ") AS Prestaciones " ;
        + "ORDER BY Nombre1, Nombre2, Apellido1, Apellido2", oConBase, 3 )

CommonTater

  • Guest
Re: Lenght of strings in Pelles C
« Reply #3 on: November 09, 2010, 03:47:49 PM »
Ok... this doesn't look like any C language code I've ever seen...  I fact, it looks like Delphi code.

Perhaps one of the others can help you better.

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2091
Re: Lenght of strings in Pelles C
« Reply #4 on: November 09, 2010, 03:59:04 PM »
I can't get error with this test code with PellesC 6.0 or 6.5 ?
May the source be with you

jdonadob

  • Guest
Re: Lenght of strings in Pelles C
« Reply #5 on: November 09, 2010, 05:03:35 PM »
As I said earlier, language is xHarbour but it compiles with Pelles C.

Pelles C version that I use is 6.00.4.