Re: [Vtigercrm-commits] [vtiger-commits] r4323 - /vtigercrm/branches/4.2_postgresql_integration/install/5createTables.inc.php

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: [Vtigercrm-commits] [vtiger-commits] r4323 - /vtigercrm/branches/4.2_postgresql_integration/install/5createTables.inc.php

Mike Fedyk
[hidden email] wrote:

> Author: allanbush
> Date: Mon Mar 20 03:04:56 2006
> New Revision: 4323
>
> Log:
> Added dummy sequence requests.
>
> Adodb usually creates sequences on demand, but if it trys to do it during a transaction problems can occur so we'll do them all right after the tables are created.  The side effect of this is that the first id in the tables will be 2 instead of 1.
>
> References ticket:17.
>
> Modified:
>     vtigercrm/branches/4.2_postgresql_integration/install/5createTables.inc.php
>
> Modified: vtigercrm/branches/4.2_postgresql_integration/install/5createTables.inc.php
> ==============================================================================
> --- vtigercrm/branches/4.2_postgresql_integration/install/5createTables.inc.php (original)
> +++ vtigercrm/branches/4.2_postgresql_integration/install/5createTables.inc.php Mon Mar 20 03:04:56 2006
> @@ -227,6 +227,30 @@
>  else
>   eecho("Tables Successfully created.\n");
>  
> +// ensure required sequences are created (adodb creates them as needed, but if
> +// creation occurs within a transaction we get problems
> +$db->getUniqueID("activity_reminder");
> +$db->getUniqueID("crmentity");
> +$db->getUniqueID("customfield_sequence");
> +$db->getUniqueID("customview");
> +$db->getUniqueID("def_org_share");
> +$db->getUniqueID("emailtemplates");
> +$db->getUniqueID("field");
> +$db->getUniqueID("import_maps");
> +$db->getUniqueID("inventorynotification");
> +$db->getUniqueID("mail_accounts");
> +$db->getUniqueID("notificationscheduler");
> +$db->getUniqueID("potstagehistory");
> +$db->getUniqueID("profile");
> +$db->getUniqueID("relatedlists");
> +$db->getUniqueID("reportmodules");
> +$db->getUniqueID("role");
> +$db->getUniqueID("rss");
> +$db->getUniqueID("selectquery");
> +$db->getUniqueID("systems");
> +$db->getUniqueID("wordtemplates");
Any way this can be detected at runtime instead of storing a list of
tables that need it in the source?
_______________________________________________
This vtiger.com email is sponsored by Zoho Planner. Still scribbling down your To-Do's on bits of paper & palms of your hands? Try the AJAX enabled, personal organizer online, Zoho Planner for FREE instead! http://zohoplanner.com/?vt 
Reply | Threaded
Open this post in threaded view
|

Re: [Vtigercrm-commits] [vtiger-commits] r4323 - /vtigercrm/branches/4.2_postgresql_integration/install/5createTables.inc.php

Michel JACQUEMES
Hi Mike,

I don't understand the purpose of this. As far as it is installation, it is
batch. So if there is a failure, simply drop the schema, create it and run
again. Use of transaction during this step is not very important. If it is
an upgrade, ask people to backup their base or do it by program.

On the other hand, if the target is to implement Mysql 5 or Postgres, they
support transactions. In that case I think something like :

$db->StartTrans();
... INSERT INTO $masterTable (id, field1,..) VALUES (DEFAULT,$val1,...)
$masterID = $db->Insert_ID();
... INSERT INTO $dependingTable (...,master_id,..) VALUES
(...,$masterID,...)
$ok = $db->CompleteTrans();

Is better

Michel

> -----Message d'origine-----
> De : [hidden email] [mailto:vtigercrm-
> [hidden email]] De la part de Mike Fedyk
> Envoyé : lundi 20 mars 2006 16:07
> À : [hidden email]; vtigercrm-
> [hidden email]
> Objet : Re: [Vtigercrm-developers] [Vtigercrm-commits] [vtiger-commits]
> r4323 -
> /vtigercrm/branches/4.2_postgresql_integration/install/5createTables.inc.p
> hp
>
> [hidden email] wrote:
> > Author: allanbush
> > Date: Mon Mar 20 03:04:56 2006
> > New Revision: 4323
> >
> > Log:
> > Added dummy sequence requests.
> >
> > Adodb usually creates sequences on demand, but if it trys to do it
> during a transaction problems can occur so we'll do them all right after
> the tables are created.  The side effect of this is that the first id in
> the tables will be 2 instead of 1.
> >
> > References ticket:17.
> >
> > Modified:
> >
> vtigercrm/branches/4.2_postgresql_integration/install/5createTables.inc.ph
> p
> >
> > Modified:
> vtigercrm/branches/4.2_postgresql_integration/install/5createTables.inc.ph
> p
> >
> ==========================================================================
> ====
> > ---
> vtigercrm/branches/4.2_postgresql_integration/install/5createTables.inc.ph
> p (original)
> > +++
> vtigercrm/branches/4.2_postgresql_integration/install/5createTables.inc.ph
> p Mon Mar 20 03:04:56 2006
> > @@ -227,6 +227,30 @@
> >  else
> >   eecho("Tables Successfully created.\n");
> >
> > +// ensure required sequences are created (adodb creates them as needed,
> but if
> > +// creation occurs within a transaction we get problems
> > +$db->getUniqueID("activity_reminder");
> > +$db->getUniqueID("crmentity");
> > +$db->getUniqueID("customfield_sequence");
> > +$db->getUniqueID("customview");
> > +$db->getUniqueID("def_org_share");
> > +$db->getUniqueID("emailtemplates");
> > +$db->getUniqueID("field");
> > +$db->getUniqueID("import_maps");
> > +$db->getUniqueID("inventorynotification");
> > +$db->getUniqueID("mail_accounts");
> > +$db->getUniqueID("notificationscheduler");
> > +$db->getUniqueID("potstagehistory");
> > +$db->getUniqueID("profile");
> > +$db->getUniqueID("relatedlists");
> > +$db->getUniqueID("reportmodules");
> > +$db->getUniqueID("role");
> > +$db->getUniqueID("rss");
> > +$db->getUniqueID("selectquery");
> > +$db->getUniqueID("systems");
> > +$db->getUniqueID("wordtemplates");
> Any way this can be detected at runtime instead of storing a list of
> tables that need it in the source?
> _______________________________________________
> This vtiger.com email is sponsored by Zoho Planner. Still scribbling down
> your To-Do's on bits of paper & palms of your hands? Try the AJAX enabled,
> personal organizer online, Zoho Planner for FREE instead!
> http://zohoplanner.com/?vt


