Topic Text   Topic Comments (0)   Topic Properties   Topic Information sits@use...
Topic title: CVS commit: * Modified the way Perforce retrieves files f... Tuesday April 18, 2006 03:45:46

Download topic text | View in variable-width font | Tab width set to 8 (change to 4)

Files in topic: (view all files)  
codestriker/CHANGELOG  1.184   {+10,-0}
codestriker/INFO.txt  1.7   {+4,-0}
codestriker/codestriker.conf  1.79   {+8,-2}
codestriker/bin/install.pl  1.2   {+1,-3}
codestriker/doc/codestriker.sgml  1.51   {+2,-2}
codestriker/lib/Codestriker.pm  1.82   {+1,-1}
codestriker/lib/Codestriker/DB/Database.pm  1.8   {+3,-0}
codestriker/lib/Codestriker/DB/Oracle.pm  1.7   {+1,-1}
SQLite.pm   {+82,-0}
codestriker/lib/Codestriker/Model/Delta.pm  1.8   {+3,-3}
codestriker/lib/Codestriker/Model/File.pm  1.24   {+3,-3}
codestriker/lib/Codestriker/Repository/Perforce.pm  1.3   {+10,-5}
codestriker/lib/Codestriker/Repository/RepositoryFactory.pm  1.19   {+4,-0}

[Add General Comment] to topic.

File SQLite.pm (Revision 1.0) [Add File Comment] [<<] [Top] [>>]
 
1 ###############################################################################
2 # Codestriker: Copyright (c) 2001, 2002 David Sitsky. All rights reserved.
3 # sits@users.sourceforge.net
4 #
5 # This program is free software; you can redistribute it and modify it under
6 # the terms of the GPL.
7
8 package Codestriker::DB::SQLite;
9
10 use strict;
11 use DBI;
12 use Codestriker;
13 use Codestriker::DB::Database;
14
15 # Module for handling a SQLite embedded database.
16
17 @Codestriker::DB::SQLite::ISA = ("Codestriker::DB::Database");
18
19 # Type mappings.
20 my $_TYPE = {
21 $Codestriker::DB::Column::TYPE->{TEXT} => "text",
22 $Codestriker::DB::Column::TYPE->{VARCHAR} => "varchar",
23 $Codestriker::DB::Column::TYPE->{INT32} => "integer",
24 $Codestriker::DB::Column::TYPE->{INT16} => "integer",
25 $Codestriker::DB::Column::TYPE->{DATETIME} => "datetime",
26 $Codestriker::DB::Column::TYPE->{FLOAT} => "numeric"
27 };
28
29 # Create a new SQLite database object.
30 sub new {
31 my $type = shift;
32
33 # Database is parent class.
34 my $self = Codestriker::DB::Database->new();
35 return bless $self, $type;
36 }
37
38 # Return the DBD module this is dependent on.
39 sub get_module_dependencies {
40 return { name => 'DBD::SQLite', version => '0' };
41 }
42
43 # Retrieve a database connection.
44 sub get_connection {
45 my $self = shift;
46
47 # SQLite supports transactions, don't enable auto_commit.
48 return $self->_get_connection(0, 1);
49 }
50
51 # Return the mapping for a specific type.
52 sub _map_type {
53 my ($self, $type) = @_;
54 return $_TYPE->{$type};
55 }
56
57 # Autoincrement type for SQLite. No need to set this, as by default if
58 # no entry is set into an integer primary key field, it will act as an
59 # auto-increment field, provided it is the first column in a table.
60 sub _get_autoincrement_type {
61 return "";
62 }
63
64 # Indicate if the LIKE operator can be applied on a "text" field.
65 # For SQLite, this is true.
66 sub has_like_operator_for_text_field {
67 my $self = shift;
68 return 1;
69 }
70
71 # Function for generating an SQL subexpression for a case insensitive LIKE
72 # operation.
73 sub case_insensitive_like {
74 my ($self, $field, $expression) = @_;
75
76 $expression = $self->{dbh}->quote($expression);
77
78 # SQLite is case insensitive by default, no need to do anything.
79 return "$field LIKE $expression";
80 }
81
82 1;
 
File SQLite.pm (Revision 1.0) [Add File Comment] [<<] [Top] [>>]
  
Legend:
Removed 
Changed
 Added

[Add General Comment] to topic.