patchphpGroupWare - Patches: patch #3927, Patch to enable mssql with adodb

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #3927: Patch to enable mssql with adodb

Submitter:  Sigurd Nes <sigurdne>
Submitted:  Thu 21 Apr 2005 12:30:45 PM UTC
   
 
Category:  API - phpGWapi Priority:  5 - Normal
Item Group:  None Status:  Done
Privacy:  Public Assigned to:  fipsfuchs
Open/Closed:  Closed

Jump to the original submission

Wed 04 May 2005 02:43:37 PM UTC, comment #8: 

applied

Philipp Kamps <fipsfuchs>
Wed 04 May 2005 01:11:35 PM UTC, comment #7: 

Solved! - I think
The FetchMode can be defined by SetFetchMode - which can be called from class.db.inc.php - and thereby keep adodb untouched.
See updated patch.
I have also tested for mysql and postgres.

Regards

Sigurd

Sigurd Nes <sigurdne>
Group Member
Tue 03 May 2005 07:25:31 AM UTC, comment #6: 

This is the core of the problem - it works for mysql - but NOT for mssql without setting ADODB_FETCH_DEFAULT to 3.(I have not tested for pgsql)

Your result is very strange to me -I must be doing something fundamentally wrong about this. I can not reproduce this result -you are really testing this on mssql?

I also tried to install on pgsql - but quickly ran into problems like the switch in class.schema_proc.inc.php (line 30) is taking 'postgres' instead of 'pgsql' and therefore not initializing the m_oTranslator.

Regards

Sigurd

Sigurd Nes <sigurdne>
Group Member
Mon 02 May 2005 02:59:36 PM UTC, comment #5: 

Please see this code for example:


// read the tickets
$sql = 'SELECT * FROM phpgw_tts_tickets '.
       'LEFT JOIN phpgw_tts_views ON (phpgw_tts_tickets.ticket_id = phpgw_tts_views.view_id AND phpgw_tts_views.view_account_id = '.$GLOBALS['phpgw_info']['user']['account_id'].') '.
       'WHERE '.$filterstring.$sortmethod;
echo $sql;
$rs = $GLOBALS['phpgw']->db->adodb->Execute($sql);
$alltickets = $rs->GetArray();

a _debug_array($alltickets) gives:


Array
(
    [0] => Array
        (
            [0] => 3
            [ticket_id] => 3
            [1] => 2
            [ticket_group] => 2
            [2] => 1
            [ticket_priority] => 1
            [3] => 6
            [ticket_owner] => 6
            [4] => 3
            [ticket_assignedto] => 3
            [5] => asdf
            [ticket_subject] => asdf
            [6] => 1
            [ticket_category] => 1
            [7] => 0.00
            [ticket_billable_hours] => 0.00
            [8] => 0.00
            [ticket_billable_rate] => 0.00
            [9] => O
            [ticket_status] => O
            [10] => asdf
            [ticket_details] => asdf
            [11] => 1
            [ticket_type] => 1
            [12] => 0--0
            [ticket_deadline] => 0--0
            [13] =>
            [ticket_effort] =>
            [14] => 1
            [ticket_platform] => 1
            [15] => 0
            [ticket_attachment] => 0
            [16] => 1115045643
            [ticket_lastmod] => 1115045643
            [17] =>
            [view_id] =>
            [18] =>
            [view_account_id] =>
            [19] =>
            [view_time] =>
        )

)

I don't have changed adodb's config.

Cheers, fips

Philipp Kamps <fipsfuchs>
Mon 02 May 2005 10:57:40 AM UTC, comment #4: 

Thanks Philipp - we are getting closer.
I don’t quite see how I can use GetAssoc. The problem - as I understand it - is that the field names are missing from the recordset when ADODB_FETCH_DEFAULT is set to '0'.
Using GetAssoc will produce an array where the first column of the recordset becomes the key to the rest of the array (if there is more than 2 columns).

