Account Options

  1. Sign in
Google Groups Home
« Groups Home
Help with DBUtil documentation
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  9 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Christopher X. Candreva  
View profile  
 More options Sep 2 2010, 3:59 pm
From: "Christopher X. Candreva" <ch...@westnet.com>
Date: Thu, 2 Sep 2010 15:59:55 -0400 (EDT)
Local: Thurs, Sep 2 2010 3:59 pm
Subject: Help with DBUtil documentation

Could someone who understands DBUtil better than I please look at the
Manipulating Tables Wiki page, and update the examples so they all reference
the same tables/fields created in the FIRST example ?

http://community.zikula.org/index.php?module=Wiki&tag=ManipulatingTables

I would happily do it -- but if I could do it, I evidently wouldn't NEED it.
:-)

Thanks.

==========================================================
Chris Candreva  -- ch...@westnet.com -- (914) 948-3162
WestNet Internet Services of Westchester
http://www.westnet.com/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mateo TibaPalacios  
View profile  
 More options Sep 2 2010, 5:33 pm
From: Mateo TibaPalacios <nestorma...@gmail.com>
Date: Thu, 2 Sep 2010 18:33:16 -0300
Local: Thurs, Sep 2 2010 5:33 pm
Subject: Re: [Zikula] Help with DBUtil documentation

Wow
quite old code was there eh?

I've updated that wiki page and the next one, for Standard Fields.
Greetings

Mateo
Mis principios... son mis fines


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Christopher X. Candreva  
View profile  
 More options Sep 3 2010, 12:08 am
From: "Christopher X. Candreva" <ch...@westnet.com>
Date: Fri, 3 Sep 2010 00:08:22 -0400 (EDT)
Local: Fri, Sep 3 2010 12:08 am
Subject: Re: [Zikula] Help with DBUtil documentation

On Thu, 2 Sep 2010, Mateo TibaPalacios wrote:
> Wowquite old code was there eh?

> I've updated that wiki page and the next one, for Standard Fields.
> Greetings

Thank you !

Another question, on the updateObject documentation. It says the return
value is "The result set from the update operation" .  What exactly does
that mean in this context ?

And, specificly, what should I expect to seee returned if the update
operation didn't find anything to update (so that I know I need to do an
insert instead) ?

What's especially confusing is that while these are called "Objects" it
seems they are really just hashes, as there is no 'new' done to create them,
nor are theire methods to call on them.

==========================================================
Chris Candreva  -- ch...@westnet.com -- (914) 948-3162
WestNet Internet Services of Westchester
http://www.westnet.com/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mateo TibaPalacios  
View profile  
 More options Sep 3 2010, 12:35 am
From: Mateo TibaPalacios <nestorma...@gmail.com>
Date: Fri, 3 Sep 2010 01:35:04 -0300
Local: Fri, Sep 3 2010 12:35 am
Subject: Re: [Zikula] Help with DBUtil documentation

Indeed
no classes handled on 1.2.x and previous, just arrays as "Objects".

Well, specifically I don't know what to expect on a failed update, may be
false, but it's supposed that if you have the object.id, the item already
exists, I mean, you know what you're doing.

I guess you may test var_dump of the results.
If I remember ok, updateObject and insertObject returns the whole object
(record array) on success, or (bool) false on failure.

Mateo
Mis principios... son mis fines


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
RNG  
View profile  
 More options Sep 3 2010, 6:02 am
From: RNG <rga...@gmail.com>
Date: Fri, 3 Sep 2010 12:02:43 +0200
Local: Fri, Sep 3 2010 6:02 am
Subject: Re: [Zikula] Help with DBUtil documentation
Hi,

see below ...

Greetings
R

On Fri, Sep 3, 2010 at 6:08 AM, Christopher X. Candreva

<ch...@westnet.com> wrote:
> On Thu, 2 Sep 2010, Mateo TibaPalacios wrote:

>> Wowquite old code was there eh?

>> I've updated that wiki page and the next one, for Standard Fields.
>> Greetings

> Thank you !

> Another question, on the updateObject documentation. It says the return
> value is "The result set from the update operation" .  What exactly does
> that mean in this context ?

