Hola foro,
Como puedo leer una tabla mysql y pasar su contenido a un arreglo?
Hay algun ejemplo en Fivewin?
Gracias
FWH 25.12
Harbour/Hbmk2
Microsoft Visual C++
MySql 8.0
Antigravity
Hola foro,
Como puedo leer una tabla mysql y pasar su contenido a un arreglo?
Hay algun ejemplo en Fivewin?
Gracias
FWH 25.12
Harbour/Hbmk2
Microsoft Visual C++
MySql 8.0
Antigravity
// FILLARRAY
oQry:FillArray( {| aRow | AAdd( oBrw:aArrayData, { aRow[2], aRow[4] } ) } ) // CON POSICION CAMPO
oBrw:aArrayData := oQry:FillArray( , { "vende_cedula", "vende_apellidos" } ) // CON CAMPOS. PARA LOS xBRW O UN ARRAY
oQry:FillArray( {| aRow | ( AAdd( Array1, cValToChar( aRow[1] ) ) ,; // PARA LOS COMBOBOX CON QRY
AAdd( Array2, aRow[2]) ) }, )joseluisysturiz wrote:Usa oQry:fillarray...es lo mejor y mas rapido, saludos...![]()
// FILLARRAY oQry:FillArray( {| aRow | AAdd( oBrw:aArrayData, { aRow[2], aRow[4] } ) } ) // CON POSICION CAMPO oBrw:aArrayData := oQry:FillArray( , { "vende_cedula", "vende_apellidos" } ) // CON CAMPOS. PARA LOS xBRW O UN ARRAY oQry:FillArray( {| aRow | ( AAdd( Array1, cValToChar( aRow[1] ) ) ,; // PARA LOS COMBOBOX CON QRY AAdd( Array2, aRow[2]) ) }, )
FWH 25.12
Harbour/Hbmk2
Microsoft Visual C++
MySql 8.0
Antigravity
Olvide comentarte que esto es usando TDolphin, saludos... ![]()
joseluisysturiz wrote:Olvide comentarte que esto es usando TDolphin, saludos...
FWH 25.12
Harbour/Hbmk2
Microsoft Visual C++
MySql 8.0
Antigravity
fillarray si no me equivoco, es un methodo de TDolphin, en FWMaria o algo asi nativo de FW se usa algo diferente, aun no he migrado a el nativo de FW, pero para alla voy Dios mediante, tambien puedes hacer un recorrido del qry y usar aadd(array, valores/{valores}), es lo mas clasico, saludos... ![]()
aStates := oCn:Execute( "select code,name from states" )nageswaragunupudi wrote:Native FWH:
Simple and the fastest:
aData := oCn:Execute( cQry )
Example:
aStates := oCn:Execute( "select code,name from states" )
FWH 25.12
Harbour/Hbmk2
Microsoft Visual C++
MySql 8.0
Antigravity
joseluisysturiz wrote:fillarray si no me equivoco, es un methodo de TDolphin, en FWMaria o algo asi nativo de FW se usa algo diferente, aun no he migrado a el nativo de FW, pero para alla voy Dios mediante, tambien puedes hacer un recorrido del qry y usar aadd(array, valores/{valores}), es lo mas clasico, saludos...
FWH 25.12
Harbour/Hbmk2
Microsoft Visual C++
MySql 8.0
Antigravity
nageswaragunupudi wrote:Native FWH:
Simple and the fastest:
aData := oCn:Execute( cQry )
Example:
aStates := oCn:Execute( "select code,name from states" )
oRs := oCn:RowSet( "customer" )
aDataFull := oRs:GetRows()
aDataPart := oRs:GetRows( 20, 101, { "first", "city", "salary" } )aData := oCn:Execute( "select first, city, salary from customer where id between 101 and 120" )nageswaragunupudi wrote:If you already made a query (we call it RowSet), then you can use method GetRows(), which is similar to FillArray() of Dolphin.
aData := oRs:GetRows( [nRows], [nFromRow], [aFieldNames] )
Example:
oRs := oCn:RowSet( "customer" ) aDataFull := oRs:GetRows() aDataPart := oRs:GetRows( 20, 101, { "first", "city", "salary" } )
But, if you did not read query (rowset) already, we can save lot of time by directly reading the data into an array, instead of first reading into a query and then copying data from query into an array.
This is simple and fast
aData := oCn:Execute( "select first, city, salary from customer where id between 101 and 120" )
aDataPart := oRs:GetRows( 20, 101, { "first", "city", "salary", .f. } )
// Esto seriviria para usar un xbrowse y usar setcheck()
aDataPart := oRs:GetRows( 20, 101, { "first", "city", "salary", nom_var } )
// nom_var seria una VAR externa al query, con fillarray no se como hacerlo, gracias... :Quiero empezar a migrar de TDolphin a FWMaria la nativa de FW, por donde inicio.? gracias... ![]()
Excelente, veo que se porta igual que fillarray, ahora otra duda...se puede agrgar un valor que no sea de la consulta, como por ejemplo un valor booleano o el valor de una variable.?
PRIVATE n
oRs := oCn:customer // where customer is the table name
n := 100
aData := oRs:GetRows( 5, 11, ;
{ "first-', '+last", "salary/100", "FW_MTHSLAPSED(HireDate,Date())", "n := n + 1" } )
Super excelente Mr NAO...Quiero empezar a migrar de TDolphin a FWMaria la nativa de FW, por donde inicio.? gracias... ![]()