Para la experiencia:
* Versión de Ubuntu:
root@V20520:~# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 11.04 Release: 11.04 Codename: natty
* Instalación previa de ghc:
root@linux:~# apt-get install ghc Leyendo lista de paquetes... Hecho Creando árbol de dependencias Leyendo la información de estado... Hecho Nota, seleccionando «ghc6» en lugar de «ghc» ghc6 ya está en su versión más reciente. fijado ghc6 como instalado manualmente. 0 actualizados, 0 se instalarán, 0 para eliminar y 17 no actualizados.
* Instalación previa de cabal-install
root@linux:~# apt-get install cabal-install Leyendo lista de paquetes… Hecho Creando árbol de dependencias Leyendo la información de estado… Hecho cabal-install ya está en su versión más reciente. 0 actualizados, 0 se instalarán, 0 para eliminar y 143 no actualizados.
* Instalar libghc6-haskelldb-hdbc-dev ((headers del haskell y hdbc)
root@linux:~# apt-get install libghc6-haskelldb-hdbc-dev Leyendo lista de paquetes... Hecho Creando árbol de dependencias Leyendo la información de estado... Hecho Se instalarán los siguientes paquetes extras: libaudio2 libghc6-convertible-dev libghc6-haskelldb-dev libghc6-haskelldb-hdbc-odbc-dev libghc6-hdbc-dev libghc6-hdbc-odbc-dev libghc6-utf8-string-dev libmng1 libodbcinstq1c2 libqt3-mt unixodbc-dev Paquetes sugeridos: nas libghc6-convertible-doc libghc6-convertible-prof libghc6-haskelldb-doc libghc6-haskelldb-prof libghc6-haskelldb-hdbc-doc libghc6-haskelldb-hdbc-prof libghc6-haskelldb-hdbc-odbc-doc libghc6-hdbc-postgresql-dev libghc6-hdbc-sqlite3-dev libghc6-hdbc-missingh-dev libghc6-hdbc-doc libghc6-hdbc-prof libghc6-utf8-string-doc libghc6-utf8-string-prof libqt3-mt-psql libqt3-mt-mysql libqt3-mt-odbc libqt3-mt-dev Se instalarán los siguientes paquetes NUEVOS: libaudio2 libghc6-convertible-dev libghc6-haskelldb-dev libghc6-haskelldb-hdbc-dev libghc6-haskelldb-hdbc-odbc-dev libghc6-hdbc-dev libghc6-hdbc-odbc-dev libghc6-utf8-string-dev libmng1 libodbcinstq1c2 libqt3-mt unixodbc-dev 0 actualizados, 12 se instalarán, 0 para eliminar y 143 no actualizados. Necesito descargar 6654 kB de archivos. Se utilizarán 25.3 MB de espacio de disco adicional después de esta operación. ¿Desea continuar [S/n]? S Des:1 http://archive.ubuntu.com/ubuntu/ natty/main libaudio2 i386 1.9.2-4ubuntu1 [53.9 kB] Des:2 http://archive.ubuntu.com/ubuntu/ natty/universe libghc6-convertible-dev i386 1.0.9-3build1 [547 kB] Des:3 http://archive.ubuntu.com/ubuntu/ natty/universe libghc6-haskelldb-dev i386 0.12-7build1 [905 kB] Des:4 http://archive.ubuntu.com/ubuntu/ natty/universe libghc6-utf8-string-dev i386 0.3.6-1ubuntu2 [132 kB] Des:5 http://archive.ubuntu.com/ubuntu/ natty/universe libghc6-hdbc-dev i386 2.2.6-2ubuntu1 [285 kB] Des:6 http://archive.ubuntu.com/ubuntu/ natty/universe libghc6-haskelldb-hdbc-dev i386 0.13-1ubuntu4 [21.5 kB] Des:7 http://archive.ubuntu.com/ubuntu/ natty/main libmng1 i386 1.0.10-1 [214 kB] Des:8 http://archive.ubuntu.com/ubuntu/ natty/main libqt3-mt i386 3:3.3.8-b-7ubuntu3 [3048 kB] Des:9 http://archive.ubuntu.com/ubuntu/ natty/main libodbcinstq1c2 i386 2.2.14p2-2ubuntu1 [137 kB] Des:10 http://archive.ubuntu.com/ubuntu/ natty/main unixodbc-dev i386 2.2.14p2-2ubuntu1 [493 kB] Des:11 http://archive.ubuntu.com/ubuntu/ natty/universe libghc6-hdbc-odbc-dev i386 2.2.3.0-3ubuntu1 [108 kB] Des:12 http://archive.ubuntu.com/ubuntu/ natty/universe libghc6-haskelldb-hdbc-odbc-dev i386 0.13-1ubuntu3 [709 kB] Descargados 6654 kB en 2seg. (3308 kB/s) Seleccionando el paquete libaudio2 previamente no seleccionado. (Leyendo la base de datos ... 260974 ficheros o directorios instalados actualmente.) Desempaquetando libaudio2 (de .../libaudio2_1.9.2-4ubuntu1_i386.deb) ... Seleccionando el paquete libghc6-convertible-dev previamente no seleccionado. Desempaquetando libghc6-convertible-dev (de .../libghc6-convertible-dev_1.0.9-3build1_i386.deb) ... Seleccionando el paquete libghc6-haskelldb-dev previamente no seleccionado. Desempaquetando libghc6-haskelldb-dev (de .../libghc6-haskelldb-dev_0.12-7build1_i386.deb) ... Seleccionando el paquete libghc6-utf8-string-dev previamente no seleccionado. Desempaquetando libghc6-utf8-string-dev (de .../libghc6-utf8-string-dev_0.3.6-1ubuntu2_i386.deb) ... Seleccionando el paquete libghc6-hdbc-dev previamente no seleccionado. Desempaquetando libghc6-hdbc-dev (de .../libghc6-hdbc-dev_2.2.6-2ubuntu1_i386.deb) ... Seleccionando el paquete libghc6-haskelldb-hdbc-dev previamente no seleccionado. Desempaquetando libghc6-haskelldb-hdbc-dev (de .../libghc6-haskelldb-hdbc-dev_0.13-1ubuntu4_i386.deb) ... Seleccionando el paquete libmng1 previamente no seleccionado. Desempaquetando libmng1 (de .../libmng1_1.0.10-1_i386.deb) ... Seleccionando el paquete libqt3-mt previamente no seleccionado. Desempaquetando libqt3-mt (de .../libqt3-mt_3%3a3.3.8-b-7ubuntu3_i386.deb) ... Seleccionando el paquete libodbcinstq1c2 previamente no seleccionado. Desempaquetando libodbcinstq1c2 (de .../libodbcinstq1c2_2.2.14p2-2ubuntu1_i386.deb) ... Seleccionando el paquete unixodbc-dev previamente no seleccionado. Desempaquetando unixodbc-dev (de .../unixodbc-dev_2.2.14p2-2ubuntu1_i386.deb) ... Seleccionando el paquete libghc6-hdbc-odbc-dev previamente no seleccionado. Desempaquetando libghc6-hdbc-odbc-dev (de .../libghc6-hdbc-odbc-dev_2.2.3.0-3ubuntu1_i386.deb) ... Seleccionando el paquete libghc6-haskelldb-hdbc-odbc-dev previamente no seleccionado. Desempaquetando libghc6-haskelldb-hdbc-odbc-dev (de .../libghc6-haskelldb-hdbc-odbc-dev_0.13-1ubuntu3_i386.deb) ... Procesando disparadores para ghc6 ... Configurando libaudio2 (1.9.2-4ubuntu1) ... Configurando libghc6-convertible-dev (1.0.9-3build1) ... Configurando libghc6-haskelldb-dev (0.12-7build1) ... Configurando libghc6-utf8-string-dev (0.3.6-1ubuntu2) ... Configurando libghc6-hdbc-dev (2.2.6-2ubuntu1) ... Configurando libghc6-haskelldb-hdbc-dev (0.13-1ubuntu4) ... Configurando libmng1 (1.0.10-1) ... Configurando libqt3-mt (3:3.3.8-b-7ubuntu3) ... Configurando libodbcinstq1c2 (2.2.14p2-2ubuntu1) ... Configurando unixodbc-dev (2.2.14p2-2ubuntu1) ... Configurando libghc6-hdbc-odbc-dev (2.2.3.0-3ubuntu1) ... Configurando libghc6-haskelldb-hdbc-odbc-dev (0.13-1ubuntu3) ... Procesando disparadores para libc-bin ... ldconfig deferred processing now taking place
* Instalar libmysqlclient-dev (headers del mysqlclient)
root@linux:~# apt-get install libmysqlclient-dev Leyendo lista de paquetes... Hecho Creando árbol de dependencias Leyendo la información de estado... Hecho Se instalarán los siguientes paquetes extras: libmysqlclient16 mysql-common Se instalarán los siguientes paquetes NUEVOS: libmysqlclient-dev libmysqlclient16 mysql-common 0 actualizados, 3 se instalarán, 0 para eliminar y 143 no actualizados. Necesito descargar 4863 kB de archivos. Se utilizarán 12.5 MB de espacio de disco adicional después de esta operación. ¿Desea continuar [S/n]? S Des:1 http://archive.ubuntu.com/ubuntu/ natty/main mysql-common all 5.1.54-1ubuntu4 [12.2 kB] Des:2 http://archive.ubuntu.com/ubuntu/ natty/main libmysqlclient16 i386 5.1.54-1ubuntu4 [1808 kB] Des:3 http://archive.ubuntu.com/ubuntu/ natty/main libmysqlclient-dev i386 5.1.54-1ubuntu4 [3043 kB] Descargados 4863 kB en 0seg. (5048 kB/s) Seleccionando el paquete mysql-common previamente no seleccionado. (Leyendo la base de datos ... 261214 ficheros o directorios instalados actualmente.) Desempaquetando mysql-common (de .../mysql-common_5.1.54-1ubuntu4_all.deb) ... Seleccionando el paquete libmysqlclient16 previamente no seleccionado. Desempaquetando libmysqlclient16 (de .../libmysqlclient16_5.1.54-1ubuntu4_i386.deb) ... Seleccionando el paquete libmysqlclient-dev previamente no seleccionado. Desempaquetando libmysqlclient-dev (de .../libmysqlclient-dev_5.1.54-1ubuntu4_i386.deb) ... Procesando disparadores para man-db ... Configurando mysql-common (5.1.54-1ubuntu4) ... Configurando libmysqlclient16 (5.1.54-1ubuntu4) ... Configurando libmysqlclient-dev (5.1.54-1ubuntu4) ... Procesando disparadores para libc-bin ... ldconfig deferred processing now taking place
* Revisamos si tenemos instalado mysql-client y mysql-server
root@linux:~# apt-get install mysql-client Leyendo lista de paquetes... Hecho Creando árbol de dependencias Leyendo la información de estado... Hecho Se instalarán los siguientes paquetes extras: libdbd-mysql-perl mysql-client-5.1 mysql-client-core-5.1 Se instalarán los siguientes paquetes NUEVOS: libdbd-mysql-perl mysql-client mysql-client-5.1 mysql-client-core-5.1 0 actualizados, 4 se instalarán, 0 para eliminar y 143 no actualizados. Necesito descargar 8878 kB de archivos. Se utilizarán 21.9 MB de espacio de disco adicional después de esta operación. ¿Desea continuar [S/n]? S Des:1 http://archive.ubuntu.com/ubuntu/ natty/main libdbd-mysql-perl i386 4.016-1 [138 kB] Des:2 http://archive.ubuntu.com/ubuntu/ natty/main mysql-client-core-5.1 i386 5.1.54-1ubuntu4 [90.8 kB] Des:3 http://archive.ubuntu.com/ubuntu/ natty/main mysql-client-5.1 i386 5.1.54-1ubuntu4 [8642 kB] Des:4 http://archive.ubuntu.com/ubuntu/ natty/main mysql-client all 5.1.54-1ubuntu4 [6706 B] Descargados 8878 kB en 1seg. (8761 kB/s) Seleccionando el paquete libdbd-mysql-perl previamente no seleccionado. (Leyendo la base de datos ... 261290 ficheros o directorios instalados actualmente.) Desempaquetando libdbd-mysql-perl (de .../libdbd-mysql-perl_4.016-1_i386.deb) ... Seleccionando el paquete mysql-client-core-5.1 previamente no seleccionado. Desempaquetando mysql-client-core-5.1 (de .../mysql-client-core-5.1_5.1.54-1ubuntu4_i386.deb) ... Seleccionando el paquete mysql-client-5.1 previamente no seleccionado. Desempaquetando mysql-client-5.1 (de .../mysql-client-5.1_5.1.54-1ubuntu4_i386.deb) ... Seleccionando el paquete mysql-client previamente no seleccionado. Desempaquetando mysql-client (de .../mysql-client_5.1.54-1ubuntu4_all.deb) ... Procesando disparadores para man-db ... Configurando libdbd-mysql-perl (4.016-1) ... Configurando mysql-client-core-5.1 (5.1.54-1ubuntu4) ... Configurando mysql-client-5.1 (5.1.54-1ubuntu4) ... Configurando mysql-client (5.1.54-1ubuntu4) ... root@linux:~# apt-get install mysql-server Leyendo lista de paquetes... Hecho Creando árbol de dependencias Leyendo la información de estado... Hecho Se instalarán los siguientes paquetes extras: libhtml-template-perl mysql-server-5.1 mysql-server-core-5.1 Paquetes sugeridos: libipc-sharedcache-perl tinyca mailx Se instalarán los siguientes paquetes NUEVOS: libhtml-template-perl mysql-server mysql-server-5.1 mysql-server-core-5.1 0 actualizados, 4 se instalarán, 0 para eliminar y 143 no actualizados. Necesito descargar 11.0 MB de archivos. Se utilizarán 25.8 MB de espacio de disco adicional después de esta operación. ¿Desea continuar [S/n]? S Des:1 http://archive.ubuntu.com/ubuntu/ natty/main mysql-server-core-5.1 i386 5.1.54-1ubuntu4 [4627 kB] Des:2 http://archive.ubuntu.com/ubuntu/ natty/main mysql-server-5.1 i386 5.1.54-1ubuntu4 [6258 kB] Des:3 http://archive.ubuntu.com/ubuntu/ natty/main libhtml-template-perl all 2.9-2 [67.1 kB] Des:4 http://archive.ubuntu.com/ubuntu/ natty/main mysql-server all 5.1.54-1ubuntu4 [6828 B] Descargados 11.0 MB en 1seg. (5598 kB/s) Preconfigurando paquetes ... Seleccionando el paquete mysql-server-core-5.1 previamente no seleccionado. (Leyendo la base de datos ... 261382 ficheros o directorios instalados actualmente.) Desempaquetando mysql-server-core-5.1 (de .../mysql-server-core-5.1_5.1.54-1ubuntu4_i386.deb) ... Seleccionando el paquete mysql-server-5.1 previamente no seleccionado. Desempaquetando mysql-server-5.1 (de .../mysql-server-5.1_5.1.54-1ubuntu4_i386.deb) ... Seleccionando el paquete libhtml-template-perl previamente no seleccionado. Desempaquetando libhtml-template-perl (de .../libhtml-template-perl_2.9-2_all.deb) ... Seleccionando el paquete mysql-server previamente no seleccionado. Desempaquetando mysql-server (de .../mysql-server_5.1.54-1ubuntu4_all.deb) ... Procesando disparadores para man-db ... Procesando disparadores para ureadahead ... ureadahead will be reprofiled on next reboot Configurando mysql-server-core-5.1 (5.1.54-1ubuntu4) ... Configurando mysql-server-5.1 (5.1.54-1ubuntu4) ... mysql start/running, process 3499 Configurando libhtml-template-perl (2.9-2) ... Configurando mysql-server (5.1.54-1ubuntu4) ...
* Descargar el hdbc-mysql:
root@linux:~# git clone http://github.com/bos/hdbc-mysql.git trace: built-in: git 'clone' 'http://github.com/bos/hdbc-mysql.git' Cloning into hdbc-mysql... trace: run_command: 'git-remote-http' 'origin' 'http://github.com/bos/hdbc-mysql.git' * Couldn't find host github.com in the .netrc file; using defaults * About to connect() to proxy 200.16.7.100 port 3128 (#0) * Trying 200.16.7.100... * 0x9cdc040 is at send pipe head! * Connected to 200.16.7.100 (200.16.7.100) port 3128 (#0) > GET http://github.com/bos/hdbc-mysql.git/info/refs?service=git-upload-pack HTTP/1.1 User-Agent: git/1.7.4.1 Host: github.com Accept: */* Proxy-Connection: Keep-Alive Pragma: no-cache * HTTP 1.0, assume close after body < HTTP/1.0 200 OK < Server: nginx/1.0.4 < Date: Fri, 02 Dec 2011 01:04:11 GMT < Content-Type: application/x-git-upload-pack-advertisement < Expires: Fri, 01 Jan 1980 00:00:00 GMT < Pragma: no-cache < Cache-Control: no-cache, max-age=0, must-revalidate < X-Cache: MISS from inform.pucp.edu.pe < X-Cache-Lookup: MISS from inform.pucp.edu.pe:3128 < Via: 1.0 inform.pucp.edu.pe:3128 (squid/2.6.STABLE21) < Proxy-Connection: close < * Closing connection #0 trace: run_command: 'fetch-pack' '--stateless-rpc' '--lock-pack' '--thin' 'http://github.com/bos/hdbc-mysql.git/' 'refs/heads/master' 'refs/tags/0.6.4.0' 'refs/tags/0.6.4.1' 'refs/tags/0.6.5.0' 'refs/tags/0_6_4' 'refs/tags/HDBC-mysql-0_1' 'refs/tags/HDBC-mysql-0_6' 'refs/tags/HDBC-mysql-0_6_1' 'refs/tags/release_0_4' 'refs/tags/revision_0_5' trace: exec: 'git' 'fetch-pack' '--stateless-rpc' '--lock-pack' '--thin' 'http://github.com/bos/hdbc-mysql.git/' 'refs/heads/master' 'refs/tags/0.6.4.0' 'refs/tags/0.6.4.1' 'refs/tags/0.6.5.0' 'refs/tags/0_6_4' 'refs/tags/HDBC-mysql-0_1' 'refs/tags/HDBC-mysql-0_6' 'refs/tags/HDBC-mysql-0_6_1' 'refs/tags/release_0_4' 'refs/tags/revision_0_5' setup: git_dir: /root/hdbc-mysql/.git setup: worktree: /root setup: cwd: /root setup: prefix: (null) trace: built-in: git 'fetch-pack' '--stateless-rpc' '--lock-pack' '--thin' 'http://github.com/bos/hdbc-mysql.git/' 'refs/heads/master' 'refs/tags/0.6.4.0' 'refs/tags/0.6.4.1' 'refs/tags/0.6.5.0' 'refs/tags/0_6_4' 'refs/tags/HDBC-mysql-0_1' 'refs/tags/HDBC-mysql-0_6' 'refs/tags/HDBC-mysql-0_6_1' 'refs/tags/release_0_4' 'refs/tags/revision_0_5' * Couldn't find host github.com in the .netrc file; using defaults * About to connect() to proxy 200.16.7.100 port 3128 (#0) * Trying 200.16.7.100... * connected * Connected to 200.16.7.100 (200.16.7.100) port 3128 (#0) > POST http://github.com/bos/hdbc-mysql.git/git-upload-pack HTTP/1.1 User-Agent: git/1.7.4.1 Host: github.com Accept-Encoding: deflate, gzip Proxy-Connection: Keep-Alive Content-Type: application/x-git-upload-pack-request Accept: application/x-git-upload-pack-result Content-Length: 566 * HTTP 1.0, assume close after body < HTTP/1.0 200 OK < Server: nginx/1.0.4 < Date: Fri, 02 Dec 2011 01:04:11 GMT < Content-Type: application/x-git-upload-pack-result < Expires: Fri, 01 Jan 1980 00:00:00 GMT < Pragma: no-cache < Cache-Control: no-cache, max-age=0, must-revalidate < X-Cache: MISS from inform.pucp.edu.pe < X-Cache-Lookup: MISS from inform.pucp.edu.pe:3128 < Via: 1.0 inform.pucp.edu.pe:3128 (squid/2.6.STABLE21) < Proxy-Connection: close < remote: Counting objects: 371, done. remote: Compressing objects: 100% (298/298), done. trace: run_command: 'index-pack' '--stdin' '-v' '--fix-thin' '--keep=fetch-pack 4371 on linux.local' '--pack_header=2,371' trace: exec: 'git' 'index-pack' '--stdin' '-v' '--fix-thin' '--keep=fetch-pack 4371 on linux.local' '--pack_header=2,371' setup: git_dir: /root/hdbc-mysql/.git setup: worktree: /root setup: cwd: /root setup: prefix: (null) trace: built-in: git 'index-pack' '--stdin' '-v' '--fix-thin' '--keep=fetch-pack 4371 on linux.local' '--pack_header=2,371' remote: Total 371 (delta 72), reused 310 (delta 11) * Closing connection #0 (368/371), 108.00 KiB | 147 KiB/s Receiving objects: 100% (371/371), 188.48 KiB | 147 KiB/s, done. Resolving deltas: 100% (72/72), done. root@linux:~# root@linux:~# cd hdbc-mysql/ root@linux:~/hdbc-mysql# runhaskell Setup configure Setup.lhs:8:0: Warning: In the use of `findProgramOnPath' (imported from Distribution.Simple.Program): Deprecated: "use findProgramLocation instead" Configuring HDBC-mysql-0.6.5.0... root@linux:~/hdbc-mysql# runhaskell Setup build Setup.lhs:8:0: Warning: In the use of `findProgramOnPath' (imported from Distribution.Simple.Program): Deprecated: "use findProgramLocation instead" Preprocessing library HDBC-mysql-0.6.5.0... Building HDBC-mysql-0.6.5.0... [1 of 3] Compiling Database.HDBC.MySQL.RTS ( dist/build/Database/HDBC/MySQL/RTS.hs, dist/build/Database/HDBC/MySQL/RTS.o ) [2 of 3] Compiling Database.HDBC.MySQL.Connection ( dist/build/Database/HDBC/MySQL/Connection.hs, dist/build/Database/HDBC/MySQL/Connection.o ) [3 of 3] Compiling Database.HDBC.MySQL ( Database/HDBC/MySQL.hs, dist/build/Database/HDBC/MySQL.o ) Registering HDBC-mysql-0.6.5.0... root@linux:~/hdbc-mysql# runhaskell Setup install Setup.lhs:8:0: Warning: In the use of `findProgramOnPath' (imported from Distribution.Simple.Program): Deprecated: "use findProgramLocation instead" Installing library in /usr/local/lib/HDBC-mysql-0.6.5.0/ghc-6.12.3 Registering HDBC-mysql-0.6.5.0... root@linux:~/hdbc-mysql#
* Ingresamos a la carpeta y compilamos, así:
root@linux:~# cd hdbc-mysql/ root@linux:~/hdbc-mysql# runhaskell Setup configure Setup.lhs:8:0: Warning: In the use of `findProgramOnPath’ (imported from Distribution.Simple.Program): Deprecated: “use findProgramLocation instead” Configuring HDBC-mysql-0.6.5.0… root@linux:~/hdbc-mysql# runhaskell Setup build Setup.lhs:8:0: Warning: In the use of `findProgramOnPath’ (imported from Distribution.Simple.Program): Deprecated: “use findProgramLocation instead” Preprocessing library HDBC-mysql-0.6.5.0… Building HDBC-mysql-0.6.5.0… [1 of 3] Compiling Database.HDBC.MySQL.RTS ( dist/build/Database/HDBC/MySQL/RTS.hs, dist/build/Database/HDBC/MySQL/RTS.o ) [2 of 3] Compiling Database.HDBC.MySQL.Connection ( dist/build/Database/HDBC/MySQL/Connection.hs, dist/build/Database/HDBC/MySQL/Connection.o ) [3 of 3] Compiling Database.HDBC.MySQL ( Database/HDBC/MySQL.hs, dist/build/Database/HDBC/MySQL.o ) Registering HDBC-mysql-0.6.5.0… root@linux:~/hdbc-mysql# runhaskell Setup install Setup.lhs:8:0: Warning: In the use of `findProgramOnPath’ (imported from Distribution.Simple.Program): Deprecated: “use findProgramLocation instead” Installing library in /usr/local/lib/HDBC-mysql-0.6.5.0/ghc-6.12.3 Registering HDBC-mysql-0.6.5.0.. * Entramos a MySQL y creamos la Base de Datos “Farmacia” root@linux:/etc/init.d# mysql -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 41 Server version: 5.1.54-1ubuntu4 (Ubuntu) Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to modify and redistribute it under the GPL v2 license Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement. mysql> show databases; +——————–+ | Database | +——————–+ | information_schema | | mysql | +——————–+ 2 rows in set (0.00 sec) mysql> create database Farmacia; Query OK, 1 row affected (0.00 sec) mysql> show databases; +——————–+ | Database | +——————–+ | information_schema | | Farmacia | | mysql | +——————–+ 3 rows in set (0.00 sec) mysql> use Farmacia; Database changed mysql> show tables; Empty set (0.00 sec) mysql> create table wp_users ( -> id INT, -> nombre VARCHAR(100), -> codigo VARCHAR(8), -> password VARCHAR(8), -> cargo VARCHAR(50), -> fecha_ingreso DATE NOT NULL DEFAULT ‘1970-01-01′) -> ; Query OK, 0 rows affected (0.00 sec) mysql> * Corremos el script Test: ***************************************************************** module Main where import Control.Monad import Database.HDBC import Database.HDBC.MySQL connectDatabase :: IO Connection connectDatabase = connectMySQL defaultMySQLConnectInfo { mysqlHost = “127.0.0.1”, mysqlUser = “root”, mysqlPassword = “123456”, mysqlPort = 3306, mysqlDatabase = “Farmacia” } go :: IO () go = do conn <- connectDatabase putStrLn $ “driver ” ++ (show $ hdbcDriverName conn) putStrLn $ “server version ” ++ (show $ dbServerVer conn) rows <- quickQuery’ conn “SELECT * from wp_users” [] forM_ rows $ \row -> do putStrLn $ show row main :: IO () main = handleSqlError (replicateM_ 1 go) ************************************************** root@linux:~/hdbc-mysql# cd /home/ladmin/Descargas/ root@linux:/home/ladmin/Descargas# ls Test.hs root@linux:/home/ladmin/Descargas# ghc -idist/build -lmysqlclient –make Test [1 of 1] Compiling Main ( Test.hs, Test.o ) Linking Test … root@linux:/home/ladmin/Descargas# * Finalmente vemos que el archivo Test.hs generó los siguientes archivos:
CRÉDITOS:
* cerebro: José Quiñones.
* semicerebro: Walter Segama.
oye buen post, nada mas tengo una duda con el comando para compilar build -lmysqlclient –make Test
pues me sale target `–make’ is not a module name or a source file