[h2] Re: Problems with TO_CHAR function (invalid format and non evaluation in SELECT statement)

2016-02-10 Thread Sam Blume

>
> I've contributed the TO_DATE (and TO_TIMESTAMP) code to H2 and it should 
> be in Version 1.4.191 (It's not mentioned in the changelog - yet). 
>
*Note*: If you have programed an alias with that name, you need to delete 
> that alias first or H2 will complain of having a name clash. 
>


Am Mittwoch, 29. Oktober 2014 16:41:00 UTC+1 schrieb Vincent Privat:
>
> Hi,
> I'm new to H2 and need to run some SQL requests originally written for 
> Oracle.
> One request involves the TO_CHAR and TO_DATE Oracle functions.
>
> As TO_DATE is not yet supported I have added an alias for it. Not yet 
> tested but at least H2 knows about my alias.
>
> However, I think I'm facing two problems with TO_CHAR (using latest H2 
> version, 1.4.182, 2014-10-17).
>
> Considering this table:
>
> CREATE TABLE CCH ( 
> id NUMBER ( 8 ) NOT NULL, 
> since TIMESTAMP NOT NULL, 
> until TIMESTAMP, 
> CONSTRAINT PK119 PRIMARY KEY (id)
> );
>
> An example of request is:
>
> SELECT
> id,
> TO_CHAR(since,'/MM/DD HH24:MI:SS'),
> TO_CHAR(until,'/MM/DD HH24:MI:SS')
> FROM CCH
> WHERE (since >= TO_DATE(?, '/MM/DD HH24:MI:SS') ) ORDER BY id;
>
> Problem 1:
> ---
> When running this request, I get the following exception:
>
> org.h2.jdbc.JdbcSQLException: Column "TO_CHAR(SINCE,/MM/DDHH24:MI:SS)" 
> not found [42122-176]
>
> which makes me think H2 does not evaluate the TO_CHAR function in SELECT 
> statements. Am I right? Should I create a new defect ticket for this? Sadly 
> I have no idea how to provide a patch to fix this, if it's confirmed it's a 
> bug.
>
> Problem 2:
> ---
> To be sure H2 supports the format written in my request I made a small 
> Java Program:
>
> import java.math.BigDecimal;
> import org.h2.util.ToChar;
>
> public class Test {
> public static void main(String[] args) {
> System.out.println(ToChar.toChar(new BigDecimal(0), 
> "/MM/DDHH24:MI:SS", null));
> }
> }
>
> Unfortunately it seems this format is not yet supported as I get:
>
> org.h2.jdbc.JdbcSQLException: Invalid TO_CHAR format 
> "/MM/DDHH24:MI:SS" [90010-182]
>
> Same question, should I create a new defect ticket for this? I think I 
> could maybe write a patch for this point.
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


Re: [h2] Compatibility with Oracle

2016-02-10 Thread Sam Blume
Hi  Victor

*FYI;* I've contributed the TO_DATE (and TO_TIMESTAMP) code to H2 and it 
should be in Version 1.4.191 
 (It's not 
mentioned in the change log :-( ). 
*Note*: If you have programed an alias with that name, you need to delete 
that alias first or H2 will complain of having a name clash. 

Cheers Sam


Am Dienstag, 19. November 2013 07:46:27 UTC+1 schrieb Noel Grandin:

>
>
> On 2013-11-19 00:04, Vitor Oliveira wrote: 
> > Hi Noel, 
> > 
> > I found a problem regarding the "to_timestamp" function, and when I was 
> looking for a solution I found this roadmap page. 
> > 
> > There are some items in the list that I think are worth mentioning: 
> > 
> >   * Support Oracle functions: TRUNC, NVL2, TO_CHAR, TO_DATE, TO_NUMBER. 
> >   * Oracle: support DECODE method (convert to CASE WHEN). 
> >   * ROWNUM: Oracle compatibility when used within a subquery. Issue 198. 
> >   * Support NATURAL [ { LEFT | RIGHT } [ OUTER ] | INNER ] JOIN (Derby, 
> Oracle) 
> > 
>
> djgredler appears to be working on Oracle compat stuff in issue 522, so 
> maybe if you ask him nicely :-) 
>
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] Re: H2 User Defined Functions

2016-02-10 Thread Sam Blume
Hi  Alex

