Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
f8b96636
Commit
f8b96636
authored
Nov 15, 2006
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ported index/sequence name fixing and common manager functionality from MDB2
parent
311131b5
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
340 additions
and
11 deletions
+340
-11
Connection.php
lib/Doctrine/Connection.php
+29
-0
Export.php
lib/Doctrine/Export.php
+270
-10
Sqlite.php
lib/Doctrine/Expression/Sqlite.php
+41
-1
No files found.
lib/Doctrine/Connection.php
View file @
f8b96636
...
...
@@ -28,6 +28,7 @@
* @since 1.0
* @version $Revision$
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @author Lukas Smith <smith@pooteeweet.org> (MDB2 library)
*/
abstract
class
Doctrine_Connection
extends
Doctrine_Configurable
implements
Countable
,
IteratorAggregate
{
/**
...
...
@@ -167,6 +168,34 @@ abstract class Doctrine_Connection extends Doctrine_Configurable implements Coun
$this
->
supported
[
$feature
]
===
'emulated'
||
$this
->
supported
[
$feature
]);
}
/**
* Removes any formatting in an sequence name using the 'seqname_format' option
*
* @param string $sqn string that containts name of a potential sequence
* @return string name of the sequence with possible formatting removed
*/
public
function
fixSequenceName
(
$sqn
)
{
$seq_pattern
=
'/^'
.
preg_replace
(
'/%s/'
,
'([a-z0-9_]+)'
,
$db
->
options
[
'seqname_format'
])
.
'$/i'
;
$seq_name
=
preg_replace
(
$seq_pattern
,
'\\1'
,
$sqn
);
if
(
$seq_name
&&
!
strcasecmp
(
$sqn
,
$db
->
getSequenceName
(
$seq_name
)))
{
return
$seq_name
;
}
return
$sqn
;
}
/**
* Removes any formatting in an index name using the 'idxname_format' option
*
* @param string $idx string that containts name of anl index
* @return string name of the index with possible formatting removed
*/
public
function
fixIndexName
(
$idx
)
{
$idx_pattern
=
'/^'
.
preg_replace
(
'/%s/'
,
'([a-z0-9_]+)'
,
$db
->
options
[
'idxname_format'
])
.
'$/i'
;
$idx_name
=
preg_replace
(
$idx_pattern
,
'\\1'
,
$idx
);
if
(
$idx_name
&&
!
strcasecmp
(
$idx
,
$db
->
getIndexName
(
$idx_name
)))
{
return
$idx_name
;
}
return
$idx
;
}
/**
* returns a datadict object
*
...
...
lib/Doctrine/Export.php
View file @
f8b96636
This diff is collapsed.
Click to expand it.
lib/Doctrine/Expression/Sqlite.php
View file @
f8b96636
...
...
@@ -34,6 +34,7 @@ class Doctrine_Expression_Sqlite extends Doctrine_Expression {
/**
* Returns the md5 sum of the data that SQLite's md5() function receives.
*
* @param mixed $data
* @return string
*/
public
static
function
md5Impl
(
$data
)
{
...
...
@@ -42,6 +43,8 @@ class Doctrine_Expression_Sqlite extends Doctrine_Expression {
/**
* Returns the modules of the data that SQLite's mod() function receives.
*
* @param integer $dividend
* @param integer $divisor
* @return string
*/
public
static
function
modImpl
(
$dividend
,
$divisor
)
{
...
...
@@ -49,7 +52,7 @@ class Doctrine_Expression_Sqlite extends Doctrine_Expression {
}
/**
* Returns a concat
t
enation of the data that SQLite's concat() function receives.
* Returns a concatenation of the data that SQLite's concat() function receives.
*
* @return string
*/
...
...
@@ -57,6 +60,30 @@ class Doctrine_Expression_Sqlite extends Doctrine_Expression {
$args
=
func_get_args
();
return
join
(
''
,
$args
);
}
/**
* locate
* returns the position of the first occurrence of substring $substr in string $str that
* SQLite's locate() function receives
*
* @param string $substr literal string to find
* @param string $str literal string
* @return string
*/
public
static
function
locateImpl
(
$substr
,
$str
)
{
return
strpos
(
$str
,
$substr
);
}
public
static
function
sha1
(
$str
)
{
return
sha1
(
$str
);
}
public
static
function
ltrim
(
$str
)
{
return
ltrim
(
$str
);
}
public
static
function
rtrim
(
$str
)
{
return
rtrim
(
$str
);
}
public
static
function
trim
(
$str
)
{
return
trim
(
$str
);
}
/**
* returns the regular expression operator
*
...
...
@@ -65,6 +92,19 @@ class Doctrine_Expression_Sqlite extends Doctrine_Expression {
public
function
regexp
()
{
return
'RLIKE'
;
}
/**
* soundex
* Returns a string to call a function to compute the
* soundex encoding of a string
*
* The string "?000" is returned if the argument is NULL.
*
* @param string $value
* @return string SQL soundex function with given parameter
*/
public
function
soundex
(
$value
)
{
return
'SOUNDEX('
.
$value
.
')'
;
}
/**
* Return string to call a variable with the current timestamp inside an SQL statement
* There are three special variables for current date and time.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment