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
2bdb6860
Commit
2bdb6860
authored
Jan 10, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated sqlite export driver
parent
e91feeaf
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
1 deletion
+45
-1
Sqlite.php
lib/Doctrine/Export/Sqlite.php
+45
-1
No files found.
lib/Doctrine/Export/Sqlite.php
View file @
2bdb6860
...
...
@@ -85,7 +85,51 @@ class Doctrine_Export_Sqlite extends Doctrine_Export
}
$fields
[]
=
$fieldString
;
}
$query
.=
' ('
.
implode
(
', '
,
$fields
)
.
')'
;
$query
.=
' ('
.
implode
(
', '
,
$fields
)
.
')'
;
return
$this
->
conn
->
exec
(
$query
);
}
/**
* create sequence
*
* @param string $seqName name of the sequence to be created
* @param string $start start value of the sequence; default is 1
* @return boolean
*/
public
function
createSequence
(
$seqName
,
$start
=
1
)
{
$sequenceName
=
$this
->
conn
->
quoteIdentifier
(
$this
->
conn
->
getSequenceName
(
$seqName
),
true
);
$seqcolName
=
$this
->
conn
->
quoteIdentifier
(
$this
->
conn
->
getAttribute
(
Doctrine
::
ATTR_SEQCOL_NAME
),
true
);
$query
=
'CREATE TABLE '
.
$sequenceName
.
' ('
.
$seqcolName
.
' INTEGER PRIMARY KEY DEFAULT 0 NOT NULL)'
;
$this
->
conn
->
exec
(
$query
);
if
(
$start
==
1
)
{
return
true
;
}
try
{
$this
->
conn
->
exec
(
'INSERT INTO '
.
$sequenceName
.
' ('
.
$seqcolName
.
') VALUES ('
.
(
$start
-
1
)
.
')'
);
return
true
;
}
catch
(
Doctrine_Connection_Exception
$e
)
{
// Handle error
try
{
$result
=
$db
->
exec
(
'DROP TABLE '
.
$sequenceName
);
}
catch
(
Doctrine_Connection_Exception
$e
)
{
throw
new
Doctrine_Export_Exception
(
'could not drop inconsistent sequence table'
);
}
}
throw
new
Doctrine_Export_Exception
(
'could not create sequence table'
);
}
/**
* drop existing sequence
*
* @param string $seq_name name of the sequence to be dropped
* @return boolean
*/
public
function
dropSequence
(
$seq_name
)
{
$sequenceName
=
$this
->
conn
->
quoteIdentifier
(
$this
->
conn
->
getSequenceName
(
$seqName
),
true
);
return
$this
->
conn
->
exec
(
'DROP TABLE '
.
$sequenceName
);
}
}
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