Sorry, but what did dou mean with 'Are you still using VisualFoxPro...'? :)
Mensaje citado por: "Ruiz González, Jose de Jesus" <[EMAIL PROTECTED]>: > Are you still using VisualFoxPro as the programmig language in your > project? > If so, you can use SQL functions from VisualFoxPro to connect to mySQL > using > ODBC > > Install mySQL (if you have not allready do it ) > Then install MyODBC-3.51.06.exe (downloadable from mySQL page) > Create the ODBC bridge to mySQL with the ODBC Administrator > > If your project is OO then you can understand the next code I wrote > (Whith > this classes I connecto to Oracle, SQL Server > and, of course mySQL ) > > COdbc > ^ ^ > | | > COdbcSynchBatchMan COdbcSynchBatchNotrans > ^ ^ ^ > | | | > CORACLE CSQLSERVER CMYSQL > > Instantiate a CMYSQL object and you are ready > > * ////////////////////////////////// > define class COdbc as custom > protected m_sClsNam > protected m_sSourceName && CO > protected m_sUserID && ops$jjr > protected m_sPassword && jjr > protected m_iConnectionID && numero devuelto por > sqlconnect > protected m_sCursorResults && cursor en que se > devuelven los datos > protected m_sCursorColumns && cursor en que estan los nombres > de las columnas SQLCOLUMNS > protected m_sCursorTables && cursor en que estan los > nombres de la tablas SQLTABLES > protected m_bInTransaction && bandera para indicar si > se esta en transaccion o no > protected m_sErrorString && cadena con mensaje de > error > protected m_sLogFile && ruta y nombre de archivo > log > protected m_bLoggingOut && ¿Logging? > protected m_oLogFile && CTextFile > protected m_sSqlCmd > protected m_sScriptsPath > protected m_iIdiom && idioma a usar > para los nombres de meses > > ************** > * ts1: SourceName > * ts2: UserId > * ts3: Password > procedure Init > parameter ts1, ts2, ts3 > this.m_sClsNam = 'Codbc' > this.m_sSourceName = ts1 > this.m_sUserID = ts2 > this.m_sPassword = ts3 > this.m_iConnectionID = -1 > this.m_sCursorResults = '' > this.m_sCursorColumns = '' > this.m_sCursorTables = '' > this.m_sErrorString = '' > this.m_sLogFile = TEMPDIR + 'codbc.log' > this.m_bLoggingOut = .F. > this.m_sSqlCmd = '' > this.m_sScriptsPath = 'd:\fpw25\importa\oracle\scripts\' > this.m_iIdiom = THIs.GENGLISH() > endproc > > ***************** > procedure destroy > if this.m_bLoggingOut > this.SetLogOff > endif > if this.m_iConnectionID # -1 > this.Disconnect > endif > endproc > > ************************ > function GStillExecuting > return 0 > > ****************** > function GFinished > return 1 > > ******************** > function GNoMoreData > return 2 > > ********************** > function GSystemTables > return "'SYSTEM TABLE'" > > **************** > function GTables > return "'TABLE'" > > *************** > function GViews > return "'VIEW'" > > ******************** > function GDBComplete > return 1 > > ****************** > function GDBPrompt > return 2 > > ******************** > function GDBNoPrompt > return 3 > > ******************* > function GTransAuto > return 1 > > ********************* > function GTransManual > return 2 > > ********************** > function GAsynchronous > return .T. > > ********************* > function GSynchronous > return .F. > > ******************* > function GBatchMode > return .T. > > ********************* > function GNoBatchMode > return .F. > > **************** > function Connect > local m.bRet > > ? 'COdbc::Connect()' > m.bRet = .T. > this.m_iConnectionID = SQLCONNECT( this.m_sSourceName, > this.m_sUserID, this.m_sPassword ) > ? this.m_iConnectionID > if this.m_iConnectionID < 0 > this.GetError( this.m_iConnectionID ) > this.m_iConnectionID = -1 > m.bRet = .F. > endif > return m.bRet > > ******************* > function Disconnect > local m.iRet, m.bRet > > ? 'COdbc::Disconnect()' > m.bRet = .T. > m.iRet = SQLDISCONNECT( this.m_iConnectionID ) > do case > case 1 == m.iRet > this.m_iConnectionID = -1 > if this.m_bLoggingOut > this.SetLogOff > endif > case inlist( m.iRet, -1, -2 ) > this.GetError( m.iRet ) > m.bRet = .F. > endcase > return m.bRet > > ****************** > function Connected > return ( this.m_iConnectionID # -1) > > *************** > * ts1: TiposDeTablas > * ts2: NombreDelCursor > function Tables > parameter ts1, ts2 > local m.iRet, m.sTables, m.bRet > > m.bRet = .T. > if TYPE_L == type( 'ts1' ) > m.sTables = '"' + this.GSystemTables() + ',' + > this.GTables() + ',' + this.GViews() + '"' > else > m.sTables = ts1 > endif > if TYPE_L == type( 'ts2' ) > this.m_sCursorTables = 'SQLTABLES' > else > this.m_sCursorTables = ts2 > endif > m.iRet = SQLTABLES( this.m_iConnectionID, m.sTables, > this.m_sCursorTables ) > if inlist( m.iRet, -1, -2 ) > this.GetError( m.iRet ) > m.bRet = .F. > endif > return m.bRet > > ******************* > * ts1: NombreDeLaTabla > * [ts2]: NombreDelCursorEnQueSeDevuelvenColumnas > function ColumnsFox > parameter ts1, ts2 > > if TYPE_L == type( 'ts2' ) > this.m_sCursorColumns = 'SQLCOLS' > else > this.m_sCursorColumns = ts2 > endif > return this.Columns( ts1, 'FOX', this.m_sCursorColumns ) > > ********************** > * ts1: NombreDeLaTAbla > * [ts2]: NombreDelcursorEnQueSeDevuelvenColumnas > function ColumnsNative > parameter ts1, ts2 > > if TYPE_L == type( 'ts2' ) > this.m_sCursorColumns = 'SQLCOLS' > else > this.m_sCursorColumns = ts2 > endif > return this.Columns( ts1, 'NATIVE', this.m_sCursorColumns ) > > ***************** > * ts1: NombreDeLaTabla > * ts2: Formato > * ts3: NombreDelCursor > protected function Columns > parameter ts1, ts2, ts3 > local m.iRet, m.bRet > > m.bRet = .T. > m.iRet = SQLCOLUMNS( this.m_iConnectionID, ts1, ts2, ts3 ) > if inlist( m.iRet, -1, -2 ) > this.GetError( m.iRet ) > m.bRet = .F. > endif > return m.bRet > > ************************ > * tb1: .T.|.F. > function SetAsynchronous > parameter tb1 > > if TYPE_L == type( 'tb1' ) > m.bRet = this.SetProp( 'Asynchronous', tb1 ) > else > messagebox( 'SetAsynchronous' + _CRLF_ + 'El valor > debe ser .T.|.F.', BTNOK + ICONINFORMATION ) > m.bRet = .F. > endif > return m.bRet > > ********************* > * tb1: .T.|.F. > function SetBatchMode > parameter tb1 > local m.bRet > > if TYPE_L == type( 'tb1' ) > m.bRet = this.SetProp( 'BatchMode', tb1 ) > else > messagebox( 'SetBatchMode' + _CRLF_ + 'El valor debe > ser .T.|.F.', BTNOK + ICONINFORMATION ) > m.bRet = .F. > endif > return m.bRet > > *********************** > * ti1: 0-600 segundos > function SetConnectTimeOut > parameter ti1 > local m.bRet > > if between( ti1, 0, 600 ) > m.bRet = this.SetProp( 'ConnectTimeOut', ti1 ) > else > messagebox( 'SetConnectTimeOut' + _CRLF_ + 'El valor > debe ser de 0 a 600', BTNOK + ICONINFORMATION ) > m.bRet = .F. > endif > return > > ******************* > * ts1: DatasourceName > function SetDataSource > parameter ts1 > local m.bRet > > if TYPE_C == type( 'ts1' ) > m.bRet = this.SetProp( 'DataSource', ts1 ) > else > messagebox( 'SetDataSource' + _CRLF_ + 'Nombre de > origen de datos incorrecto', BTNOK + ICONINFORMATION ) > m.bRet = .F. > endif > return m.bRet > > ********************* > * ti1: 1|2|3 > function SetDispLogin > parameter ti1 > local m.bRet > > if TYPE_N == type( 'ti1' ) AND INLIST( ti1, > this.GDBComplete(), this.GDBPrompt(), this.GDBNoPrompt() ) > m.bRet = this.SetProp( 'DispLogin', ti1 ) > else > messagebox( 'SetDispLogin' + _CRLF_ + 'El valor debe > ser 1 a 3', BTNOK + ICONINFORMATION ) > m.bRet = .F. > endif > return m.bRet > > ************************ > * tb1: .T.|.F. > function SetDispWarnings > parameter tb1 > local m.bRet > > if TYPE_L = type( 'tb1' ) > m.bRet = this.SetProp( 'DispWarnings', tb1 ) > else > messagebox( 'SetDispWarnings' + _CRLF_ + 'El valor > debe ser .T.|.F.', BTNOK + ICONINFORMATION ) > m.bRet = .F. > endif > return m.bRet > > *********************** > * ti1: segundos > function SetIdleTimeOut > parameter ti1 > return this.SetProp( 'IdleTimeOut', ti1 ) > > ********************** > function SetPacketSize > parameter ti1 > return this.SetProp( 'PacketSize', ti1 ) > > ************************ > * ti1: 0-600 segundos > function SetQueryTimeOut > parameter ti1 > > if TYPE_N == type( 'ti1' ) and between( ti1, 0, 600 ) > m.bRet = this.SetProp( 'QueryTimeOut', ti1 ) > else > messagebox( 'SetQueryTimeOut' + _CRLF_ + 'El valor > debe ser de 0 a 600 ', BTNOK + ICONINFORMATION ) > m.bRet = .F. > endif > return m.bRet > > ************************ > function SetTransactions > parameter ti1 > local m.bRet > > if TYPE_N == type( 'ti1' ) and inlist( ti1, > this.GTransAuto(), this.GTransManual() ) > m.bRet = this.SetProp( 'Transactions', ti1 ) > else > messagebox( 'SetTransactions' + _CRLF_ + 'El valor > debe ser 1|2', BTNOK + ICONINFORMATION ) > m.bRet = .F. > endif > return m.bRet > > ********************** > function GPAsynchronous > return this.GetProp( 'Asynchronous' ) > > ******************* > function GPBatchMode > return this.GetProp( 'BatchMode' ) > > ********************* > function GPConnectBusy > return this.GetProp( 'ConnectBusy' ) > > *********************** > function GPConnectString > return this.GetProp( 'ConnectString' ) > > ************************ > function GPConnectTimeOut > return this.GetProp( 'ConnectTimeOut' ) > > ******************** > function GPDatasource > return this.GetProp( 'Datasource' ) > > ******************* > function GPDispLogin > return this.GetProp( 'DispLogin' ) > > ********************** > function GPDispWarnings > return this.GetProp( 'DispWarnings' ) > > ********************* > function GPIdleTimeout > return this.GetProp( 'IdleTimeOut' ) > > ******************** > function GPPacketSize > return this.GetProp( 'Packetsize' ) > > ****************** > function GPPassword > return this.GetProp( 'Password' ) > > ********************** > function GPQueryTimeOut > return this.GetProp( 'QueryTimeOut' ) > > ********************** > function GPTransactions > return this.GetProp( 'Transactions' ) > > **************** > function GPUserId > return this.GetProp( 'UserId' ) > > ****************** > function GPWaitTime > return this.GetProp( 'Waittime' ) > > ************************** > * ts1: NombrePropiedad > * tu2: Valor > protected function SetProp > parameter ts1, tu2 > local m.iRet, m.bRet > > m.bRet = .T. > m.iRet = SQLSETPROP( this.m_iConnectionID, ts1, tu2 ) > if inlist( m.iRet, -1, -2 ) > this.GetError( m.iRet ) > m.bRet = .F. > endif > return m.bRet > > ************************** > protected function GetProp > parameter ts1 > local m.uRet > m.uRet = SQLGETPROP( this.m_iconnectionID, ts1 ) > if inlist( m.uRet, -1, -2 ) > this.GetError( m.uRet ) > endif > return m.uRet > > ************* > function Exec > parameter ts1, ts2 > local m.iRet > > *_cliptext = ts1 > * ? ts1 > this.m_sSqlCmd = ts1 > m.iRet = 0 > if TYPE_L == type( 'ts2' ) > this.m_sCursorResults = 'SQLRESULT' > else > this.m_sCursorResults = ts2 > endif > m.iRet = SQLEXEC( this.m_iConnectionID, ts1, > this.m_sCursorResults ) > if -1 == m.iRet > this.GetError( m.iRet ) > endif > return m.iRet > > **************** > function Prepare > param ts1, ts2 > local m.iRet > this.m_sSqlCmd = ts1 > m.iRet = 0 > if TYPE_L == type( 'ts2' ) > this.m_sCursorResults = 'SQLRESULT' > else > this.m_sCursorResults = ts2 > endif > m.iRet = SQLPREPARE( this.m_iConnectionID, ts1, > this.m_sCursorResults ) > if -1 == m.iRet > this.GetError( m.iRet ) > endif > return m.iRet > > ********************* > function ExecPrepared > local m.iRet > > m.iRet = 0 > this.m_sCursorResults = 'SQLRESULT' > m.iRet = SQLEXEC( this.m_iConnectionID ) > if -1 == m.iRet > this.GetError( m.iRet ) > endif > return m.iRet > > ************************ > function SetScriptsPath > parameter ts1 > this.m_sScriptsPath = ts1 > return > > ************************** > function SetIdiomToEnglish > THIS.m_iIdiom = THIS.GENGLISH() > return > > *************************** > procedure SetIdiomToSpanish > THIS.m_iIdiom = THIS.GSPANISH() > return > > *************** > function GIDIOM > return THIS.m_iIdiom > > ********************* > function GIDIOMSTRING > local m.sRet > do case > case THIS.GENGLISH() == THIS.m_iIdiom > m.sRet = 'Inglés' > case THIS.GSPANISH() == THIS.m_iIdiom > m.sRet = 'Español' > otherwise > m.sRet = 'Idioma no definido!' > endcase > return m.sRet > > ***************** > function GENGLISH > return 1 > > ***************** > function GSPANISH > return 2 > > ******************* > * ts1: RutaYNombreDelScriptSql > * ts2: NombreDelCursor > * ts3..ts10: Parametros para el script (Ej. "p1 ALEX", "p2 145" ) > function ExecScript > parameters ts1, ts2, ts3, ts4,ts5,ts6,ts7,ts8,ts9,ts10 > local m.iRet, ofile, m.sStr, m.ipar > m.iRet = 0 > > oTok = createobject("ctoken") > if file( this.m_sScriptsPath + ts1 ) > ofile = createobject( 'ctextfile', > this.m_sScriptsPath + ts1, -1 ) > ofile.openforr() > this.m_sSqlCmd = '' > do while not ofile.eof() > m.sStr = ofile.Gets() > if ";" # left( m.sStr, 1 ) > this.m_sSqlCmd = this.m_sSqlCmd + > iif(empty( this.m_sSqlCmd ), '', ' ' ) + m.sStr > endif > enddo > ofile.close() > this.m_sSqlCmd = strtran( this.m_sSqlCmd, CHR(9), ' > ' ) > * substitucion de parametros > THIS.SubstituteParam( ts3 ) > THIS.SubstituteParam( ts4 ) > THIS.SubstituteParam( ts5 ) > THIS.SubstituteParam( ts6 ) > THIS.SubstituteParam( ts7 ) > THIS.SubstituteParam( ts8 ) > THIS.SubstituteParam( ts9 ) > THIS.SubstituteParam( ts10 ) > ? this.m_sSqlCmd > if TYPE_L == type( 'ts2' ) > this.m_sCursorResults = juststem( ts1 ) > else > this.m_sCursorResults = ts2 > endif > m.iRet = SQLEXEC( this.m_iConnectionID, > this.m_sSqlCmd, this.m_sCursorResults ) > if -1 == m.iRet > this.GetError( m.iRet ) > endif > else > MessageBox( "No existe archivo " + _CRLF_ + ; > ts1, BTNOK + ICONEXCLAMATION > ) > endif > return m.iRet > > ********************************* > * subsituye el parametro &&px por el valor correspondiente > protected procedure SubstituteParam > parameters ts1 > local oT, m.sp, m.sv > if TYPE_C == TYPE( 'ts1' ) > oT = createobject( 'ctoken' ) > oT.setsepstr( ' ' ) > oT.setsrchstr( ts1 ) > m.sp = oT.gettoken() > m.sv = oT.gettoken() > if 0 # at( m.sp, THIS.m_sSqlCmd ) > THIS.m_sSqlCmd = strtran( THIS.m_sSqlCmd, > CHR(38)+CHR(38)+m.sp, m.sv ) > endif > endif > endproc > > ******************** > function MoreResults > local m.iRet > > m.iRet = SQLMORERESULTS( this.m_iConnectionID ) > return m.iRet > > *************** > function Cancel > local m.iRet, m.bRet > > *!* ? 'Cancel' > m.bRet = .T. > m.iRet = SQLCANCEL( this.m_iConnectionID ) > if inlist( m.iRet, -1, -2 ) > this.GetError( m.iRet ) > m.bRet = .F. > endif > return m.bRet > > *************** > function Commit > local m.iRet, m.bRet > > *!* ? 'Commit' > m.bRet = .T. > m.iRet = SQLCOMMIT( this.m_iConnectionID ) > if -1 == m.iRet > this.GetError( m.iRet ) > m.bRet = .F. > endif > return m.bRet > > ***************** > function Rollback > local m.iRet, m.bRet > > *!* ? 'Rollback' > m.bRet = .T. > m.iRet = SQLROLLBACK( this.m_iConnectionID ) > if -1 == m.iRet > this.GetError( m.iRet ) > m.bRet = .F. > endif > return m.bRet > > **************************** > protected procedure GetError > parameter ti1 > local m.sLevel, aE, m.sMsg > > dimension aE[1] > =aerror( aE ) > do case > case -1 == ti1 > m.sLevel = 'Connection level error' > case -2 == ti1 > m.sLevel = 'Server level error' > endcase > > this.m_sErrorString = str( aE[ 1 ] ) + _TAB_ + aE[ 2 ] > m.sMsg = m.sLevel + _CRLF_ + ; > 'Error numero: ' + str( aE[ 1 ] ) + _CRLF_ > + ; > 'Mensaje: ' + aE[ 2 ] + _CRLF_ > if this.IsLogging() > ? m.sMsg > this.WriteLog( _CRLF_ + m.sMsg ) > this.WriteLog( _CRLF_ + this.m_sSqlCmd ) > else > messagebox( m.sMsg, BTNOK + ICONINFORMATION ) > endif > endproc > > ****************** > function IsLogging > return this.m_bLoggingOut > > ****************** > procedure SetLogOn > local m.sf > m.sf = TEMPDIR + 'odbc' + > left(alltrim(str(int(seconds()))),4) + '.log' > if not this.m_bLoggingOut > this.m_oLogFile = createobject( 'CTEXTFILE', m.sf ) > if this.m_oLogFile.Create() > this.m_bLoggingOut = .T. > this.WriteLog( 'Inicio: ' + dtoc( date() ) + > _TAB_ + time() + _CRLF_ ) > else > release object this.m_oLogFile > if _CANCEL_ == messagebox( 'COdbc-No pude > crear archivo Log' + chr(13) + m.sf, BTNOKCANCEL + ICONINFORMATION ) > cancel > endif > endif > endif > endproc > > ******************* > procedure SetLogOff > if this.m_bLoggingOut > this.m_bLoggingOut = .F. > this.WriteLog( _CRLF_ + 'Fin: ' + dtoc( date() ) + > _TAB_ + time() ) > this.m_oLogFile.Close() > release object this.m_oLogFile > endif > endproc > > ****************** > * ts1: CadenaAEscribir > procedure WriteLog > parameter ts1 > if this.m_bLoggingOut > this.m_oLogFile.Puts( ts1 ) > endif > endproc > > ***************** > * to1: CSrcTxt > procedure DumpLog > parameter to1 > if this.m_bLoggingOut > to1.Dump( this.m_oLogFile ) > endif > endproc > > *************** > *ts1: CadenaACorregir > function FixStr > parameter ts1 > local m.sRet > > m.sRet = strtran( ts1, "'", replicate( chr(39), 2 ) ) > return m.sRet > > **************** > *td1: FechaAConvertir > function FixDate > parameter td1 > local m.iYear, m.iMonth, m.iDay, m.sRet > > m.iDay = day( td1 ) > m.iMonth = month( td1 ) > m.iYear = year( td1 ) > *!* m.sRet = "TO_DATE('"+ > goDate.ToOracle( m.iDay, m.iMonth, m.iYear ) + "')" &&no numerico > cuando > esperaba numerico > *!* m.sRet = goDate.ToOracle( m.iDay, > m.iMonth, m.iYear ) &&no se permite columna aqui > *!* m.sRet = "'" + goDate.ToOracle( > m.iDay, m.iMonth, m.iYear ) + "'" &&no numerico cuando esperaba > numerico > *!* m.sRet = "'" + > padl(alltrim(str(m.iDay)),2,'0') + '-' + ; && mascara termina > antes de convertir fecha > *!* > padl(alltrim(str( m.iMonth)),2,'0') + '-' + ; > *!* > alltrim(str(m.iYear)) + ; > *!* "'" > *!* if goDate.IsLeapYear( m.iYear ) and m.iMonth == 2 > and m.iDay == 29 > *!* m.sRet = "'" + padl( > alltrim( str( m.iDay - 1 ) ), 2, '0' ) + '-' + ; > *!* > padl( alltrim( str( m.iMonth ) ), 2, '0' ) + '-' + ; > *!* > right( alltrim( str( m.iYear ) ), 2 ) + ; > *!* "'" > *!* else > *!* m.sRet = "'" + padl( > alltrim( str( m.iDay ) ), 2, '0' ) + '-' + ; > *!* > padl( alltrim( str( m.iMonth ) ), 2, '0' ) + '-' + ; > *!* > right( alltrim( str( m.iYear ) ), 2 ) + ; > *!* "'" > *!* endif > m.sRet = "TO_DATE('@[EMAIL PROTECTED]@3','DD-MM-RRRR')" > m.sRet = strtran( m.sRet, '@1', padl( alltrim( str( > m.iDay ) ), 2, '0' ) ) > m.sRet = strtran( m.sRet, '@2', padl( alltrim( str( > m.iMonth ) ), 2, '0' ) ) > *!* DO CASE > *!* CASE THIS.GENGLISH() == THIS.GIDIOM() > *!* m.sRet = STRTRAN( m.sRet, '@2', > UPPER( LEFT( goDate.MonthNameI( iMonth ), 3 ) ) ) > *!* CASE THIS.GSPANISH() == THIS.GIDIOM() > *!* m.sRet = STRTRAN( m.sRet, '@2', > UPPER( LEFT( goDate.MonthName( iMonth ), 3 ) ) ) > *!* ENDCASE > m.sRet = strtran( m.sRet, '@3', alltrim( str( > m.iYear, 4, 0 ) ) ) > return m.sRet > enddefine && COdbc > * ////////////////////////////////// > > > > * ////////////////////////////////// > define class COdbcSynchBatchMan as COdbc > > protected m_sTableName > > ************** > * ts1: SourceName > * ts2: UserId > * ts3: Password > procedure Init > parameter ts1, ts2, ts3 > COdbc::Init( ts1, ts2, ts3 ) > endproc > > **************** > function Connect > local m.bRet > > m.bRet = .F. > if COdbc::Connect() > COdbc::SetAsynchronous( Codbc::GSynchronous() ) > COdbc::SetBatchMode( COdbc::GBatchMode() ) > COdbc::SetTransactions( COdbc::GTransManual() ) > COdbc::SetLogOn > *COdbc::SetQueryTimeOut( 600 ) > *COdbc::SetDispWarnings( .T. ) > m.bRet = .T. > endif > return m.bRet > > ***************** > procedure destroy > COdbc::SetLogOff > COdbc::Destroy > endproc > enddefine && COdbcSynchBatchMan > * ////////////////////////////////// > > * ////////////////////////////////// > define class COdbcSynchBatchNotrans as COdbc > > protected m_sTableName > > ************** > * ts1: SourceName > * ts2: UserId > * ts3: Password > procedure Init > parameter ts1, ts2, ts3 > COdbc::Init( ts1, ts2, ts3 ) > endproc > > **************** > function Connect > local m.bRet > > m.bRet = .F. > if COdbc::Connect() > COdbc::SetAsynchronous( Codbc::GSynchronous() ) > COdbc::SetBatchMode( COdbc::GBatchMode() ) > *COdbc::SetTransactions( COdbc::GTransManual() ) > COdbc::SetLogOn > *COdbc::SetQueryTimeOut( 600 ) > *COdbc::SetDispWarnings( .T. ) > m.bRet = .T. > endif > return m.bRet > > ***************** > procedure destroy > COdbc::SetLogOff > COdbc::Destroy > endproc > enddefine && COdbcSynchBatchNotrans > * ////////////////////////////////// > > > > > *//////////////////////////////////////////////////// > define class CMYSQL as COdbcSynchBatchNotrans > ************** > * [ts1] NombreDeBaseDeDatosOdbc > * [ts2] NombreDeUsuario > * [ts3] ContraseniaDeUsuario > procedure Init > parameter ts1, ts2, ts3 > this.m_sClsNam = "" > if TYPE_C == type( 'ts1' ) and TYPE_C == type( 'ts2' ) and > TYPE_C == type( 'ts3' ) > COdbcSynchBatchNotrans::Init( ts1, ts2, ts3 ) > else > COdbcSynchBatchNotrans::Init( 'theOdbcReference', > 'theUser', 'thePAssword' ) > endif > this.m_sTableName = '' > COdbcSynchBatchNotrans::Connect() > endproc > > ************************** > * En VFP mi date format siempre es dd/mm/yyyy, mysql necesita > 'yyyy-mm-dd' para manejar fechas (FECHA1 y FECHA1 son DATE) > FUNCTION FIXDATE > PARAMETER ts1 > LOCAL m.sRet > IF TYPE_D == TYPE( "ts1" ) > ts1 = DTOC( ts1 ) > ENDIF > m.sRet = "" > IF NOT EMPTY( ts1 ) > m.sRet = RIGHT( ts1, 4 ) + "-" + SUBSTR( ts1, 4, 2 ) > + "-" + LEFT( ts1, 2 ) > ENDIF > RETURN m.sRet > enddefine > *//////////////////////////////////////////////////// > > > > Jose de Jesus Ruiz Gonzalez > Depto. de Sistemas > 5480-3886 > [EMAIL PROTECTED] > > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] > ______________________________________ José Angel Blanco Linares Depto Servicios de Apoyo Académico Centro de Enseñanza Técnica Industrial 3641-3250, ext: 264 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]