That is not quite correct.

insertObject() and updateObject() return the object as it is after the
update (in the case of insert, the "id" (autoincrement) if it exists
is added) ... if an error occurs, false is returned.

> And, specificly, what should I expect to seee returned if the update
> operation didn't find anything to update (so that I know I need to do an
> insert instead) ?

That shouldn't happen. If you pass an object, presumably it has an
autoincrement ID field so the object knows which row to update. If you
don't have such a field, you need to pass a $where clause to the
update routine. If this where clause fails to match a table row, you
still get back the object because from an SQL point of view, you
didn't cause an error.

It is up to the calling code to ensure that the correct parameters
were passed to updateObject(). So if you want to update an object, you
should first try to select it to ensure that it exists (presumably in
your pnuser/pnadmin code). If you manage to retrieve an object, you
can pass the object (if it has an ID field) or the same where clause
to updateObject().

> What's especially confusing is that while these are called "Objects" it
> seems they are really just hashes, as there is no 'new' done to create them,
> nor are theire methods to call on them.

Correct. For DBUtil and object is a data array ... this is for
historical reasons; when I first wrote DBUtil, PHP-4 object model was
really quite basic + PostNuke did not know anything about objects
(there was no PNObject yet).

Greetings
R


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Christopher X. Candreva  
View profile  
 More options Sep 3 2010, 11:13 am
From: "Christopher X. Candreva" <ch...@westnet.com>
Date: Fri, 3 Sep 2010 11:13:29 -0400 (EDT)
Local: Fri, Sep 3 2010 11:13 am
Subject: Re: [Zikula] Help with DBUtil documentation

On Fri, 3 Sep 2010, RNG wrote:
> That shouldn't happen. If you pass an object, presumably it has an
> autoincrement ID field so the object knows which row to update. If you
> don't have such a field, you need to pass a $where clause to the
> update routine. If this where clause fails to match a table row, you
> still get back the object because from an SQL point of view, you
> didn't cause an error.

I see.  In my particular application it is a form that can only be filled
out once per logged in user (reflecting a directory entry), so I'm useing
the logged in uid as the record id to keep things simple.

Usually with updates you get back a count of the number of records updated,
and if it's 0 I know to do an insert.

==========================================================
Chris Candreva  -- ch...@westnet.com -- (914) 948-3162
WestNet Internet Services of Westchester
http://www.westnet.com/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
RNG  
View profile  
 More options Sep 3 2010, 11:20 am
From: RNG <rga...@gmail.com>
Date: Fri, 3 Sep 2010 17:20:08 +0200
Local: Fri, Sep 3 2010 11:20 am
Subject: Re: [Zikula] Help with DBUtil documentation
So first do a select for "where uid=$uid" ... if you get back a result
you need an update, otherwise it's an insert.

Greetings
R

On Fri, Sep 3, 2010 at 5:13 PM, Christopher X. Candreva


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Christopher X. Candreva  
View profile  
 More options Sep 3 2010, 11:23 am
From: "Christopher X. Candreva" <ch...@westnet.com>
Date: Fri, 3 Sep 2010 11:23:00 -0400 (EDT)
Subject: Re: [Zikula] Help with DBUtil documentation

On Fri, 3 Sep 2010, RNG wrote:
> So first do a select for "where uid=$uid" ... if you get back a result
> you need an update, otherwise it's an insert.

Or -- in the pnForm constructor when I see if the form can be pre-populated,
do an insert then of a blank object if it doesn't already exist.

Thanks !

==========================================================
Chris Candreva  -- ch...@westnet.com -- (914) 948-3162
WestNet Internet Services of Westchester
http://www.westnet.com/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
RNG  
View profile  
 More options Sep 3 2010, 11:27 am
From: RNG <rga...@gmail.com>
Date: Fri, 3 Sep 2010 17:27:10 +0200
Local: Fri, Sep 3 2010 11:27 am
Subject: Re: [Zikula] Help with DBUtil documentation
Now, if I would know pnForm I could make an intelligent comment about
your idea; unfortunately this is not the case ...

Greetings
R

On Fri, Sep 3, 2010 at 5:23 PM, Christopher X. Candreva


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »