Page 1 of 1

ERROR FWMARIADB, Mr. Rao. URGENTE!

Posted: Tue Aug 11, 2020 8:46 pm
by Ariel
Mr. Rao,
si hago esto :

Code: Select all

             acTable[1]:= "temp10"              //+ALLTRIM(STR(INT(Seconds()),7))

    ::oServer:Execute( "DROP TABLE IF EXISTS "+acTable[1] )
          
    cQuery:= "CREATE TEMPORARY TABLE "+acTable[1]+" "+;
                     "(id int(11) NOT NULL auto_increment, "+;
                     "fecha date DEFAULT NULL, "+;
                     "comprobante varchar(20), "+;
                     "codcli double(6,0),  "+;
                     "lista double(2,0),   "+;
                     "cantid double(10,3), "+;
                     "kilos double(10,3),  "+;
                     "precio double(12,2), "+;
                     "bonifi double(6,2),  "+;
                     "importe double(12,2), "+;
                     "codven double(4,0), "+;
                     "codart varchar(20), "+;
                     "PRIMARY KEY  (`id`), "+;
                     "UNIQUE KEY `id` (`id`) ) "
    ::oServer:Execute( cQuery )
 
cuando hago un INSERT no me hace nada y es porque la tabla no existe.

Gracias.

Re: ERROR FWMARIADB, Mr. Rao. URGENTE!

Posted: Wed Aug 12, 2020 6:05 pm
by cjcardoza
Utilizo lo siguiente sin inconvenientes
::oServer:SqlQuery(cQuery )

Re: ERROR FWMARIADB, Mr. Rao. URGENTE!

Posted: Thu Aug 13, 2020 6:23 am
by nageswaragunupudi
Please use
::oServer:Execute( "INSERT INTO ....." )

Re: ERROR FWMARIADB, Mr. Rao. URGENTE!

Posted: Thu Aug 13, 2020 10:47 am
by Ariel
Mr. RAo,
gracias por responder, pero NO puedo hacer un INSERT porque NO me crea la tabla temporal, ese es el problema que le panteo.
Gracias.

Re: ERROR FWMARIADB, Mr. Rao. URGENTE!

Posted: Fri Aug 14, 2020 4:05 pm
by nageswaragunupudi
Your queries are working successfully when I tested here.
This is the test program. I used FWH Cloud server. You can build this sample on your computer and run it.

Code: Select all

#include "fivewin.ch"

function Main()

   local acTable[ 1 ], cQuery, oRs, cSql
   local oServer

   SET DATE BRITISH
   SET CENTURY ON

   oServer  := FW_DemoDB( 6 )

   acTable[1]:= "temp10"              //+ALLTRIM(STR(INT(Seconds()),7))

   oServer:Execute( "DROP TABLE IF EXISTS "+acTable[1] )

   cQuery:= "CREATE TEMPORARY TABLE "+acTable[1]+" "+;
             "(id int(11) NOT NULL auto_increment, "+;
             "fecha date DEFAULT NULL, "+;
             "comprobante varchar(20), "+;
             "codcli double(6,0),  "+;
             "lista double(2,0),   "+;
             "cantid double(10,3), "+;
             "kilos double(10,3),  "+;
             "precio double(12,2), "+;
             "bonifi double(6,2),  "+;
             "importe double(12,2), "+;
             "codven double(4,0), "+;
             "codart varchar(20), "+;
             "PRIMARY KEY  (`id`), "+;
             "UNIQUE KEY `id` (`id`) ) "

   oServer:Execute( cQuery )

   cQuery   := "INSERT INTO " + acTable[ 1 ] + ;
               " ( fecha,comprobante,codcli,lista ) VALUES ( " + ;
               "'2000-10-20', 'first record', 65400, 6 )"

   oServer:Execute( cQuery )

   oRs   := oServer:RowSet( "select * from " + acTable[ 1 ] )

   oRs:Edit()
   oRs:Browse()

   oRs:Close()
   oServer:Close()

return nil
 
Image

Image

Re: ERROR FWMARIADB, Mr. Rao. URGENTE!

Posted: Fri Aug 14, 2020 4:10 pm
by nageswaragunupudi
However, we recommend you taking full advantage of FWH Marialib methods.
Please try this sample to achieve the same results, but this approach removes the complexity of writing our own queries.

Code: Select all

#include "fivewin.ch"

function Main()

   local oCn, oRs, cSql, cTable

   SET DATE BRITISH
   SET CENTURY ON

   oCn      := FW_DemoDB( 6 )
   cTable   := "temp10"

   oCn:Execute( "DROP TABLE IF EXISTS " + cTable )
   oCn:CreateTable( "TEMPORARY " + cTable, ;
      {  { "fecha",        "D",  8,    0  } ;
      ,  { "comprobante",  "C", 20,    0  } ;
      ,  { "codcli",       "N",  6,    0  } ;
      ,  { "lista",        "N",  2,    0  } ;
      ,  { "candid",       "N", 10,    3  } ;
      ,  { "kilos",        "N", 10,    3  } ;
      ,  { "precio",       "N", 12,    2  } ;
      ,  { "bonifi",       "N",  6,    2  } ;
      ,  { "importe",      "N", 12,    2  } ;
      ,  { "codven",       "N",  4,    0  } ;
      ,  { "codart",       "C", 20,    0  } ;
      } )

   cSql  := oCn:InsertSQL( cTable, "fecha,comprobante,codcli", ;
                  { Date(), "First Record", 65400, 6 } ) // Array with Harbour variables/constants
   oCn:Execute( cSql )

   oRs   := oCn:RowSet( "select * from " + cTable )

   oRs:Edit()
   oRs:Browse()

   oRs:Close()
   oCn:Close()

return nil
 

Re: ERROR FWMARIADB, Mr. Rao. URGENTE!

Posted: Sun Aug 16, 2020 11:50 am
by Ariel
Mr. Rao,

muchas gracias, funcionó perfecto.

Saludos