Gestor portable de base de datos Mysql

y programas personales para otros como tu, puede que te corrijan ;)
Avatar de Usuario
BasicOs
Site Admin
Mensajes: 2085
Registrado: 21 Nov 2006, 19:24
Ubicación: El Internet - (Canarias, España)
Contactar:

Gestor portable de base de datos Mysql

Mensaje por BasicOs »

Basado en el programa simple invoices (Autoit) :
Bajar 90mb SimpleInvoices y base de datos Creditos a JohnMC:
Aquí tenemos además del programa simpleinvoices fuentes en src, se puede instalar/copiar en una carpeta del dropbox:
1.- la función que arranca y gestiona el servicio Apache y mysql,
- Funciones para gestionar mysql - AutoIT 3.3.6.1
-PHP 5.2.17 - http://php.net
-Apache 2.2.21 - http://httpd.apache.org
-MySQL 5.5.16 - http://mysql.com/
2.- Copiar la estructura de carpetas para tener vuestro propio sistema de base datos Mysql+Apache, o simplemente reemplazar simpleinvoice.exe por vuestro programa gestor.
3.- Unas funciones para crear un navegador en Autoit tipo Internet Explorer para usar las páginas web si deseais hacer parte del programa en php/html (eg: para impresión, o para temas gráficos,etc.). Con $oIE.navigate($URL)

Si queremos crear código para gestionar la base de datos:
Las funciones para insert select etc... están en la libreria del foro Mysql.au3
Aquí y busqueda aquí
Del tipo:

Código: Seleccionar todo

#include "MySQL.au3"
$sql = _MySQLConnect("sa","sa","mydb","mywebsite.com") ;usando libreria mysql directamente
$var = _Query($sql,"SELECT * FROM mytable WHERE user = 'pepe'") ; creo un select para buscar los registros de mytable de pepe
;algun msgbox.. si quiero anunciar algo
  While NOT $var.EOF ; hace el bucle hasta que llegue al final de la consulta del select
    ;=>> aqui alguna función que haga algo con los datos la manipulas como texto,
    ;=>> recuperas el valor de las variables/campos user y telefono con->  
   MsgBox(0,"Recupere mis datos del Sql","El usuario es " & $var.Fields("user").value & ", y este es su telefono" & $var.Fields("telefono").value)
    $var.MoveNext ; mueve al siguiente registro del select
  WEnd
_MySQLEnd($sql) ;cierra la conexión
Ejemplo de la función para arrancar el servidor:

Código: Seleccionar todo

func StartServer()
	_cfl("StartServer")

	ProgressOff()
	ProgressOn($TITLE,$TITLE,"Starting Server",Default,@DesktopHeight/2-200,16)

	OnAutoItExitRegister( "StopServer" )
	$STATE_SERVER=1

	ProgressSet(20,"Reading/Updating Configuration 1")
	ParseConfig("apache\conf\httpd.conf")

	ProgressSet(30,"Reading/Updating Configuration 2")
	ParseConfig("mysql\my.ini")

	ProgressSet(40,"Reading/Updating Configuration 3")
	ParseConfig("php\php.ini")

	Sleep(100)

	ProgressSet(50,"Starting Apache")
	;$PID_Apache=Run(@ComSpec & " /k " & 'Apache\bin\'&$Proccess_Apache, "", @SW_HIDE)
	$PID_Apache=Run('Apache\bin\'&$Proccess_Apache,@ScriptDir,@SW_HIDE)
	Sleep(100)

	ProgressSet(60,"Starting MySQL")
	;$PID_MySQL=Run(@ComSpec & " /k " & 'Mysql\bin\'&$Proccess_MySQL, "", @SW_HIDE)
	$PID_MySQL=Run('Mysql\bin\'&$Proccess_MySQL,@ScriptDir,@SW_HIDE)
	Sleep(100)

	ProgressSet(70,"Waitng For Connections")

	TCPStartUp()
	for $i=1 to 40
		$SQLSocket = TCPListen($ADDRESS, $SQLPORT)
		$SQLERROR=@error
		TCPCloseSocket ($SQLSocket)
		$WebSocket = TCPListen($ADDRESS, $WEBPORT)
		$WEBERROR=@error
		TCPCloseSocket ($WebSocket)

		if $SQLERROR=10048 AND ($WEBERROR=10048 OR $APACHELISTEN="") then exitloop

		sleep(100)
	next
	if $i=41 then msgbox(0,$TITLE,"Connections failed or could not be detected"&@CRLF&"Error: "&$SQLERROR&"/"&$WEBERROR)
	TCPShutdown()

	Sleep(1000)

	ProgressSet(80,"Checking Proccesses")

	if ProcessExists($PID_Apache)=0 Then
		msgbox(0,$TITLE,"Apache failed to start")
		Exit

	elseif ProcessExists($PID_MySQL)=0 then
		msgbox(0,$TITLE,"MySQL failed to start")
		Exit

	endif

	ProgressOff()

endfunc
Salu22:)
Adjuntos
simpleInvoicesData.jpg
simpleInvoicesData.jpg (14.2 KiB) Visto 2935 veces
Responder