Julian Tree | 8 Aug 09:36
Picon

Re: Support for PostgreSQL sequences

Hmmm... I am having problem add a new record for postgresql

Root/type.properties:
---------------------------------------------------
_children 				= collection(Company)
_children.accessname 	= company_id

Company/type.properties:
---------------------------------------------------
_db          			= filepressdb
_table       			= company
_id          			= company_id
_idgen 					= company_company_id_seq
_name      	 			= company_name
creator 	 			= creator
modifier 	 			= modifier
contact_name 			= contact_name
company_name 			= company_name
email        			= email   			
company_type 			= company_type
             			

Root/new.hac
-------------------------------
var c = new Company();
c.company_name = "Blah Blah";
c.company_type = "agency";
root.add(c);

I get following error
(Continue reading)

Hannes Wallnoefer | 8 Aug 09:56
Picon
Gravatar

Re: Support for PostgreSQL sequences

Finally some Postgresql testing! Great!

2006/8/8, Julian Tree <julian.tree <at> gmail.com>:
>
> I get following error
> java.lang.RuntimeException: org.postgresql.util.PSQLException: ERROR:
> relation "dual" does not exist
> (/helma-1.5.0/apps/filepress/Root/temp.hac#10)
> the sql Log gives me this :  SELECT 'company_company_id_seq'.nextval FROM dual

That's weird, because this is the Oracle syntax. What you should get
is "SELECT nextval('sequence_name')".

What is the class name of the JDBC driver you're using? Are you using
the latest Helma 1.5 CVS snapshot?

> if I comment out the _idgen line I get this error
> ERROR: column "company_id" is of type integer but expression is of
> type character varying
>

OK, this is to be expected, I'm fixing it now.

hannes
Julian Tree | 8 Aug 10:25
Picon

Re: Support for PostgreSQL sequences

Thanks a Hannes, I meant to test it much sooner, just have being
distracted by another project for a few weeks.

BTW, I just want to clearfiy some thing about PostgreSQL.

Since postgresql is already managing the incrementing of the id, there
is really no need to put the id in the INSERT statement.

So simple EXCLUDE the primary key  (or the key that is defined as _id)
in the insert statement will fix this problem. This will also allow
postgres to hand race conditions regarding id generation.

INSERT INTO company ( company_type, creator,
modifier, contact_name, company_name, email, phone_main, phone_fax,
phone_mobile, phone_other, web_site, comments ) VALUES ( ?, ?, ?,
?, ?, ?, ?, ?, ?, ?, ?, ? )

If you need to grab the id of the last inserted record  then use this
statement instead

SELECT CURRVAL('name_of_seq');

starting with postgresql 8, there is a better way to do get the next id,

SELECT CURRVAL(pg_get_serial_sequence('name_of_table','name_of_column'));

WIth this method the you only have to provide the table and column
name, and the postgresql will figure out the seq_name.  This way the
user doesn't have to define the line such as

(Continue reading)

Hannes Wallnoefer | 8 Aug 11:21
Picon
Gravatar

Re: Support for PostgreSQL sequences

2006/8/8, Julian Tree <julian.tree <at> gmail.com>:
>
> Since postgresql is already managing the incrementing of the id, there
> is really no need to put the id in the INSERT statement.

Nope, automatic ID generation is not going to work with Helma. We do
not support this with any db, neither MySQL nor Oracle. You'll simply
have to define the primary key as integer column, and than let Helma
get the id via nextval(). Sorry for not seeing this right away.

> > What is the class name of the JDBC driver you're using? Are you using
> > the latest Helma 1.5 CVS snapshot?

Could you still answere these two questions, please?

hannes
Julian Tree | 8 Aug 17:45
Picon

Re: Support for PostgreSQL sequences

oh I see now,

I am using postgresql-8.1-407, and last night I tried using the
lastest helma checkedout from csv. I am not getting the "the SELECT
'company_company_id_seq'.nextval FROM dual" error anymore,

I still get the following ERROR: column "company_id" is of type
integer but expression is of
type character varying
sql Log: INSERT INTO company ( company_id, company_type, creator,
modifier, contact_name, company_name, email, phone_main, phone_fax,
phone_mobile, phone_other, web_site, comments ) VALUES ( ?, ?, ?, ?,
?, ?, ?, ?, ?, ?, ?, ?, ? )

Thanks

On 8/8/06, Hannes Wallnoefer <hannesw <at> gmail.com> wrote:
> 2006/8/8, Julian Tree <julian.tree <at> gmail.com>:
> >
> > Since postgresql is already managing the incrementing of the id, there
> > is really no need to put the id in the INSERT statement.
>
> Nope, automatic ID generation is not going to work with Helma. We do
> not support this with any db, neither MySQL nor Oracle. You'll simply
> have to define the primary key as integer column, and than let Helma
> get the id via nextval(). Sorry for not seeing this right away.
>
> > > What is the class name of the JDBC driver you're using? Are you using
> > > the latest Helma 1.5 CVS snapshot?
>
(Continue reading)

Hannes Wallnoefer | 8 Aug 17:55
Picon
Gravatar

Re: Support for PostgreSQL sequences

2006/8/8, Julian Tree <julian.tree <at> gmail.com>:
> I am using postgresql-8.1-407, and last night I tried using the
> lastest helma checkedout from csv. I am not getting the "the SELECT
> 'company_company_id_seq'.nextval FROM dual" error anymore,

great!

> I still get the following ERROR: column "company_id" is of type
> integer but expression is of
> type character varying

If you do a CVS update now and rebuild, that error should be gone,
too. Can you please check?

thanks,
hannes
Hannes Wallnoefer | 8 Aug 18:25
Picon
Gravatar

final testing for helma 1.5.1

I just committed a fix for <http://helma.org/bugs/show_bug.cgi?id=468>
and with this I'm ready to release helma 1.5.1. Since the changes (and
enhancements) in the last commit were quite massive (and although I
tested everything meticulously, of course :-), I'd like to ask for
people to take a quick test drive with the current cvs code.

