#Region MYSQL RESPONSES
Sub MySQL_BatchResult(batch As Map) 'Not tested
Log(batch.Size)
End Sub
Sub MySQL_ExecResult(meta As Map)
Log(meta.Size)
End Sub
Sub MySQL_ListTables(tables As List, ms As Long)
For i = 0 To tables.Size - 1
Log(tables.Get(i))
Next
Log(tables.Size)
End Sub
Sub MySQL_QueryResult(data As List, meta As Map)
ToastMessageShow(meta.Get("RecordCount") & " rows retrieved in " & meta.Get("ms") & " milliseconds", True)
For i = 0 To data.Size - 1
Log(data.Get(i))
Next
Log(data.Size)
Log(meta.Size)
End Sub
Sub MySQL_QueryResult2(data As List, meta As Map)
ToastMessageShow(meta.Get("RecordCount") & " rows retrieved in " & meta.Get("ms") & " milliseconds", True)
For i = 0 To data.Size - 1
Log(data.Get(i))
Next
Log(data.Size)
Log(meta.Size)
End Sub
#End Region
(ArrayList) [INSERT INTO damirvta SET maquina=060,fecha='2015-02-26',horario='19:05',hora='19:05',valor=1000,estado='Abierto',tipo='Normal',folio=1000001,lat=-33.4855,lon=-70.5515;, INSERT INTO damirvta SET maquina=060,fecha='2015-02-26',horario='19:05',hora='19:06',valor=1000,estado='Abierto',tipo='Normal',folio=1000002,lat=-33.4854,lon=-70.5514;, INSERT INTO damirvta SET maquina=060,fecha='2015-02-26',horario='19:05',hora='19:06',valor=1000,estado='Abierto',tipo='Normal',folio=1000003,lat=-33.4854,lon=-70.5514;, INSERT INTO damirvta SET maquina=060,fecha='2015-02-26',horario='19:05',hora='19:47',valor=1000,estado='Abierto',tipo='Normal',folio=1000004,lat=-33.4854,lon=-70.5514;, INSERT INTO damirvta SET maquina=060,fecha='2015-02-26',horario='19:05',hora='19:55',valor=1000,estado='Abierto',tipo='Normal',folio=1000005,lat=-33.4852,lon=-70.5514;, INSERT INTO damirvta SET maquina=060,fecha='2015-02-26',horario='19:05',hora='20:04',valor=1000,estado='Abierto',tipo='Normal',folio=1000006,lat=-33.4852,lon=-70.5514;, INSERT INTO damirvta SET maquina=060,fecha='2015-02-26',horario='19:05',hora='20:08',valor=1000,estado='Abierto',tipo='Normal',folio=1000007,lat=0,lon=0;, INSERT INTO damirvta SET maquina=060,fecha='2015-02-26',horario='19:05',hora='20:13',valor=1000,estado='Abierto',tipo='Normal',folio=1000008,lat=-33.4855,lon=-70.5513;]
batch1.Initialize
CurVentas = DBVenta.ExecQuery("Select * from Venta where Up = 'NO'")
If CurVentas.RowCount > 0 Then
For i = 0 To CurVentas.RowCount-1
CurVentas.Position = i
FechaVta = CurVentas.GetString("Fecha")
HorarioVta = CurVentas.GetString("Horario")
HoraVta = CurVentas.GetString("Hora")
ValorVta = CurVentas.GetString("Valor")
TipoVta = CurVentas.GetString("Tipo")
FolioVta = CurVentas.GetString("Folio")
latVta = CurVentas.GetString("lat")
lonVta = CurVentas.GetString("lon")
batch1.Add("INSERT INTO damirvta SET maquina=" & AuxMaquina & ",fecha='" & FechaVta & "',horario='" & HorarioVta & "',hora='" & HoraVta & "',valor=" & btn300.Text & ",estado='Abierto',tipo='Normal',folio=" & FolioVta & ",lat=" & latVta & ",lon=" & lonVta & ";")
Log(batch1)
Next
End If
dbM.ExecuteBatchASync(batch1)
Msgbox(CurVentas.RowCount,"SQL")
Sub MySQL_BatchResult(batch As Map)
Log(batch)
For j=0 To batch.Size-1
Log(batch.GetKeyAt(j)& "=" & batch.GetValueAt(j))
Next
End Sub
i'm executing batch with MSMySQL, but i haven't a good result. I lost the first and de the last record, but this records are in the list.any help is appreciated, thanks in advance.
db.PeparedStatement("INSERT INTO pictures Set image=?;")
db.SetPeparedBlob(1,pathtojpg)
db.ExecutePeparedStatement
DB.PeparedStatement("INSERT INTO test SET text_ = ?")
DB.SetPeparedString(1, EditText1.Text)
DB.ExecutePeparedStatement
Yes, Updatewhat would be the code to update?
Yes, Update
update table set field1='xyz', field2=3 WHERE id=887
B4X:update table set field1='xyz', field2=3 WHERE id=887
http://dev.mysql.com/doc/refman/5.0/en/update.html
batch.Initialize
For i=1 To 100
batch.Add("INSERT INTO test SET maquina=" &i& ",valor=" &i& ";")
Next
dbM.executebatchasync(batch)
I have no stored procedures but it should work.....
- Does this library support calling a MySQL stored procedure ?
Should work, yes. But also here; as i dont have any stored procedures i havn´t tested it actually.
- Does this library support calling a MySQL stored procedure with an OUT parameter ?
The MariaDB connector you can use even in commercial projects without need for a Oracle MySQL-LicenceI read that there is a MariaDB Lib too from you. I don't understand why a different lib ? According to my understanding, in Windows, the regular ODBC connector from MySQL will work to connect to a MariaDB database. Is there any specific reason that one should use the MariaDB Lib ?
Your answerDoes this library support calling a MySQL stored procedure with an OUT parameter ?
Should work, yes. But also here; as i dont have any stored procedures i havn´t tested it actually.
DELIMITER $$
CREATE PROCEDURE GetCustomerLevel(
in p_customerNumber int(11),
out p_customerLevel varchar(10))
BEGIN
DECLARE creditlim double;
SELECT creditlimit INTO creditlim
FROM customers
WHERE customerNumber = p_customerNumber;
IF creditlim > 50000 THEN
SET p_customerLevel = 'PLATINUM';
ELSEIF (creditlim <= 50000 AND creditlim >= 10000) THEN
SET p_customerLevel = 'GOLD';
ELSEIF creditlim < 10000 THEN
SET p_customerLevel = 'SILVER';
END IF;
END$$
CALL GetCustomerLevel(103,@level);
SELECT @level AS level;
oCmd=CreateObject("ADODB.Command")
oCmd.ActiveConnection=oConnection 'Connection Object
oCmd.CommandType:=adCmdStoredProc
oCmd.CommandText:='GetCustomerLevel' 'Stored Procedure name
nCustomerNumber=103 'Int Type
'Preparing the First parameter (Input Parameter) to the Stored Procedure
oParam = oCmd.CreateParameter( 'p_customerNumber', adInteger, adParamInput, 11, nCustomerNumber )
oCmd.Parameters.Append( oParam )
cCustomerLevel='' 'String type. This varable is supposed to store the OUT parameter value
'Preparing the Second parameter (OutPut Parameter) to the Stored Procedure
oParam = oCmd.CreateParameter( 'p_customerLevel', adVarChar, adParamOutput, 10, cCustomerLevel )
oCmd.Parameters.Append( oParam )
'Now execute the Command
oCmd.Execute()
' Display the value in the OUT parameter of the Stored Procedure
MsgBox( oCmd.Parameters( "cCustomerLevel" ).Value, 'This is the value contained in the cCustomerValue ')
CALL GetCustomerLevel(103,@level);
SELECT @level AS level;
CALL get_customer_level(5,@level);
SELECT @level AS level;
-- Dumping structure for table anser_db.customers
DROP TABLE IF EXISTS `customers`;
CREATE TABLE IF NOT EXISTS `customers` (
`customer_id` int(10) DEFAULT NULL,
`customer_name` varchar(50) DEFAULT NULL,
`creditlimit` double DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- Dumping data for table anser_db.customers: ~10 rows (approximately)
/*!40000 ALTER TABLE `customers` DISABLE KEYS */;
REPLACE INTO `customers` (`customer_id`, `customer_name`, `creditlimit`) VALUES
(1, 'Anser', 5000),
(2, 'John', 3000),
(3, 'Thomas', 11000),
(4, 'Sebastian', 20000),
(5, 'David', 8000),
(6, 'Antonio', 4000),
(7, 'Mathew', 17000),
(8, 'Issac', 25000),
(9, 'Daniel', 14000),
(10, 'Simpson', 4800);
/*!40000 ALTER TABLE `customers` ENABLE KEYS */;
will check it
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?