_______________________________________________
This vtiger.com email is sponsored by Zoho Planner. Still scribbling down your To-Do's on bits of paper & palms of your hands? Try the AJAX enabled, personal organizer online, Zoho Planner for FREE instead! http://zohoplanner.com/?vt 
Reply | Threaded
Open this post in threaded view
|

Re: [Vtigercrm-commits] [vtiger-commits] r4323 - /vtigercrm/branches/4.2_postgresql_integration/install/5createTables.inc.php

Allan Bush
In reply to this post by Mike Fedyk
Not that I can see, any string could be used for the sequence it's
totally up to the program code.  I got this list by grepping trough
the source and someone could create another simply by adding the line
$id = $adb->getUniqueID("foo");  anywhere which would be pretty hard
to detect.  I'm open to ideas if someone else has any suggestions.

On 3/20/06, Mike Fedyk <[hidden email]> wrote:

> [hidden email] wrote:
> > Author: allanbush
> > Date: Mon Mar 20 03:04:56 2006
> > New Revision: 4323
> >
> > Log:
> > Added dummy sequence requests.
> >
> > Adodb usually creates sequences on demand, but if it trys to do it during a transaction problems can occur so we'll do them all right after the tables are created.  The side effect of this is that the first id in the tables will be 2 instead of 1.
> >
> > References ticket:17.
> >
> > Modified:
> >     vtigercrm/branches/4.2_postgresql_integration/install/5createTables.inc.php
> >
> > Modified: vtigercrm/branches/4.2_postgresql_integration/install/5createTables.inc.php
> > ==============================================================================
> > --- vtigercrm/branches/4.2_postgresql_integration/install/5createTables.inc.php (original)
> > +++ vtigercrm/branches/4.2_postgresql_integration/install/5createTables.inc.php Mon Mar 20 03:04:56 2006
> > @@ -227,6 +227,30 @@
> >  else
> >       eecho("Tables Successfully created.\n");
> >
> > +// ensure required sequences are created (adodb creates them as needed, but if
> > +// creation occurs within a transaction we get problems
> > +$db->getUniqueID("activity_reminder");
> > +$db->getUniqueID("crmentity");
> > +$db->getUniqueID("customfield_sequence");
> > +$db->getUniqueID("customview");
> > +$db->getUniqueID("def_org_share");
> > +$db->getUniqueID("emailtemplates");
> > +$db->getUniqueID("field");
> > +$db->getUniqueID("import_maps");
> > +$db->getUniqueID("inventorynotification");
> > +$db->getUniqueID("mail_accounts");
> > +$db->getUniqueID("notificationscheduler");
> > +$db->getUniqueID("potstagehistory");
> > +$db->getUniqueID("profile");
> > +$db->getUniqueID("relatedlists");
> > +$db->getUniqueID("reportmodules");
> > +$db->getUniqueID("role");
> > +$db->getUniqueID("rss");
> > +$db->getUniqueID("selectquery");
> > +$db->getUniqueID("systems");
> > +$db->getUniqueID("wordtemplates");
> Any way this can be detected at runtime instead of storing a list of
> tables that need it in the source?
> _______________________________________________
> This vtiger.com email is sponsored by Zoho Planner. Still scribbling down your To-Do's on bits of paper & palms of your hands? Try the AJAX enabled, personal organizer online, Zoho Planner for FREE instead! http://zohoplanner.com/?vt
>

_______________________________________________
This vtiger.com email is sponsored by Zoho Planner. Still scribbling down your To-Do's on bits of paper & palms of your hands? Try the AJAX enabled, personal organizer online, Zoho Planner for FREE instead! http://zohoplanner.com/?vt