Jump to content

Rivega

Members
  • Posts

    1
  • Joined

  • Last visited

Everything posted by Rivega

  1. Good afternoon. There was a problem when calling a stored procedure mysq protsedural itself (checks whether there is such a column, if not, create it): DELIMITER $$ CREATE DEFINER=`root`@`127.0.0.1` PROCEDURE `AddColumnUnlessExists`( IN dbName tinytext, IN tableName tinytext, IN fieldName tinytext, IN fieldDef text) begin SET NAMES cp1251; IF NOT EXISTS ( SELECT * FROM information_schema.COLUMNS WHERE column_name=fieldName and table_name=tableName and table_schema=dbName) THEN set @ddl=CONCAT('ALTER TABLE ',dbName,'.',tableName,' ADD COLUMN ','`',fieldName,'`',' ',fieldDef); prepare stmt from @ddl; execute stmt; END IF; end If you call it on My SQL Workbench, then everything works. If you call her in autoit, the procedure does not seem to call, nothing happens #include "mysql.au3" Local $UN = "root" Local $PW = "566434" Local $DB = "esi" Local $SVR = "localhost" Local $Port = "3306" Local $Vesi="12.3" _MySQL_InitLibrary() If @error Then Exit MsgBox(0, '', "") ;MsgBox(0, "DLL Version:",_MySQL_Get_Client_Version()&@CRLF& _MySQL_Get_Client_Info()) $MysqlConn = _MySQL_Init() $connected = _MySQL_Real_Connect($MysqlConn,$SVR,$UN,$PW ,$DB,$Port) _MySQL_Set_Character_Set($MysqlConn,"cp1251") If $connected = 0 Then $errno = _MySQL_errno($MysqlConn) MsgBox(0,"Error:",$errno & @LF & _MySQL_error($MysqlConn)) If $errno = $CR_UNKNOWN_HOST Then MsgBox(0,"Error:","$CR_UNKNOWN_HOST" & @LF & $CR_UNKNOWN_HOST) Endif $option="$MYSQL_OPTION_MULTI_STATEMENTS_ON" _MySQL_Set_Server_Option($MysqlConn, $option) $k="123" $zapros3 = 'call esi.AddColumnUnlessExists(''esi'', ''cars'',''testtest'', ''varchar(32) null'');' _MySQL_Query($MysqlConn,$zapros3)where esi- database name, cars- table name In what could be the problem? I'm not calling the procedure correctly?
×
×
  • Create New...