Anyhow - if you are suggesting this function to be used in the retrievals of values in the apps so-layer - it means that there is need for a major rewrite of the so-layers all over phpgroupware to support mssql. But of course - I might be mistaken; could you provide an example on how to use GetAssoc - so I can have a testrun?

Regards

Sigurd

Sigurd Nes <sigurdne>
Group Member
Mon 02 May 2005 08:07:17 AM UTC, comment #3: 

Hi Sigurd,

1) why not using function "GetAssoc"?
   I would prefer to keep adodb untouched. This makes an
   upgrade to another version of adodb very easy.


5) patch modified and applied

Cheers, fips

Philipp Kamps <fipsfuchs>
Fri 29 Apr 2005 08:45:16 AM UTC, comment #2: 

Hi Philipp,

1) I more think of this as configuring adodb,
http://rush3d.com/reference/adodb-4.50/reference.varibles.adodb_fetch_mode.html

if ADODB_FETCH_DEFAULT is set to '0'
the fieldnames is not defined in the resultSet from the adodb_mssql Object:

            [fields] => Array
                (
                    [0] => 1
                    [1] => phpgwapi
                    [2] => 3
                    [3] => 1
                    [4] => phpgw_config,....
                    [5] => 0.9.17.500
                )

ADODB_FETCH_DEFAULT set to '3'

gives

            [fields] => Array
                (
                    [0] => 1
                    [app_id] => 1
                    [1] => phpgwapi
                    [app_name] => phpgwapi
                    [2] => 3
                    [app_enabled] => 3
                    [3] => 1
                    [app_order] => 1
                    [4] => phpgw_config,...
                    [app_tables] => phpgw_config,...
                    [5] => 0.9.17.500
                    [app_version] => 0.9.17.500
                )


5)echo $GLOBALS['phpgw']->adodb->ErrorNo();
gives 0

echo $GLOBALS['phpgw']->adodb->ErrorMsg();
gives "Changed database context to '<databasename>'."
This is not an error message: mssql and sybase generates the warning whenever you change (connect to) databases

Regards

Sigurd

Sigurd Nes <sigurdne>
Group Member
Thu 28 Apr 2005 06:21:04 PM UTC, comment #1: 

Hi Sigurd,


1) Is this really necessary? Do we really have to change the original adodb code?

2) I haven't really understand it - applied anyway ;-) Works fine to me.

3) patch applied

4) patch applied (I even removed more code)

5) $GLOBALS['phpgw']->adodb->ErrorMsg()
   Please give me the $GLOBALS['phpgw']->adodb->ErrorNo()

Cheers, fips

Philipp Kamps <fipsfuchs>
Thu 21 Apr 2005 12:30:45 PM UTC, original submission:  

1) define('ADODB_FETCH_DEFAULT',3)  to enable ->db->f('fieldname')
2) $sFieldSQL: Unless is defined to allow NULL - no columns that are supposed to allow NULL - will allow NULL. For starter - one will not be able to add the admin user.
3) function GetFKSQL is missing (this one is copied from mysql)
4) The phpgw_applications.app_id is autoincremented - so the app_id have to be removed from the insert - statement.
5) $GLOBALS['phpgw']->adodb->ErrorMsg() reports 'Changed database context to' - when connecting to a new database.

Regards

Sigurd

Sigurd Nes <sigurdne>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #8792:  patch_mssql_adodb_2.diff added by sigurdne (464B - application/octet-stream)
file #8703:  patch_mssql_adodb.diff added by sigurdne (5KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

 

Follow 9 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2005-05-04 fipsfuchs StatusNone Done
    Open/ClosedOpen Closed
2005-05-04 sigurdne Attached File- Added patch_mssql_adodb_2.diff, #4563
2005-05-02 sigurdne Open/ClosedClosed Open
2005-05-02 fipsfuchs Assigned toskwashd fipsfuchs
    Open/ClosedOpen Closed
2005-04-21 sigurdne Attached File- Added patch_mssql_adodb.diff, #4482
    Carbon-Copy- Added ceb
    Carbon-Copy- Added skwashd

Back to the top

Powered by Savane 3.13-02a9.
Corresponding source code