Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bdee356

Browse filesBrowse files
committed
Allow composite primary keys
1 parent 114b617 commit bdee356
Copy full SHA for bdee356

File tree

Expand file treeCollapse file tree

1 file changed

+13
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+13
-2
lines changed

‎ssql.php

Copy file name to clipboardExpand all lines: ssql.php
+13-2Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,8 +561,19 @@ private function getParameters(array $columns, string $name, $primary = NULL) {
561561
else
562562
$r[] = "`{$cname}` {$t}({$s}) {$n}{$d}{$o}{$a}";
563563
};
564-
if($name!="add" && $primary)
565-
$r[] = "PRIMARY KEY (`{$this->escape($primary)}`)";
564+
if($name!="add" && $primary!==NULL) {
565+
if(is_array($primary)) {
566+
if(count($primary)==0)
567+
return $r;
568+
$keyString = "PRIMARY KEY (";
569+
$keyString.= $this->escape(array_shift($primary));
570+
foreach($primary as $k2 => $v2)
571+
$keyString.= ", `" . $this->escape($v2) . "`";
572+
$keyString.= ")";
573+
}
574+
else
575+
$r[] = "PRIMARY KEY (`{$this->escape($primary)}`)";
576+
};
566577
return $r;
567578
}
568579

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.