*FYI;* I've contributed the TO_DATE (and TO_TIMESTAMP) code to H2 and it 
should be in Version 1.4.191 
 (It's not 
mentioned in the change log :-( ). 
*Note*: If you have programed an alias with that name, you need to delete 
that alias first or H2 will complain of having a name clash. 

Cheers Sam

Am Donnerstag, 7. April 2011 20:01:54 UTC+2 schrieb Alex Feng:

> Does H2 allow you to create user defined functions within the 
> database? 
>
> I want to do something like this: 
>
> insert into table1 values ('key1',to_date('MM/DD/','10/10/2011'); 
>
> instead of changing all my code to replace the "to_date" function, I 
> want to write something in H2 
> that does the same thing as the Oracle to_date.

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] Re: where we published

2016-02-10 Thread Sam Blume
Hi  

*FYI;* I've contributed the TO_DATE (and TO_TIMESTAMP) code to H2 and it 
should be in Version 1.4.191 
 (It's not 
mentioned in the change log :-( ). 
*Note*: If you have programed an alias with that name, you need to delete 
that alias first or H2 will complain of having a name clash. 

Cheers Sam

Am Mittwoch, 13. März 2013 04:20:49 UTC+1 schrieb bluerainfj:

> hi:
>  we has used h2 in our project, because we need to use 
> TO_DATE、TO_CHAR  function, but h2 is not exist,so we modify h2 
> Function.java and add some function, 
>  
> about license  
>  
> http://www.h2database.com/html/license.html  •Modifications to the H2 
> source code must be published
>  
> If we modify source code ,where we published,how to published,
>  
> best regards
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] Re: H2 - Throwing Syntax Error for Create Alias

2016-02-10 Thread Sam Blume
Hi  

*FYI;* I've contributed the TO_DATE (and TO_TIMESTAMP) code to H2 and it 
should be in Version 1.4.191 
 (It's not 
mentioned in the change log :-( ). 
*Note*: If you have programed an alias with that name, you need to delete 
that alias first or H2 will complain of having a name clash. 

Cheers Sam

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] Re: Starting/stopping H2 with ant?

2016-02-10 Thread Sam Blume
Hi  

*FYI;* I've contributed the TO_DATE (and TO_TIMESTAMP) code to H2 and it 
should be in Version 1.4.191 
 (It's not 
mentioned in the change log :-( ). 
*Note*: If you have programed an alias with that name, you need to delete 
that alias first or H2 will complain of having a name clash. 

Cheers Sam

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] Re: Alias for Existing functions

2016-02-10 Thread Sam Blume
Hi  

*FYI;* I've contributed the TO_DATE (and TO_TIMESTAMP) code to H2 and it 
should be in Version 1.4.191 
 (It's not 
mentioned in the change log :-( ). 
*Note*: If you have programed an alias with that name, you need to delete 
that alias first or H2 will complain of having a name clash. 

Cheers Sam

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] TO_DATE and TO_TIMESTAMP are in version 1.4.191 but not mentioned in the change log

2016-02-10 Thread Sam Blume
Hi  

I've contributed the TO_DATE (and TO_TIMESTAMP) code to H2 and it should be 
in Version 1.4.191 
 . 
But it's not mentioned in the change log. AND it can be removed from 
the road map as well.
Please also add following note (or something similar) to the change log: 

> Note: If you have programed an alias with that name, you need to delete 
> that alias first or H2 will complain of having a name clash. 


Cheers Sam

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


Re: [h2] TO_DATE and TO_TIMESTAMP are in version 1.4.191 but not mentioned in the change log

2016-02-10 Thread Noel Grandin



On 2016/02/10 2:21 PM, Sam Blume wrote:

But it's not mentioned in the change log. AND it can be removed from the road 
map as well.


Yeah, we don't always remember to update those for "outside" contributions 
because we normally do it with the commit.
You're welcome to submit a pull request to fix that :-)

--
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] On-Disk Format and Crash Resilience

2016-02-10 Thread Thomas Mueller
Hi,

There are two formats: the old (default in H2 version 1.3.x) PageStore
format, and the new (default in 1.4.x) MVStore format. The PageStore format
is similar to this:
https://en.wikipedia.org/wiki/Algorithms_for_Recovery_and_Isolation_Exploiting_Semantics
and the MVStore is documented in http://h2database.com/html/mvstore.html

> Could a power outage or JVM crash result in torn pages being written and
the entire database refusing to launch afterwards

In both cases that should not happen, meaning it would be a bug in H2.
Please note the PageStore format more complex than the MVStore format, but
currently more used in production. So I assume the risk is similar for both.

Regards,
Thomas


On Tue, Feb 9, 2016 at 9:15 PM, Eric Harney > wrote:

> What does H2's on-disk format look like, and how does that tie-in with
> crash resilience? Could a power outage or JVM crash result in torn pages
> being written and the entire database refusing to launch afterwards (or
> spending hours processing WAL entries, uncertain about when or even if
> it'll ever finish)?
>
> I really like MySQL's MyISAM in that respect. Yes you'll lose some data
> with it if it crashes and there's no WAL and no ACID and no nothing, but at
> the same time you'll only be losing a few rows around the affected spots
> rather than the entire table, because MyISAM doesn't use pages. How does H2
> compare to this?
>
> --
> You received this message because you are subscribed to the Google Groups
> "H2 Database" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to h2-database+unsubscr...@googlegroups.com
> 
> .
> To post to this group, send email to h2-database@googlegroups.com
> .
> Visit this group at https://groups.google.com/group/h2-database.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.