[otrs-cvs] otrs/Kernel/System LinkObject.pm,1.68,1.69

"CVS commits notifications of OTRS.org" <[email protected]>
Newsgroups gmane.comp.otrs.cvs
Message-ID <[email protected]>
Comments:
Update of /home/cvs/otrs/Kernel/System
In directory lancelot:/tmp/cvs-serv1660/Kernel/System

Modified Files:
	LinkObject.pm 
Log Message:
Moved to new SQL code style.

Author: ub

Index: LinkObject.pm
===================================================================
RCS file: /home/cvs/otrs/Kernel/System/LinkObject.pm,v
retrieving revision 1.68
retrieving revision 1.69
diff -2 -u -d -r1.68 -r1.69
--- LinkObject.pm	21 Jan 2013 15:04:09 -0000	1.68
+++ LinkObject.pm	21 Jan 2013 16:14:26 -0000	1.69
@@ -459,11 +459,15 @@
     # check if link already exists in database
     return if !$Self->{DBObject}->Prepare(
-        SQL => 'SELECT source_object_id, source_key, state_id '
-            . 'FROM link_relation '
-            . 'WHERE ( ( source_object_id = ? AND source_key = ? '
-            . 'AND target_object_id = ? AND target_key = ? ) '
-            . 'OR ( source_object_id = ? AND source_key = ? '
-            . 'AND target_object_id = ? AND target_key = ? ) ) '
-            . 'AND type_id = ? ',
+        SQL => '
+            SELECT source_object_id, source_key, state_id
+            FROM link_relation
+            WHERE (
+                    ( source_object_id = ? AND source_key = ?
+                    AND target_object_id = ? AND target_key = ? )
+                OR
+                    ( source_object_id = ? AND source_key = ?
+                    AND target_object_id = ? AND target_key = ? )
+                )
+                AND type_id = ?',
         Bind => [
             \$Param{SourceObjectID}, \$Param{SourceKey},
@@ -596,8 +600,9 @@
 
     return if !$Self->{DBObject}->Do(
-        SQL => 'INSERT INTO link_relation '
-            . '(source_object_id, source_key, target_object_id, target_key, '
-            . 'type_id, state_id, create_time, create_by) '
-            . 'VALUES (?, ?, ?, ?, ?, ?, current_timestamp, ?)',
+        SQL => '
+            INSERT INTO link_relation
+            (source_object_id, source_key, target_object_id, target_key,
+            type_id, state_id, create_time, create_by)
+            VALUES (?, ?, ?, ?, ?, ?, current_timestamp, ?)',
         Bind => [
             \$Param{SourceObjectID}, \$Param{SourceKey},
@@ -676,6 +681,8 @@
     # delete the link
     return if !$Self->{DBObject}->Do(
-        SQL => 'DELETE FROM link_relation '
-            . 'WHERE state_id = ? AND create_time < ?',
+        SQL => '
+            DELETE FROM link_relation
+            WHERE state_id = ?
+            AND create_time < ?',
         Bind => [
             \$StateID, \$DeleteTime,
@@ -745,11 +752,15 @@
     # get the existing link
     return if !$Self->{DBObject}->Prepare(
-        SQL => 'SELECT source_object_id, source_key, target_object_id, target_key, state_id '
-            . 'FROM link_relation '
-            . 'WHERE ((source_object_id = ? AND source_key = ? '
-            . 'AND target_object_id = ? AND target_key = ? ) '
-            . 'OR ( source_object_id = ? AND source_key = ? '
-            . 'AND target_object_id = ? AND target_key = ? )) '
-            . 'AND type_id = ? ',
+        SQL => '
+            SELECT source_object_id, source_key, target_object_id, target_key, state_id
+            FROM link_relation
+            WHERE (
+                    (source_object_id = ? AND source_key = ?
+                    AND target_object_id = ? AND target_key = ? )
+                OR
+                    ( source_object_id = ? AND source_key = ?
+                    AND target_object_id = ? AND target_key = ? )
+                )
+                AND type_id = ?',
         Bind => [
             \$Param{Object1ID}, \$Param{Key1},
@@ -839,10 +850,14 @@
     # delete the link
     return if !$Self->{DBObject}->Do(
-        SQL => 'DELETE FROM link_relation '
-            . 'WHERE (( source_object_id = ? AND source_key = ? '
-            . 'AND target_object_id = ? AND target_key = ? ) '
-            . 'OR ( source_object_id = ? AND source_key = ? '
-            . 'AND target_object_id = ? AND target_key = ? )) '
-            . 'AND type_id = ? ',
+        SQL => '
+            DELETE FROM link_relation
+            WHERE (
+                    ( source_object_id = ? AND source_key = ?
+                    AND target_object_id = ? AND target_key = ? )
+                OR
+                    ( source_object_id = ? AND source_key = ?
+                    AND target_object_id = ? AND target_key = ? )
+                )
+                AND type_id = ?',
         Bind => [
             \$Param{Object1ID}, \$Param{Key1},
@@ -1050,9 +1065,10 @@
     # get links where the given object is the source
     return if !$Self->{DBObject}->Prepare(
-        SQL => 'SELECT target_object_id, target_key, type_id '
-            . 'FROM link_relation '
-            . 'WHERE source_object_id = ? '
-            . 'AND source_key = ? '
-            . 'AND state_id = ? '
+        SQL => '
+            SELECT target_object_id, target_key, type_id
+            FROM link_relation
+            WHERE source_object_id = ?
+                AND source_key = ?
+                AND state_id = ? '
             . $TypeSQL,
         Bind => \@Bind,
@@ -1094,10 +1110,10 @@
     # get links where the given object is the target
     return if !$Self->{DBObject}->Prepare(
-        SQL =>
-            'SELECT source_object_id, source_key, type_id '
-            . 'FROM link_relation '
-            . 'WHERE target_object_id = ? '
-            . 'AND target_key = ?  '
-            . 'AND state_id = ? '
+        SQL => '
+            SELECT source_object_id, source_key, type_id
+            FROM link_relation
+            WHERE target_object_id = ?
+                AND target_key = ?
+                AND state_id = ? '
             . $TypeSQL,
         Bind => \@Bind,
@@ -1507,5 +1523,8 @@
         # ask the database
         return if !$Self->{DBObject}->Prepare(
-            SQL   => 'SELECT name FROM link_object WHERE id = ?',
+            SQL => '
+                SELECT name
+                FROM link_object
+                WHERE id = ?',
             Bind  => [ \$Param{ObjectID} ],
             Limit => 1,
@@ -1549,5 +1568,8 @@
             # ask the database
             return if !$Self->{DBObject}->Prepare(
-                SQL   => 'SELECT id FROM link_object WHERE name = ?',
+                SQL => '
+                    SELECT id
+                    FROM link_object
+                    WHERE name = ?',
                 Bind  => [ \$Param{Name} ],
                 Limit => 1,
@@ -1709,7 +1731,8 @@
             # insert the new type
             return if !$Self->{DBObject}->Do(
-                SQL => 'INSERT INTO link_type '
-                    . '(name, valid_id, create_time, create_by, change_time, change_by) '
-                    . 'VALUES (?, 1, current_timestamp, ?, current_timestamp, ?)',
+                SQL => '
+                    INSERT INTO link_type
+                    (name, valid_id, create_time, create_by, change_time, change_by)
+                    VALUES (?, 1, current_timestamp, ?, current_timestamp, ?)',
                 Bind => [ \$Param{Name}, \$Param{UserID}, \$Param{UserID} ],
             );
@@ -1777,6 +1800,8 @@
     # ask the database
     return if !$Self->{DBObject}->Prepare(
-        SQL => 'SELECT id, name, create_time, create_by, change_time, change_by '
-            . 'FROM link_type WHERE id = ?',
+        SQL => '
+            SELECT id, name, create_time, create_by, change_time, change_by
+            FROM link_type
+            WHERE id = ?',
         Bind  => [ \$Param{TypeID} ],
         Limit => 1,
@@ -2098,5 +2123,8 @@
         # ask the database
         return if !$Self->{DBObject}->Prepare(
-            SQL   => 'SELECT name FROM link_state WHERE id = ?',
+            SQL => '
+                SELECT name
+                FROM link_state
+                WHERE id = ?',
             Bind  => [ \$Param{StateID} ],
             Limit => 1,
@@ -2135,5 +2163,8 @@
         # ask the database
         return if !$Self->{DBObject}->Prepare(
-            SQL   => 'SELECT id FROM link_state WHERE name = ?',
+            SQL => '
+                SELECT id
+                FROM link_state
+                WHERE name = ?',
             Bind  => [ \$Param{Name} ],
             Limit => 1,
---------------------------------------------------------------------
OTRS mailing list: cvs-log - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/cvs-log
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/cvs-log
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.