Skip to content

Commit 8c21ab4

Browse files
authored
feat: new functions for processing sybase indexes
1 parent bd9c8f2 commit 8c21ab4

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

src/Database/Query/Processor.php

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,43 @@
66

77
class Processor extends SqlServerProcessor
88
{
9-
//
9+
/**
10+
* Process the results of an indexes query.
11+
* @param array $results
12+
* @return array
13+
*/
14+
public function processIndexes($results)
15+
{
16+
$array = [];
17+
$indexes = collect($results)->unique('name');
18+
foreach ($indexes AS $index)
19+
{
20+
$aux = [];
21+
$aux['name'] = $index->name;
22+
$aux['columns'] = $this->concatenaCampos($results,$index->name);
23+
$aux['unique'] = $index->is_unique;
24+
$aux['primary'] = $index->is_primary;
25+
array_push($array, $aux);
26+
}
27+
return $array;
28+
}
29+
30+
/**
31+
* @param $results
32+
* @param $indexName
33+
* @return array
34+
* Helper function for building index vector
35+
*/
36+
public function getColumnsFromIndexResult($results, $indexName)
37+
{
38+
$columns = [];
39+
foreach ($results AS $result)
40+
{
41+
if ($result->name == $indexName)
42+
{
43+
array_push($columns,$result->column_name);
44+
}
45+
}
46+
return $columns;
47+
}
1048
}

0 commit comments

Comments
 (0)