You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(6) |
Feb
(6) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(3) |
Sep
(5) |
Oct
(8) |
Nov
(4) |
Dec
(1) |
2004 |
Jan
(2) |
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
2005 |
Jan
|
Feb
(8) |
Mar
(8) |
Apr
|
May
|
Jun
(6) |
Jul
|
Aug
|
Sep
(1) |
Oct
(1) |
Nov
(4) |
Dec
(2) |
2006 |
Jan
(1) |
Feb
(5) |
Mar
(3) |
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(8) |
Sep
|
Oct
(1) |
Nov
(3) |
Dec
(3) |
2007 |
Jan
(5) |
Feb
(11) |
Mar
(5) |
Apr
(5) |
May
|
Jun
(1) |
Jul
(3) |
Aug
(2) |
Sep
(9) |
Oct
(4) |
Nov
(6) |
Dec
(6) |
2008 |
Jan
(7) |
Feb
(9) |
Mar
(39) |
Apr
(23) |
May
(17) |
Jun
(5) |
Jul
(31) |
Aug
(16) |
Sep
(10) |
Oct
(23) |
Nov
(53) |
Dec
(61) |
2009 |
Jan
(31) |
Feb
(17) |
Mar
(23) |
Apr
(46) |
May
(122) |
Jun
(87) |
Jul
(67) |
Aug
(24) |
Sep
(23) |
Oct
(39) |
Nov
(10) |
Dec
(15) |
2010 |
Jan
(9) |
Feb
(9) |
Mar
(35) |
Apr
(55) |
May
(91) |
Jun
(60) |
Jul
(32) |
Aug
(50) |
Sep
(20) |
Oct
(3) |
Nov
(1) |
Dec
|
2011 |
Jan
(1) |
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
(1) |
Jul
(1) |
Aug
|
Sep
|
Oct
(1) |
Nov
(1) |
Dec
|
2012 |
Jan
|
Feb
(2) |
Mar
|
Apr
(1) |
May
(1) |
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
2015 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Frederik E. <fre...@a5...> - 2005-11-09 15:25:36
|
Hi, I just added a new SqlBind instance to HSQL.hsc instance SqlBind a => SqlBind (Maybe a) which returns NULL values as Nothing. I needed this because I'm using an algorithm that uses NULL values and I didn't want to have to call getFieldValueMB all the time. Actually I'm using my own wrapper module which uses heterogenous lists so handling NULL values through the type system is just much more convenient for me: http://ofb.net/~frederik/futility/src/HSQLExtras.hs Anyway, it was a bit of work to add this. I had to add a new method to the SqlBind class fromSqlCStringLen :: SqlType -> CString -> Int -> IO (Maybe a) fromSqlCStringLen sqlType cstr cstrLen = if cstr == nullPtr then return Nothing else fromNonNullSqlCStringLen sqlType cstr cstrLen to be used instead of fromNonNullSqlCStringLen :: SqlType -> CString -> Int -> IO (Maybe a) This is because apparently NULL values originally get into the system as nullPtr's, so SqlBind needs to be able to know about those nullPtr's in order to process NULL values. Now getFieldValueMB passes fromSqlCStringLen rather than fromNonNullSqlCStringLen to the driver. The drivers have to be updated to make use of this feature - currently they intercept NULL values and return Nothing, but they have to be changed so that they pass these along to value extractor (which will return Just Nothing in the case of my new instance). If they aren't changed, the old behavior will just be preserved so it's *not* necessary to change all of them at once. I updated MySQL (tested) and PostgreSQL (not tested), so you can see what has to be done. Now I can write something like this (it uses another wrapper, http://ofb.net/~frederik/futility/src/DBTool.hs) query0 (sql "insert into $bar values (2,null)") Just ((a::Maybe Int) :. (b::Maybe Int) :. Nil) <- query1 (sql "select * from $bar limit 1") print (a,b) ==> (Just 2,Nothing) I hope this patch is suitable. If it isn't accepted then I'll have to create my own fork of the library, because I depend on this feature in other stuff I'm distributing. Cheers, Frederik |
From: Mark W. <mwa...@bi...> - 2005-11-03 09:27:19
|
A call is being made to set SQL_ATTR_ROW_ARRAY_SIZE to 2 however this is = only compiled in if MSSQL_ODBC is defined which it was in the Setup.lhs = that I had.=20 I can't access CVS to confirm if this is in the main source tree or why = it was put in. Cheers Mark ----- Original Message -----=20 From: Mark Wassell=20 To: hto...@li...=20 Sent: Tuesday, November 01, 2005 9:12 PM Subject: [htoolkit-users] HSQL 1.6 only returning Hi, I am using HSQL 1.6 with ODBC to a MySQL database on Windows XP. When = I do a query only every other row is being returned (ie only half of the = rows).=20 Does anyone have any idea what might be going on? I don't have a = problem using Ruby. The code is based on the example code: retrieveRecords :: Connection -> IO [[String]] retrieveRecords c =3D do query c "select * from treenode " >>=3D collectRows getRow where getRow :: Statement -> IO [String] getRow stmt =3D do f1 <- (getFieldValue stmt "id") return [show (f1::Int)] main =3D handleSql print $ do bracket (connect datasource user_id password) disconnect $ \c -> inTransaction c $ \c -> do rs <- retrieveRecords c mapM print rs putStrLn "" Cheers Mark |
From: Mark W. <mwa...@bi...> - 2005-11-01 10:13:09
|
Hi, I am using HSQL 1.6 with ODBC to a MySQL database on Windows XP. When I = do a query only every other row is being returned (ie only half of the = rows).=20 Does anyone have any idea what might be going on? I don't have a problem = using Ruby. The code is based on the example code: retrieveRecords :: Connection -> IO [[String]] retrieveRecords c =3D do query c "select * from treenode " >>=3D collectRows getRow where getRow :: Statement -> IO [String] getRow stmt =3D do f1 <- (getFieldValue stmt "id") return [show (f1::Int)] main =3D handleSql print $ do bracket (connect datasource user_id password) disconnect $ \c -> inTransaction c $ \c -> do rs <- retrieveRecords c mapM print rs putStrLn "" Cheers Mark |
From: Krasimir A. <ka2...@ya...> - 2005-10-04 09:51:38
|
Hi John, I can change Sqlite.hs to Sqlite2.hs in the next HSQL release but unfortunatelly this wil break the existing programs that use SQLite. I hope that they aren't too much. HSQL already has SQLite3 driver. Cheers, Krasimir --- John Lask <jv...@ho...> wrote: > recently used HSQL: and had to make some mods.. > fromSqlValue > > also advise that you change name of sqlite module as > under windows/hugs the > sqlite.dll (hugs c interface) will cause a name > clash with sqlite.dll > (sqlite dll) - advise to change to something like > sqlite2 as the sqlite3 dll > is incompatible and you might want to add sqlite3 > support at later stage. > > in the export list of HSQL as then it is possible to > define instances of > SqlBind outside of HSQL > > JL. > > > > > ------------------------------------------------------- > SF.Net email is sponsored by: > Tame your development challenges with Apache's > Geronimo App Server. Download > it for free - -and be entered to win a 42" plasma tv > or your very own > Sony(tm)PSP. Click here to play: > http://sourceforge.net/geronimo.php > _______________________________________________ > htoolkit-users mailing list > hto...@li... > https://lists.sourceforge.net/lists/listinfo/htoolkit-users > __________________________________ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com |
From: John L. <jv...@ho...> - 2005-09-25 08:14:57
|
recently used HSQL: and had to make some mods.. fromSqlValue also advise that you change name of sqlite module as under windows/hugs the sqlite.dll (hugs c interface) will cause a name clash with sqlite.dll (sqlite dll) - advise to change to something like sqlite2 as the sqlite3 dll is incompatible and you might want to add sqlite3 support at later stage. in the export list of HSQL as then it is possible to define instances of SqlBind outside of HSQL JL. |
From: Krasimir A. <ka2...@ya...> - 2005-06-30 11:06:31
|
You should read the driver documentation for this kind of questions (e.g. MySQL and ODBC documentations). In particular cases the MySQL server name is the DNS name (or localhost). For "Connection string" or "Data source name" you should read the ODBC documentation where it is described how to create new data sources. Cheers, Krasimir --- Frederik Eaton <fre...@a5...> wrote: > The driver-specific HSQL documentation which I have > doesn't say what > syntax should be used for "Server name" in MySQL (I > assume this can > point to a unix domain socket or specify a hostname > with port..?) or > for "Connection string" or "Data source name" in > ODBC. Does anyone > know what the syntax for these strings is? > > Thanks, > > Frederik > > Database.HSQL.MySQL > Description > Synopsis > connect :: String -> String -> String -> String > -> IO Connection > module Database.HSQL > Documentation > connect > :: String Server name > -> String Database name > -> String User identifier > -> String Authentication string > (password) > -> IO Connection > Makes a new connection to the database server. > > --- > > Database.HSQL.ODBC > Description > Synopsis > connect :: String -> String -> String -> IO > Connection > driverConnect :: String -> IO Connection > module Database.HSQL > Documentation > connect > :: String Data source name > -> String User identifier > -> String Authentication string > (password) > -> IO Connection the returned value represents > the new connection > Makes a new connection to the ODBC data source > driverConnect > :: String Connection string > -> IO Connection the returned value > represents the new connection > driverConnect is an alternative to connect. It > supports data > sources that require more connection information > than the three > arguments in connect and data sources that are > not defined in the > system information. > > > -- > http://ofb.net/~frederik/ > > > ------------------------------------------------------- > SF.Net email is sponsored by: Discover Easy Linux > Migration Strategies > from IBM. Find simple to follow Roadmaps, > straightforward articles, > informative Webcasts and more! Get everything you > need to get up to > speed, fast. > http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click > _______________________________________________ > htoolkit-users mailing list > hto...@li... > https://lists.sourceforge.net/lists/listinfo/htoolkit-users > ____________________________________________________ Yahoo! Sports Rekindle the Rivalries. Sign up for Fantasy Football http://football.fantasysports.yahoo.com |
From: Frederik E. <fre...@a5...> - 2005-06-30 05:41:15
|
Hi, When I try to cast the result of a 'sum' to Int, I get the following error message: The type of sum(a.s) field can't be converted to SqlDouble type When I change the type to Double it goes away. So it looks like the error message is reporting the type converted *from* and not the type converted *to*. Maybe the text should be changed to e.g. The type of sum(a.s) field can't be converted from SqlDouble to SqlInteger Thanks, Frederik -- http://ofb.net/~frederik/ |
From: Frederik E. <fre...@a5...> - 2005-06-29 21:28:50
|
The driver-specific HSQL documentation which I have doesn't say what syntax should be used for "Server name" in MySQL (I assume this can point to a unix domain socket or specify a hostname with port..?) or for "Connection string" or "Data source name" in ODBC. Does anyone know what the syntax for these strings is? Thanks, Frederik Database.HSQL.MySQL Description Synopsis connect :: String -> String -> String -> String -> IO Connection module Database.HSQL Documentation connect :: String Server name -> String Database name -> String User identifier -> String Authentication string (password) -> IO Connection Makes a new connection to the database server. --- Database.HSQL.ODBC Description Synopsis connect :: String -> String -> String -> IO Connection driverConnect :: String -> IO Connection module Database.HSQL Documentation connect :: String Data source name -> String User identifier -> String Authentication string (password) -> IO Connection the returned value represents the new connection Makes a new connection to the ODBC data source driverConnect :: String Connection string -> IO Connection the returned value represents the new connection driverConnect is an alternative to connect. It supports data sources that require more connection information than the three arguments in connect and data sources that are not defined in the system information. -- http://ofb.net/~frederik/ |
From: tim <ti...@cs...> - 2005-06-29 19:14:29
|
Hi Krasismir, I removed all the cc options from MySQL.buildinfo and evrything built and installed fine. I haven't done any tests yet. Thank you very much! Tim Krasimir Angelov schrieb: > Hi Tim, > > It looks like there is a bug in Cabal which is fixed > in CVS. The problem is that the cc-options field in > MySQL.buildinfo contains "-fomit-frame-pointer -pipe > -march=i586 -mtune=pentiumpro" options. These options > are incorrectly passed to hsc2hs which is a bug. The > workaround is to remove manually these options. I > think that after that you will be able to preprocess > the hsc2hs scripts. > > Cheers, > Krasimir > > --- tim <ti...@cs...> wrote: > > -- Tim Richter Technischer Angestellter, Theoretische Informatik, Uni Potsdam 14482 Potsdam, August-Bebel-Str. 89, Haus 4, Zimmer 1.19 Tel.: 0331 977 3064 email: ti...@cs... |
From: Krasimir A. <ka2...@ya...> - 2005-06-28 09:27:56
|
Hi Tim, Try to run Setup.lhs with -v option: $ ./Setup.lhs build -v and send me the generated output. Can you send me the generated MySQL.buildinfo file? Cheers, Krasimir --- tim <ti...@cs...> wrote: > Hello, > > I'm rather new to Haskell, ghc, Cabal and all that. > I'd very much like to do some CGI/HTML programming > in Haskell using WASH and a MySQL Database. Since > WASH > doesn't support MySQL I thought I should give HSQL a > try. > > The hsql-1.6. package itself installed fine under > ghc 6.4 on my PC > running Mandriva 2005. But the mysql package has > following problem: > > tim@jered MySQL$ runghc Setup.lhs configure > Warning: No license-file field. > Configuring hsql-mysql-1.6... > configure: searching for ghc in path. > configure: found ghc at /usr/bin/ghc > configure: looking for package tool: ghc-pkg near > compiler in /usr/bin/ghc > configure: found package tool in /usr/bin/ghc-pkg > configure: Using install prefix: /usr/local > configure: Using compiler: /usr/bin/ghc > configure: Compiler flavor: GHC > configure: Compiler version: 6.4 > configure: Using package tool: /usr/bin/ghc-pkg > configure: No haddock found > configure: No happy found > configure: No alex found > configure: Using hsc2hs: /usr/bin/hsc2hs > configure: Using cpphs: /usr/local/bin/cpphs > configure: Reading installed packages... > configure: Dependency base-any: using base-1.0 > configure: Dependency hsql-any: using hsql-1.6 > configure: Using mysql_config: /usr/bin/mysql_config > configure: configuring mysqlclient library > > - so far, so good (or do I need some of haddock, > happy, alex ... ?) > > tim@jered MySQL$ runghc Setup.lhs build > Preprocessing library hsql-mysql-1.6... > unrecognized option `-f' > unrecognized option `-p' > unrecognized option `-m' > unrecognized option `-a' > unrecognized option `-r' > unrecognized option `-m' > unrecognized option `-f' > unrecognized option `-n' > Usage: hsc2hs [OPTIONS] INPUT.hsc [...] > > -o FILE --output=FILE name of > main output file > -t FILE --template=FILE template > file > > ... and so on ... > > *** Exception: got error code while preprocessing: > Database.HSQL.MySQL > > I hope somebody of you sees at once what's going on > and takes the time > point it out to me. > > Tim Richter > > Computer Science > University Potsdam > Germany > > > > > > ------------------------------------------------------- > SF.Net email is sponsored by: Discover Easy Linux > Migration Strategies > from IBM. Find simple to follow Roadmaps, > straightforward articles, > informative Webcasts and more! Get everything you > need to get up to > speed, fast. > http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click > _______________________________________________ > htoolkit-users mailing list > hto...@li... > https://lists.sourceforge.net/lists/listinfo/htoolkit-users > ____________________________________________________ Yahoo! Sports Rekindle the Rivalries. Sign up for Fantasy Football http://football.fantasysports.yahoo.com |
From: tim <ti...@cs...> - 2005-06-24 12:57:24
|
Hello, I'm rather new to Haskell, ghc, Cabal and all that. I'd very much like to do some CGI/HTML programming in Haskell using WASH and a MySQL Database. Since WASH doesn't support MySQL I thought I should give HSQL a try. The hsql-1.6. package itself installed fine under ghc 6.4 on my PC running Mandriva 2005. But the mysql package has following problem: tim@jered MySQL$ runghc Setup.lhs configure Warning: No license-file field. Configuring hsql-mysql-1.6... configure: searching for ghc in path. configure: found ghc at /usr/bin/ghc configure: looking for package tool: ghc-pkg near compiler in /usr/bin/ghc configure: found package tool in /usr/bin/ghc-pkg configure: Using install prefix: /usr/local configure: Using compiler: /usr/bin/ghc configure: Compiler flavor: GHC configure: Compiler version: 6.4 configure: Using package tool: /usr/bin/ghc-pkg configure: No haddock found configure: No happy found configure: No alex found configure: Using hsc2hs: /usr/bin/hsc2hs configure: Using cpphs: /usr/local/bin/cpphs configure: Reading installed packages... configure: Dependency base-any: using base-1.0 configure: Dependency hsql-any: using hsql-1.6 configure: Using mysql_config: /usr/bin/mysql_config configure: configuring mysqlclient library - so far, so good (or do I need some of haddock, happy, alex ... ?) tim@jered MySQL$ runghc Setup.lhs build Preprocessing library hsql-mysql-1.6... unrecognized option `-f' unrecognized option `-p' unrecognized option `-m' unrecognized option `-a' unrecognized option `-r' unrecognized option `-m' unrecognized option `-f' unrecognized option `-n' Usage: hsc2hs [OPTIONS] INPUT.hsc [...] -o FILE --output=FILE name of main output file -t FILE --template=FILE template file ... and so on ... *** Exception: got error code while preprocessing: Database.HSQL.MySQL I hope somebody of you sees at once what's going on and takes the time point it out to me. Tim Richter Computer Science University Potsdam Germany |
From: Robert v. H. <rh...@cs...> - 2005-03-31 11:47:20
|
Hi all, I am experiencing a problem with installing hsql on a Mac, with ghc 6.4. Namely, during make install, it says: /usr/local/bin/ghc-pkg -u -g -i hsql.pkg Reading package info from "hsql.pkg" ghc-pkg: Line 1: Invalid syntax (no colon after field name) I have attached the package.conf file from ghc. The hsql.pkg file looks like this: Package {name = "hsql", auto=True, import_dirs = ["/Users/rherk/soft/HSQL/lib/HSQL/GHC/imports"], source_dirs = [], library_dirs = ["/Users/rherk/soft/HSQL/lib/HSQL/GHC","/Users/rherk/soft/mysql/lib/mysql"], hs_libraries = ["HSsql"], extra_libraries = ["mysqlclient","mysqlclient","m","z"], include_dirs = [], c_includes = [], package_deps = ["base"], extra_ghc_opts = [], extra_cc_opts = [], extra_ld_opts = [], framework_dirs = [], extra_frameworks = [] } Now, it may of course well be that it is the package.conf file from the ghc 6.4 distribution that is wrong. If this is indeed the case, please tell me, so that I can contact them about this. Regards, Robert |
From: Bjorn B. <d00...@dt...> - 2005-03-22 09:35:33
|
Robert van Herk wrote: > However, when I do ghci -package hsql, I get: > Loading package base ... linking ... done. > Loading package hsql ... ghc-6.2.2: can't load .so/.DLL for: c=20 > (/usr/lib/libc.so: invalid ELF header) I belive you are the second person in the world to see this error. If=20 you Google for it, all you get is a log of me asking about it in the=20 #haskell irc channel. The problem is that for some reason, on some=20 machines mysql-config reports that it needs -lc. This means that=20 /usr/lib/ghc-6.2.2/package.conf will have "c" in extra_libraries, which=20 means that ghci will try to load libc.so. This is completely redundant,=20 and causes the error above. The simplest solution is to hand-edit=20 package.conf after installing HSQL and remove "c" from extra_libraries=20 in the hsql section. We should probably put a fix for this in the=20 configure script. /Bj=F6rn |
From: Robert v. H. <rh...@cs...> - 2005-03-22 09:06:51
|
Hi all, I am experiencing a problem building HSQL on SuSE 9.2, GHC 6.2.2. I checked out HSQL from cvs, did ./configure --enable-mysql --prefix=/home/robert/soft make install This seemed to go perfectly. Configure told me MySQL: yes PostgreSQL: no SQLite: no ODBC: no which was what I wanted. However, when I do ghci -package hsql, I get: Loading package base ... linking ... done. Loading package hsql ... ghc-6.2.2: can't load .so/.DLL for: c (/usr/lib/libc.so: invalid ELF header) Do you have any idea what might be wrong? Thanks, Robert |
From: Frederik E. <fre...@a5...> - 2005-03-20 05:20:14
|
> I guess that means that in a concurrent application I should use some > other object to identify the main database internally than a > connection, maybe an 'IO Connection'...? Until I get "Too many connections". Sigh. |
From: Frederik E. <fre...@a5...> - 2005-03-20 00:51:34
|
> If you already have an open result and try to run another query, you > will get an expcetion with the MySQL drivers. OK, this was the subject of my other recent message. > >What I'm seeing is that if I run closeStatement before reading all the > >rows from a query, it goes ahead and reads the rest of the rows > >silently, which is bad if there are millions of rows. For instance, if > >there is an error, like if I request a field with the wrong type, then > >since these are caught by a 'finally' clause in getFieldValue and > >trigger a closeStatement, the error message isn't printed (by > >'handleSql print' in main) until the whole table is read in, several > >minutes later. > > That doesn't seem like what you'd expect. Bug in the driver, or HSQL maybe? I don't know, but the HSQL code looks like it's doing the right thing. OTOH, MySQL should do better than that... > >I'm trying to get MyODBC installed - this is necessary using MySQL > >through ODBC, right? - to see if the behavior is any different, since > >you seemed to imply it would be less problematic. > > Well, yes and no. You don't get the exception like with the MySQL > driver, but the reason for that is that the MyODBC driver seems to fetch > the entire result set from the server straight away and keep it locally. > So you can have two open queries, but the only thing you gain from > laziness is that the data you never use will be in C code, not Haskell, > and thus take up less space. But that of course won't help if the > results are larger that you local RAM for example. Ah, that's terrible. So I have no reason to use ODBC. Frederik -- http://ofb.net/~frederik/ |
From: Frederik E. <fre...@a5...> - 2005-03-20 00:43:53
|
Uing MySQL interface ... If I try to open two statements at once, i.e. before closing the first one, then I get the error message "Commands out of sync; you can't run this command now". It looks like a limitation of libmysqlclient... If I open multiple connections, it seems to work, is this the only way to do concurrent queries? I guess that means that in a concurrent application I should use some other object to identify the main database internally than a connection, maybe an 'IO Connection'...? Frederik -- http://ofb.net/~frederik/ |
From: Bjorn B. <d00...@dt...> - 2005-03-19 23:58:53
|
Frederik Eaton wrote: >>You might want to be careful with collectRowsAsync. We have the same=20 >>thing in HaskellDB, and it turns out to be a problem with some database= s=20 >>if you run a second query without getting all that data from the first=20 >>one. I think MySQL with the native drivers does it for example, but not= =20 >>with ODBC. >=20 > What are the symptoms? If you already have an open result and try to run another query, you=20 will get an expcetion with the MySQL drivers. > What I'm seeing is that if I run closeStatement before reading all the > rows from a query, it goes ahead and reads the rest of the rows > silently, which is bad if there are millions of rows. For instance, if > there is an error, like if I request a field with the wrong type, then > since these are caught by a 'finally' clause in getFieldValue and > trigger a closeStatement, the error message isn't printed (by > 'handleSql print' in main) until the whole table is read in, several > minutes later. That doesn't seem like what you'd expect. Bug in the driver, or HSQL mayb= e? > I'm trying to get MyODBC installed - this is necessary using MySQL > through ODBC, right? - to see if the behavior is any different, since > you seemed to imply it would be less problematic. Well, yes and no. You don't get the exception like with the MySQL=20 driver, but the reason for that is that the MyODBC driver seems to fetch=20 the entire result set from the server straight away and keep it locally.=20 So you can have two open queries, but the only thing you gain from=20 laziness is that the data you never use will be in C code, not Haskell,=20 and thus take up less space. But that of course won't help if the=20 results are larger that you local RAM for example. /Bj=F6rn |
From: Frederik E. <fre...@a5...> - 2005-03-19 23:50:02
|
> You might want to be careful with collectRowsAsync. We have the same > thing in HaskellDB, and it turns out to be a problem with some databases > if you run a second query without getting all that data from the first > one. I think MySQL with the native drivers does it for example, but not > with ODBC. What are the symptoms? What I'm seeing is that if I run closeStatement before reading all the rows from a query, it goes ahead and reads the rest of the rows silently, which is bad if there are millions of rows. For instance, if there is an error, like if I request a field with the wrong type, then since these are caught by a 'finally' clause in getFieldValue and trigger a closeStatement, the error message isn't printed (by 'handleSql print' in main) until the whole table is read in, several minutes later. I'm trying to get MyODBC installed - this is necessary using MySQL through ODBC, right? - to see if the behavior is any different, since you seemed to imply it would be less problematic. Frederik -- http://ofb.net/~frederik/ |
From: Frederik E. <fre...@a5...> - 2005-02-22 21:59:35
|
On Tue, Feb 22, 2005 at 10:18:03PM +0100, Bjorn Bringert wrote: > Frederik Eaton wrote: > >I wrote some functions which can be used with HSQL to make it a lot > >more concise, using the HList concept: > > > >http://ofb.net/~frederik/SqlRow/ > > > >If anybody wants to look at it and give feedback. Maybe it could be > >incorporated into the library. > > One difference to the current HSQL is that you access record fields by > position rather than by name. Not sure whether this is good or bad. One > problem is that there is as little type safety now as before, and it's > as easy to access a non-existing field. > > The nice thing is that you can get back a whole row at a time, and I > like the pattern trick in: > > getRows stmt >>= > mapM_ (\ (m :. n :. p :. Nil) -> > > All in all I think it is a very good demonstration of what you can do > with heterogenous lists, and it's not really worse than HSQL when it > comes to type-safety. Thanks. > You might want to have a look at HaskellDB, > http://haskelldb.sourceforge.net/ . It uses a similar scheme for record > types. It adds a layer of type safety, and you construct the queries > using combinators. > > You might want to be careful with collectRowsAsync. We have the same > thing in HaskellDB, and it turns out to be a problem with some databases > if you run a second query without getting all that data from the first > one. I think MySQL with the native drivers does it for example, but not > with ODBC. About accessing record fields by name vs. position, that was one reason I wanted to write this. I wasn't sure how to name fields with expressions such as: select min(a.s), avg(a.s), max(a.s), sum(a.s) from ... and felt that it shouldn't be necessary either. Temporary names (X as a, Y as b) are possible but cumbersome. Positional bindings seem more lightweight and nimble and in tune with the rest of Haskell - they are how function parameters are done, after all. One thing that doesn't come out in the example is that it should also be a lot easier to do assignments from singleton select statements as above, with another utility function or two, which can be quite common in database applications. (min :. ave :. max :. sum :. Nil) <- doOneRow "select ..." I've looked at HaskellDB, I was shying away from it because I thought I needed a more direct mapping to SQL internals. Thanks for the heads up on collectRowsAsync. -- Frederik Eaton http://ofb.net/~frederik/ |
From: Frederik E. <fre...@a5...> - 2005-02-22 21:18:51
|
On Tue, Feb 22, 2005 at 09:51:35PM +0100, Shae Matijs Erisson wrote: > Frederik Eaton <fre...@a5...> writes: > > > Is there anyone on this list? > > Me me! I'm here! I haven't gotten around to reading the HList paper though, > so I won't be able to give you intelligent feedback on your code till I do. Oh, don't read the whole paper, in fact you probably don't need to read any of it, most of it goes far beyond what I use, which is pretty self-explanatory. data a :* l = a :. l data HNil = Nil e.g. -- x :: Bool :* String :* Int :* HNil x = True :. "Hi" :. 4 :. Nil It's just a way of giving you something like a tuple type, but with access to the internals so you can make instances based on the structure. The important part of my module is: instance SqlRow HNil where getFieldValues s [] = return Nil getFieldValues s _ = fail "Wrong number of fields" instance (SqlBind a, SqlRow l) => SqlRow (a :* l) where getFieldValues s (f:fs) = do a <- getFieldValue s f l <- getFieldValues s fs return (a :. l) The paper does other neat things like defining classes for appending two HList types and for accessing list elements by index (which has to be encoded as a type-level natural). -- Frederik Eaton http://ofb.net/~frederik/ |
From: Bjorn B. <d00...@dt...> - 2005-02-22 21:17:33
|
Frederik Eaton wrote: > I wrote some functions which can be used with HSQL to make it a lot > more concise, using the HList concept: >=20 > http://ofb.net/~frederik/SqlRow/ >=20 > If anybody wants to look at it and give feedback. Maybe it could be > incorporated into the library. One difference to the current HSQL is that you access record fields by=20 position rather than by name. Not sure whether this is good or bad. One=20 problem is that there is as little type safety now as before, and it's=20 as easy to access a non-existing field. The nice thing is that you can get back a whole row at a time, and I=20 like the pattern trick in: getRows stmt >>=3D mapM_ (\ (m :. n :. p :. Nil) -> All in all I think it is a very good demonstration of what you can do=20 with heterogenous lists, and it's not really worse than HSQL when it=20 comes to type-safety. You might want to have a look at HaskellDB,=20 http://haskelldb.sourceforge.net/ . It uses a similar scheme for record=20 types. It adds a layer of type safety, and you construct the queries=20 using combinators. You might want to be careful with collectRowsAsync. We have the same=20 thing in HaskellDB, and it turns out to be a problem with some databases=20 if you run a second query without getting all that data from the first=20 one. I think MySQL with the native drivers does it for example, but not=20 with ODBC. > Is there anyone on this list? Yes. /Bj=F6rn |
From: Shae M. E. <sh...@Sc...> - 2005-02-22 20:51:52
|
Frederik Eaton <fre...@a5...> writes: > Is there anyone on this list? Me me! I'm here! I haven't gotten around to reading the HList paper though, so I won't be able to give you intelligent feedback on your code till I do. -- Shae Matijs Erisson - http://www.ScannedInAvian.com/ - Sockmonster once said: You could switch out the unicycles for badgers, and the game would be the same. |
From: Frederik E. <fre...@a5...> - 2005-02-22 20:36:31
|
I wrote some functions which can be used with HSQL to make it a lot more concise, using the HList concept: http://ofb.net/~frederik/SqlRow/ If anybody wants to look at it and give feedback. Maybe it could be incorporated into the library. Is there anyone on this list? Frederik |
From: Frederik E. <fre...@a5...> - 2005-02-22 11:41:00
|
(needed a better subject) On Tue, Feb 22, 2005 at 03:38:55AM -0800, Frederik Eaton wrote: > Please apply: > > --- HSQL/src/HSQL.hsc 2005-02-22 03:37:23.000000000 -0800 > +++ HSQL-modified/src/HSQL.hsc 2005-02-22 03:36:44.000000000 -0800 > @@ -606,3 +606,22 @@ > return (x:xs) > else return [] > > +-- | The 'collectRowsASync' function is just like collectRows, but it > +-- uses unsafeInterleaveIO to in the same manner as hGetContents to > +-- cause rows to be read asynchronously from the database in an > +-- "on-demand" fashion as list elements are accessed in the result. > +collectRowsAsync :: (Statement -> IO a) -> Statement -> IO [a] > +collectRowsAsync act stmt = loop > + where > + closeAndThrow e = do closeStatement stmt; throw e > + loop = unsafeInterleaveIO $ (do > + success <- catch (fetch stmt) closeAndThrow > + if success > + then do > + x <- catch (act stmt) closeAndThrow > + xs <- loop > + return (x:xs) > + else do > + closeStatement stmt > + return []) > + > > Thanks, > > Frederik > > -- > Frederik Eaton http://ofb.net/~frederik/ > -- Frederik Eaton http://ofb.net/~frederik/ |