If I don't get any complaints, I'll probably put out a 1.5.1 release
candidate later this evening.

hannes
Julian Tree | 8 Aug 19:44
Picon

Re: Support for PostgreSQL sequences

Ok, it is working now. Thanks.

So it seems that helma is not using any the advance features
postgresql is offering.  I assume it is not recommended to use stored
procedure or triggers in combination with helma.

On 8/8/06, Hannes Wallnoefer <hannesw <at> gmail.com> wrote:
> 2006/8/8, Julian Tree <julian.tree <at> gmail.com>:
> > I am using postgresql-8.1-407, and last night I tried using the
> > lastest helma checkedout from csv. I am not getting the "the SELECT
> > 'company_company_id_seq'.nextval FROM dual" error anymore,
>
> great!
>
> > I still get the following ERROR: column "company_id" is of type
> > integer but expression is of
> > type character varying
>
> If you do a CVS update now and rebuild, that error should be gone,
> too. Can you please check?
>
> thanks,
> hannes
> _______________________________________________
> Helma-user mailing list
> Helma-user <at> helma.org
> http://helma.org/mailman/listinfo/helma-user
>
Julian Tree | 8 Aug 20:10
Picon

looping through HopObject Members

how can I do that?

Company/type.properties
----------------
_db          			= filepressdb
_table       			= company
_id          			= company_id
_idgen 					= company_company_id_seq
_name      	 			= company_name
 creator 	 			= creator
modifier 	 			= modifier                         			
contact_name 			= contact_name
company_name 			= company_name
email        			= email
company_type 			= company_type

How can I loop through the members of Company HopObjects

I tried the following
var p = new Company();
var l = p.size();
for (var i=0;i<l;i++){
	// do something
}

doesn't work
for(var i in p){
 //do something, also doesn't work.
}
(Continue reading)

Julian Tree | 8 Aug 20:28
Picon

get HopObject datatype

I know this should be possible, but just don't know how to go about it

How to get the datatype of memebers of a hopobject

lets say the hopobject is setup as below

Company/type.properties
_db                             = filepressdb
_table                          = company
_id                             = company_id
_idgen                                  = company_company_id_seq
_name                                   = company_name
 creator                                = creator
 creationtime                                = creationtime
modifier                                = modifier
contact_name                    = contact_name
company_name                    = company_name
email                           = email
company_type                    = company_type

Is there anyway to tell whether the
Company.creationtime is a timestamp,
Company.email is a varchar,
Company._id is an integer

That information is from the database, is it recorded in a hash or
object somewhere when the applciation starts?

Gmane